China Data API Docs

Free JSON and CSV endpoints for China's official government statistics. No authentication required.

Developer quick start

Fetch China GDP, trade, population, and CPI in one request.

Use the JSON endpoint for apps and charts, or append ?format=csv for spreadsheet-friendly downloads. Need official source context? Start with the NBS API guide or the GACC customs API guide.

Base URL

https://chinadata.live/api/v2

Try it now

curl https://chinadata.live/api/v2/data/china-gdp
curl -L "https://chinadata.live/api/v2/data/china-gdp?format=csv"

Get Dataset

GET /data/:dataset_id?format=csv

Returns metadata and all data points for a specific dataset in JSON. Add ?format=csv for CSV output.

Example Request

curl https://chinadata.live/api/v2/data/china-gdp
curl -L "https://chinadata.live/api/v2/data/china-gdp?format=csv"

Example Response

{
  "success": true,
  "data": {
    "id": "china-gdp",
    "slug": "china-gdp",
    "title": "GDP (Gross Domestic Product)",
    "category": "Economy",
    "description": "China's annual GDP in current prices (100M CNY), 1960 to 2025. Source: World Bank / NBS.",
    "source": "World Bank / National Bureau of Statistics",
    "unit": "100 Million CNY",
    "frequency": "yearly",
    "tags": ["economy", "gdp", "growth"],
    "isComparison": false,
    "data": [
      { "date": "1960", "value": 1473.3 },
      { "date": "2000", "value": 101308.6 },
      { "date": "2025", "value": 1401879 }
    ]
  }
}

Python

import requests

response = requests.get('https://chinadata.live/api/v2/data/china-gdp')
dataset = response.json()['data']

print(f"Dataset: {dataset['title']}")
print(f"Unit: {dataset['unit']}")
for point in dataset['data'][-5:]:  # last 5 years
    print(f"  {point['date']}: {point['value']}")

Python + pandas

import requests
import pandas as pd

response = requests.get('https://chinadata.live/api/v2/data/china-gdp')
dataset = response.json()['data']

df = pd.DataFrame(dataset['data'])
df['date'] = pd.to_numeric(df['date'])
df['value'] = pd.to_numeric(df['value'])
df = df.set_index('date')

print(df.tail(10))
# df.plot(title=dataset['title'])

JavaScript / Node.js

const res = await fetch('https://chinadata.live/api/v2/data/china-gdp');
const { data } = await res.json();

console.log(data.title, data.unit);
data.data.slice(-5).forEach(({ date, value }) => {
  console.log(`${date}: ${value}`);
});

Trade Data Access

Trade charts and summary tables are available on their product pages. For a complete file or a custom scope, submit a data request so coverage can be confirmed before delivery.

Request trade data

Tariff Lookup API

Returns the applicable China tariff rate for one HS code and origin country, resolved from the official 《中华人民共和国进出口税则(2026)》 statutory schedule (effective 2026-01-01). Every response includes the full rate breakdown (MFN, provisional, agreement/preferential, ordinary, quota), the provenance (schedule page and source PDF sha256), and a rules-of-origin caveat on preferential hits. Preferential rates are subject to origin certification and are never a legal guarantee.

GET /v1/tariffs?hs_code=<6|8 digits>&origin_country=AU&direction=import"a=auto&date=2026-09-06
GET /v2/payg/tariffs?hs_code=<6|8 digits> — paid tier, Authorization: Bearer <api key>

Free and Paid Tiers

The public endpoint (/v1/tariffs) is free and rate-limited to 20 lookups per IP per UTC day. Responses carry X-RateLimit-Limit / -Remaining / -Reset headers; over-limit calls return 429 with a Retry-After header. For higher volume, the metered endpoint (/v2/payg/tariffs) authenticates with a paid API key and consumes one credit per lookup (an HS6 expansion still counts as one credit), never cached, with quota.remaining_requests echoed on every response. Credits come in two packs, valid 90 days: Starter $6.90 / 1,000 lookups and Pro $139 / 10,000 lookups (about 30% below comparable flat-rate tariff APIs), provisioned automatically after Stripe checkout or manually via the contact form on the API access page.

Parameters

Parameter Meaning
hs_code Required. 6-digit HS6 expands to all HS8 national lines under it with a rates_differ flag; 8-digit returns that line (plus any ex exception lines sharing the code).
origin_country Optional ISO2 code. Agreement/preferential rates apply only when the origin is a member; unknown or omitted origins resolve MFN-first. Ignored for direction=export.
direction import (default) or export.
quota auto (default) lists the in-quota rate in the breakdown; in makes it the applicable rate. Out-of-quota treatment (Customs Law arts. 12-13) is out of scope.
date Optional YYYY-MM-DD; a date before the schedule's effective date adds a date_precedes_schedule_effective warning.

Resolution Order

The schedule's own rules drive the answer: provisional beats MFN; agreement vs provisional → lower wins (absent a provisional rate, MFN applies when lower); special-preferential vs provisional → lower wins; in-quota volume is charged the quota rate; ordinary-rate goods never receive provisional rates; the provisional export rate overrides the statutory export rate.

Example Requests

curl "https://chinadata.live/api/v1/tariffs?hs_code=02013000&origin_country=AU"
curl "https://chinadata.live/api/v1/tariffs?hs_code=020130"
curl "https://chinadata.live/api/v1/tariffs?hs_code=03019210&direction=export"

Example Response

{
  "success": true,
  "query": { "hs_code": "02013000", "direction": "import", "origin_country": "AU", "quota": "auto", "date": null },
  "schedule": { "year": 2026, "effective_from": "2026-01-01", "source_sha256": "76af4db0…" },
  "count": 1,
  "uniform": true,
  "results": [{
    "hs_code": "02013000",
    "description_zh": "--冻的带骨牛肉",
    "applicable": { "basis": "agreement:AU", "rate_percent": 0, "display": "0%", "rule": "…" },
    "breakdown": { "mfn": { "display": "12%" }, "preferential": [{ "basis": "agreement:AU", "display": "0%" }] },
    "conditions": ["Preferential rate under China-Australia FTA (AU) is subject to rules-of-origin certification…"],
    "page": 36,
    "source_sha256": "76af4db0…"
  }]
}

List All Datasets

GET /datasets

Returns a list of all available datasets with metadata (no data points).

Example Request

curl https://chinadata.live/api/v2/datasets

New: monthly China auto-market endpoints

The catalog now includes CAAM vehicle production, sales, NEV, passenger-vehicle, commercial-vehicle, and export series through July 2026.

Example Response

{
  "success": true,
  "data": [
    {
      "id": "china-gdp",
      "slug": "china-gdp",
      "title": "GDP (Gross Domestic Product)",
      "category": "Economy",
      "description": "China's annual GDP in current prices (100M CNY), 1960 to 2025.",
      "unit": "100 Million CNY",
      "frequency": "yearly",
      "tags": ["economy", "gdp"]
    },
    ...
  ]
}

Python — fetch all datasets

import requests

response = requests.get('https://chinadata.live/api/v2/datasets')
datasets = response.json()['data']

print(f"Total datasets: {len(datasets)}")
for ds in datasets:
    print(f"  {ds['id']:30s} {ds['category']}")

JavaScript

const res = await fetch('https://chinadata.live/api/v2/datasets');
const { data } = await res.json();

const economy = data.filter(ds => ds.category === 'Economy');
console.log('Economy datasets:', economy.map(ds => ds.id));

Formats, Errors, and API Versioning

Response Formats

JSON is the default format for all public endpoints. CSV is supported for generic dataset endpoints with ?format=csv. HS6/HS8 product, country, and HS chapter/category endpoints currently return JSON only.

Error Codes

Status Typical Causes
400 Invalid HS code, unsupported country flow, or invalid period parameter.
404 Dataset, country, HS product, flow, or requested period is not loaded in the public snapshot.
500 Unexpected server or database error.

API Versioning

The current public API version is /api/v2. Additive fields may be added to existing responses. Breaking changes, renamed fields, or incompatible query behavior will use a new version path or be documented in delivery notes for custom feeds.

Free endpoints are intended for evaluation, research, and light usage. Higher limits, recurring feeds, delivery SLAs, file schemas, and pagination contracts are confirmed separately for paid or custom data work.

FAQ

Do I need an API key?

No. Current public endpoints require no authentication or registration. Access remains subject to the Terms of Use.

Is there a rate limit?

Yes. Anonymous access is limited to 1,000 requests per IP per UTC day. Check the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers.

What response format is used?

All endpoints return JSON. Dates are strings (e.g. "2023"), values are numbers.

Can I download raw CSV data?

Yes — visit any dataset page and click the download button, or call the dataset endpoint with ?format=csv, for example https://chinadata.live/api/v2/data/china-gdp?format=csv.

Ready to Start?

No sign-up or API key for current public endpoints. Fair-use limits and terms apply.

API use is governed by the Terms of Use. Source and redistribution rules are in Data Use & Licensing.

Need higher limits or custom data?

Commercial API access, bulk exports, custom datasets, and API-ready delivery options are available.

Contact Us →
💬 Need custom data?