Quick start
Two ways in: one curl call, or the official SDK — two lines to a DataFrame. Neither needs an approval process.
Free endpoints work without a key. For everything else, get a key (see pricing).
# Free endpoints, no key needed
curl "https://api.ashareapi.com/v1/quote?code=sh600667"The Authorization header is recommended (keeps the key out of logs); a ?key= URL parameter also works and is handy for a quick browser test.
# Option A (recommended — use this in scripts / production): request header
curl -H "Authorization: Bearer ct-your-key" \
"https://api.ashareapi.com/v1/fund?code=sh600667"
# Option B (quick test only): URL parameter — paste it straight into a browser
curl "https://api.ashareapi.com/v1/fund?code=sh600667&key=ct-your-key"One JSON envelope: ok / endpoint / tier / elapsed_ms / source / data
{
"ok": true,
"endpoint": "fund",
"tier": "pro",
"elapsed_ms": 862,
"source": "multi",
"data": { "main_net": "...", "lhb": [...], ... }
}Official packages for Python and Node.js / TypeScript. Same response shape as REST, ready to drop into your scripts, dashboards or strategy code.
pip install ashareapifrom ashareapi import AShareAPI
cli = AShareAPI() # free endpoints need no key
df = cli.kline("sh600519", "day", 30)npm install ashareapiimport { AShareAPI } from 'ashareapi'
const cli = new AShareAPI() // free endpoints need no key
const rows = await cli.kline('sh600519', 'day', 30)sh600519 (Shanghai) · sz000001 (Shenzhen) · bj920002 (Beijing) · hk00700 (Hong Kong) · usAAPL (US). Writing 600519, 600519.SH or uppercase SH600519 returns empty data.
Paid tiers unlock all 102 endpoints, up to 1212 bars per call, and no daily cap.
Error codes
Check this table first — most problems you can solve yourself.
| Code | Meaning | What to do |
|---|---|---|
| 401 | Invalid API key | Key mistyped or disabled → check it; or you called a paid endpoint without a key |
| 403 | This key already used N different IPs today | Anti-resale limit hit → if a network change caused it, contact us to reset |
| 429 | Rate limit exceeded (per minute), or a daily endpoint cap is used up | Slow down or add a delay; if the body carries heavy_limit, that endpoint hit its daily cap and resets at 00:00 (UTC+8) |
| 200 + ok:false | Upstream fetch failed | We already switched sources and do not count these calls; if it persists, tell us (endpoint + time) |
heavy_limit, that endpoint hit its daily cap and resets at 00:00 (UTC+8)Integration guides
One config block lets Claude Code / Codex and other agents query A-share data
ViewChecked against each platform docs — just paste the URL
ViewInternational + China crawlers, official IP ranges / rDNS checks, common blocking mistakes
ViewEndpoint mapping, four-step rewrite, field mapping (including what cannot move)
Viewsecid / klt / fqt mapping, kline field map, and the six places the data differs
ViewParameters plus curl / Python / JS samples for all 102 endpoints, on one page.