Check 34.16 · Citability and original data

Offer public CSV/JSON files if relevant

Serve your data as public CSV and JSON with the right encoding, MIME types and CORS headers on Apache, Nginx, Cloudflare, AWS, WordPress or Shopify.

Priority
Important
Difficulty
Intermediate
Estimated time
1 to 3 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Offering public CSV and JSON files means putting the data files of your studies, barometers or figure catalogs online at a stable address, in formats anyone can open or query. CSV is for people who work in a spreadsheet; JSON is for developers, visualization tools and agents. Once this check is done, every file opens without broken characters, is sent with the right Content-Type, can be downloaded from the study page and can be read by a third-party script.

Why it matters

A badly served file is a file nobody reuses. The problems are always the same: garbled accented characters in Excel, a CSV served as application/octet-stream that downloads under an unintelligible name, a JSON file blocked by the browser when a third-party site wants to display it in a chart, a file renamed with every update.

On the search engine side, Google indexes CSV files (they appear in its list of indexable file types); JSON does not. Google mainly uses your file URLs through Dataset markup for Google Dataset Search. AI assistants with a browsing tool can also open a public CSV or JSON file, but none documents any specific handling of these formats: the study's HTML page remains the source they cite. The file supports verification and reuse, not rankings.

“If relevant”: a public file is only worthwhile if the data is genuinely reusable. To decide what to publish and how to anonymize it, see provide raw data if possible (opens in a new tab).

What it improves

  • Reuse Data journalists, researchers and developers work directly with your figures, citing the source.
  • Integrations A JSON file accessible via CORS (Cross-Origin Resource Sharing) feeds charts and widgets on other sites, with a link back to you.
  • Discovery Files declared in Dataset markup become discoverable in Google Dataset Search.
  • AI citations An indirect, unproven effect; the study page is what gets cited, and the files back up its credibility.
  • Rankings No direct effect.

How to check

Read the headers of a published file:

curl -s -o /dev/null -D - https://example.com/donnees/barometre-2026-t3.csv | grep -i -E "content-type|access-control|cache-control|content-disposition"

Expected result:

content-type: text/csv; charset=utf-8
access-control-allow-origin: *
cache-control: public, max-age=3600

For a JSON file, expect content-type: application/json. An application/octet-stream or a text/plain indicates a missing MIME type.

Then check the content:

curl -s https://example.com/donnees/barometre-2026-t3.csv | head -3
curl -s https://example.com/donnees/barometre-2026-t3.json | python3 -m json.tool > /dev/null && echo "Valid JSON"

Finally, open the CSV in Excel by double-clicking it: if “Délai médian” turns into “Délai médian”, the file is UTF-8 without a BOM (byte order mark) and Excel read it with another encoding.

How to implement

Before you start

Rules common to all environments:

  • A dedicated folder and stable names: /donnees/barometre-2026-t3.csv for a frozen edition, /donnees/barometre-dernier.csv if you want an address that always tracks the latest version.
  • UTF-8 encoding. For CSV files intended for spreadsheets, add the UTF-8 BOM at the start of the file: Excel then detects accented characters correctly. Data tools handle it without difficulty.
  • CSV: comma separator and decimal point for international reuse (the RFC 4180 format). If your audience mostly opens the file in a French-language Excel, offer a second semicolon-separated version rather than changing the reference version.
  • JSON: a root object holding the metadata and the rows, rather than a bare array, so the file describes itself.
  • Target headers: an exact Content-Type, Access-Control-Allow-Origin: * for public data, a short Cache-Control if the file may change.

Example of a self-describing JSON file (fictitious values):

{
  "titre": "Planifia response time barometer",
  "version": "2026-T3",
  "publie_le": "2026-10-20",
  "licence": "https://creativecommons.org/licenses/by/4.0/",
  "source": "https://example.com/barometre/",
  "citation": "Planifia (2026). Response time barometer, Q3 2026.",
  "unites": { "delai_median_jours": "business days" },
  "donnees": [
    { "secteur": "chauffage", "trimestre": "2026-T3", "delai_median_jours": 2.1, "interventions": 4210 },
    { "secteur": "ascenseurs", "trimestre": "2026-T3", "delai_median_jours": 3.4, "interventions": 1980 }
  ]
}

Adding the BOM to an existing CSV on macOS or Linux:

printf '\xEF\xBB\xBF' | cat - barometre.csv > barometre-2026-t3.csv

Good to know: do not disallow /donnees/ in robots.txt: crawlers would no longer be able to read the files declared in your Dataset markup. If you would rather the CSV did not appear in results instead of the study page, use the X-Robots-Tag: noindex header on the files, which still lets them be read.

Apache

Versions Apache 2.4.

The mime.types file shipped with Apache already maps .csv to text/csv and .json to application/json, but without a character set, and some distributions replace it. Create /donnees/.htaccess (or put these lines in the virtual host):

<IfModule mod_mime.c>
    AddType text/csv .csv
    AddType text/tab-separated-values .tsv
    AddType application/json .json
    AddCharset utf-8 .csv .tsv .json
</IfModule>

<IfModule mod_headers.c>
    <FilesMatch "\.(csv|tsv|json)$">
        Header set Access-Control-Allow-Origin "*"
        Header set Cache-Control "public, max-age=3600"
        Header set X-Content-Type-Options "nosniff"
    </FilesMatch>
</IfModule>

Add Header set X-Robots-Tag "noindex" in the same block if you do not want the files indexed. In the virtual host, test and then reload:

sudo apachectl configtest && sudo systemctl reload apache2

Nginx

Versions Nginx 1.24 and later.

Nginx's mime.types knows .json but not .csv, which is therefore sent as application/octet-stream. And the charset directive only applies by default to HTML, XML and plain text. Add this to the site's server block:

location /donnees/ {
    types {
        text/csv                  csv;
        text/tab-separated-values tsv;
        application/json          json;
    }
    charset utf-8;
    charset_types text/csv text/tab-separated-values application/json;

    add_header Access-Control-Allow-Origin "*" always;
    add_header Cache-Control "public, max-age=3600" always;
    add_header X-Content-Type-Options "nosniff" always;
}

add_header directives in a location block replace those at the server level: copy into this block the security headers you define elsewhere.

sudo nginx -t && sudo systemctl reload nginx

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

Cloudflare passes on the Content-Type sent by the origin: fix it on the server first. To add the CORS header without touching the origin:

  1. Open the Rules overview, then Create rule > Response Header Transform Rule.
  2. Custom filter expression: starts_with(http.request.uri.path, "/donnees/").
  3. Modify response header: Set static, name Access-Control-Allow-Origin, value *.
  4. Deploy.

Cloudflare caches .csv files by default, but not .json files. After each file update, purge its URL: Caching > Configuration, “Custom Purge”.

AWS

Versions Amazon S3 and CloudFront consoles, November 2026.

S3 uses the Content-Type metadata set at upload. Set it explicitly:

aws s3 cp barometre-2026-t3.csv s3://NOM_DU_BUCKET/donnees/ --content-type "text/csv; charset=utf-8" --cache-control "public, max-age=3600"
aws s3 cp barometre-2026-t3.json s3://NOM_DU_BUCKET/donnees/ --content-type "application/json; charset=utf-8" --cache-control "public, max-age=3600"

For direct access to the bucket from another site, go to the bucket's Permissions tab, Cross-origin resource sharing (CORS) section, Edit button, then paste:

[
    {
        "AllowedHeaders": [],
        "AllowedMethods": ["GET", "HEAD"],
        "AllowedOrigins": ["*"],
        "ExposeHeaders": []
    }
]

CloudFront: in the behavior that serves /donnees/*, attach the managed response headers policy SimpleCORS, then create an invalidation for /donnees/* after each update.

Plesk

Versions Plesk Obsidian 18.0.

On Plesk for Linux, Nginx often serves static files directly. Open Websites & Domains > your domain > Apache & nginx Settings and paste the location /donnees/ { … } block from the Nginx section into “Additional nginx directives”. If serving static files with Nginx is disabled, use the .htaccess from the Apache section in the donnees folder instead.

cPanel

Versions cPanel, Jupiter theme, November 2026.

Upload the files to public_html/donnees/ with File Manager (Files section), then create the .htaccess from the Apache section in that folder. The MIME Types tool in the Advanced section can also add text/csv csv, but it handles neither the character set nor the headers.

Shared hosting

With OVHcloud, o2switch, Infomaniak, Ionos or Hostinger, upload the files over FTP or SFTP to a donnees/ folder at the site root and add the .htaccess from the Apache section to it. The <IfModule> blocks prevent any error if a module is missing. Then check with the curl command from the “How to check” section.

Netlify

Versions Netlify, all plans, November 2026.

Put the files in the publish directory (public/donnees/, for example) and add a _headers file at the root of the publish directory:

/donnees/*.csv
  Content-Type: text/csv; charset=utf-8
  Access-Control-Allow-Origin: *
  Cache-Control: public, max-age=3600

/donnees/*.json
  Content-Type: application/json; charset=utf-8
  Access-Control-Allow-Origin: *
  Cache-Control: public, max-age=3600

Vercel

Versions Vercel, all plans, November 2026.

Files in public/donnees/, headers in vercel.json:

{
  "headers": [
    {
      "source": "/donnees/(.*)",
      "headers": [
        { "key": "Access-Control-Allow-Origin", "value": "*" },
        { "key": "Cache-Control", "value": "public, max-age=3600" }
      ]
    }
  ]
}

WordPress

Versions WordPress 6.4 and later.

The Media Library accepts .csv files by default, but not .json files. Two methods:

Through the Media Library

Media > Add New Media File, upload the CSV, then copy the file URL from the media details. The address contains the upload year and month (/wp-content/uploads/2026/10/…): replacing the file with a new upload will therefore change the URL. To allow JSON, add this to a custom plugin or to the child theme's functions.php:

add_filter('upload_mimes', function (array $mimes): array {
    $mimes['json'] = 'application/json';

    return $mimes;
});

WordPress also checks the file's actual content and may reject a JSON file detected as text/plain; in that case, use the second method.

Through a dedicated folder

Upload the files over SFTP to a donnees/ folder at the root of the installation, next to wp-content. URLs stay stable from one version to the next, and headers are configured as for Apache or Nginx, depending on the server.

Shopify

Versions Shopify, paid plans, November 2026.

In the admin, Content > Files, then the upload button. On paid plans, every format except HTML is accepted, up to 20 MB per file. The link button shown next to the file copies its URL on Shopify's CDN. Headers cannot be configured: check the returned Content-Type with curl, and give each version a distinct file name to avoid confusion.

Laravel

Versions Laravel 11 to 13.

Static files in public/donnees/ are served directly by the web server: configure the headers on the Apache or Nginx side. To generate an up-to-date JSON file from the database, expose a route:

use App\Models\BarometreLigne;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Route;

Route::get('/donnees/barometre-dernier.json', function (): JsonResponse {
    $lignes = BarometreLigne::query()
        ->where('trimestre', '2026-T3')
        ->get(['secteur', 'trimestre', 'delai_median_jours', 'interventions']);

    return response()
        ->json([
            'titre' => 'Planifia response time barometer',
            'version' => '2026-T3',
            'licence' => 'https://creativecommons.org/licenses/by/4.0/',
            'donnees' => $lignes,
        ], 200, [
            'Access-Control-Allow-Origin' => '*',
            'Cache-Control' => 'public, max-age=3600',
        ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
})->name('donneesBarometre');

For a large CSV, response()->streamDownload() avoids loading the whole file into memory.

Next.js

Versions Next.js 15 and 16 (App Router).

Files in public/donnees/ are served as is. Add the headers in next.config.js:

module.exports = {
  async headers() {
    return [
      {
        source: '/donnees/:path*',
        headers: [
          { key: 'Access-Control-Allow-Origin', value: '*' },
          { key: 'Cache-Control', value: 'public, max-age=3600' },
        ],
      },
    ];
  },
};

If the application is deployed on Vercel, the vercel.json file from the previous section also works.

Common mistakes

  • CSV served as application/octet-stream, the default on Nginx: some tools reject the file or rename it.
  • UTF-8 without a BOM opened in Excel: broken accented characters, and readers conclude your data is poor quality.
  • Mixing conventions: semicolon separator and decimal commas in the reference file, which breaks automated imports.
  • Forgetting CORS on the JSON file: a third-party site cannot display it in a chart, because the browser blocks the request.
  • Blocking /donnees/ in robots.txt while the Dataset markup points there.
  • Replacing the file without purging the CDN: visitors download the old version for hours.
  • Publishing a file without a link from the study page: nobody finds it, and nothing ties the data to its method.

Frequently asked questions

Should you publish your data as CSV or JSON?

Publish both when possible. CSV opens in a spreadsheet and suits journalists, analysts and non-developer readers. JSON can be read directly by a script, a visualization tool or a widget on another site, especially if it carries its metadata: title, version, license, units. Google indexes CSV files, not JSON, but the study's HTML page must remain the entry point.

Why do accented characters in my CSV file display incorrectly in Excel?

Accented characters in a CSV display incorrectly in Excel when the file is encoded in UTF-8 without a BOM: Excel then interprets it with another encoding. Add the UTF-8 byte order mark at the start of the file, or export from your spreadsheet in the “CSV UTF-8” format. On the server side, send the Content-Type: text/csv; charset=utf-8 header so browsers and tools know how to read the file.

Should data files be blocked in robots.txt?

No, do not block public data files in robots.txt. Blocking them prevents crawlers from reading the files declared in your Dataset markup and makes them invisible to Google Dataset Search. If you are worried a CSV might appear in results instead of the study page, send the X-Robots-Tag: noindex header on these files instead, which still lets them be read.

What is the CORS header and why add it to a JSON file?

The CORS header Access-Control-Allow-Origin tells the browser that a page on another domain is allowed to read your file. Without it, a third-party site that wants to display your JSON in a chart has its request blocked. For public data, the value * is fine. It only grants access to that file, without cookies or session, and poses no risk for content that is already public.

Updated on

Topic checklist (PDF)

And now?

In the “Citability and original data” topic

  1. Publish original information
  2. Publish exclusive figures and verifiable statistics
  3. Publish industry studies and surveys
  4. Publish tests and benchmarks
  5. Publish first-hand experience
  6. Publish data drawn from actual business activity
  7. Publish detailed case studies
  8. Explain the data collection methodology
  9. Specify sample sizes
  10. Specify time periods and geographic scope
  11. Present methodological limitations
  12. Identify the authors
  13. Attribute findings to their sources
  14. Give studies a stable URL
  15. Provide raw data if possible
  16. Offer public CSV/JSON files if relevant
  17. Create summary tables
  18. Create reusable resources
  19. Keep data up to date
  20. Avoid made-up statistics
  21. Avoid unverifiable marketing claims