> Source: https://ashareapi.com/en/wiki/code-format/  ·  Markdown version for LLMs / AI agents

Reference

# Code format reference
 A code is always written as market prefix plus code, and the prefix must be lowercase. A-shares use sh/sz/bj, Hong Kong hk, US us; ETFs, convertible bonds and sectors each have their own number ranges. A bare code without a prefix comes back empty on the quote endpoints.

## The format: prefix + code

```
sh600519 Shanghai Stock Exchange
sz000001 Shenzhen Stock Exchange
bj920002 Beijing Stock Exchange
hk00700 Hong Kong
usAAPL United States
```
 **The prefix must be lowercase.** Measured: `/v1/quote?code=sh600519` returns data, `/v1/quote?code=SH600519` returns empty.


## Number ranges by market

 
 | 

| 
 | Market 
 | Prefix 
 | Ranges 
 | Examples 




 

| 
 | Shanghai 
 | `sh` 
 | 6 (main board / 688 STAR) · 9 (900 B-shares) · 5 (funds, ETFs/LOFs) · 11 / 13 (convertible and exchangeable bonds) 
 | `sh600519` `sh688111` `sh510300` `sh113052` 



| 
 | Shenzhen 
 | `sz` 
 | 0 (main board) · 2 (200 B-shares) · 3 (ChiNext) · 15 / 16 / 18 (funds, ETFs/LOFs) · 12 (convertible bonds) 
 | `sz000001` `sz300750` `sz159915` 



| 
 | Beijing 
 | `bj` 
 | 92 (new 920 range) · 4 · 8 
 | `bj920002` 



| 
 | Hong Kong 
 | `hk` 
 | 5 digits 
 | `hk00700` 



| 
 | United States 
 | `us` 
 | letter ticker 
 | `usAAPL` `usBABA` 







## Special code types

 
 | 

| 
 | Type 
 | Format 
 | Example 




 

| 
 | ETF 
 | same as a stock, with `sh` / `sz` 
 | `sh510300` 



| 
 | Convertible bond 
 | `sh11x` in Shanghai · `sz12x` in Shenzhen 
 | `sh113052` 



| 
 | Shenwan sector 
 | `pt` + digits 
 | `pt01801780` 



| 
 | Index 
 | prefix written out explicitly 
 | `sh000001` (SSE Composite) 






 ⚠️ **000001 is ambiguous** — it is both the SSE Composite index and Ping An Bank. Six digits alone cannot tell them apart, so write the index as `sh000001`.


## What a bare code does

 **Measured: the quote endpoints return empty.** All of these come back as `ok:false` with an empty array:

 

- `/v1/quote?code=600519` — no prefix


- `/v1/quote?code=000001` — no prefix


- `/v1/quote?code=600519.SH` — the dot notation used by other vendors


- `/v1/quote?code=sh60051` — wrong number of digits



 ⇒ **Always include the prefix.** It is the least surprising option. If you are unsure of a code, look it up with `/v1/search` and call with the canonical form.


## Common misuses

 

- **Leaving off the prefix** — returns empty, which looks like “no such instrument”.


- **Uppercase prefix** — `SH600519` returns empty; it must be lowercase.


- **Dot notation** — `600519.SH` is not our format; we only accept `sh600519`.


- **Index without a prefix** — endpoints that auto-fill a prefix turn `000001` into Ping An Bank, so write the index as `sh000001`.




 Last updated: 2026-10-05
 Prefixes and number ranges taken from the code-resolution rules and the endpoint parameter descriptions; bare codes, prefix casing and digit-count boundaries all measured live on 2026-10-05.

 Read next

-
[Full endpoint list](/en/endpoints)

-
[Empty result is not a failure](/en/wiki/empty-result)

 [← All wiki pages](/en/wiki)
