China SnapshotDocs
Get a key ↗
Open in AI ↗
Open in ChatGPTOpen in ClaudeView Markdown
Getting started

Your first request

Start anonymously. Add a Free key when you need its history and page allowances.

Read one record#

Run this in a terminal, Python interpreter, or Node.js with fetch support. No SDK installation is required.

curl
curl --fail-with-body --silent --show-error --max-time 30 "https://china-snapshot.com/api/datasets?dataset=documents&limit=1"
python
import json
from urllib.request import Request, urlopen
request = Request('https://china-snapshot.com/api/datasets?dataset=documents&limit=1')
with urlopen(request, timeout=30) as response:
    data = json.load(response)
print(json.dumps(data, ensure_ascii=False))
typescript
const response = await fetch("https://china-snapshot.com/api/datasets?dataset=documents&limit=1");
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Read the response#

The JSON contains items, row_count, next_cursor, as_of, fields, sources and coverage. row_count counts this page, not every match. Preserve source_url when citing a result; as_of describes the query, not when the publisher released each item. Empty items is a valid query result.

Get a Free key#

Open Get a free key and use an address you control. The signup response normally says key_emailed: the key is in your inbox, not in the response. Store it as CS_API_KEY in your environment or secret manager. See authentication for the one-time delivery fallback.

Make an authenticated request#

These examples require CS_API_KEY to be set. They never print the key.

curl
curl --fail-with-body --silent --show-error --max-time 30 -H "Authorization: Bearer $CS_API_KEY" "https://china-snapshot.com/api/series/pmi-manufacturing"
python
import json
import os
from urllib.request import Request, urlopen
request = Request('https://china-snapshot.com/api/series/pmi-manufacturing', headers={'Authorization': 'Bearer ' + os.environ['CS_API_KEY']})
with urlopen(request, timeout=30) as response:
    data = json.load(response)
print(json.dumps(data, ensure_ascii=False))
typescript
const key = process.env.CS_API_KEY;
if (!key) throw new Error("Set CS_API_KEY first");
const response = await fetch("https://china-snapshot.com/api/series/pmi-manufacturing", { headers: { Authorization: `Bearer ${key}` } });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Next steps#

Find records, retrieve a record, or export a cited CSV page.

Search documentation