YunShang API

Overview

All APIs share the same calling conventions. Read this page first, then jump to the specific API docs.

Basic information

ItemValue
Base URLhttps://yunsapi.com/api/v3/
Data formatJSON
EncodingUTF-8
MethodsMostly POST; some APIs support GET
AuthenticationApp ID + App Key

Calling methods

Two equivalent forms are supported:

FormPattern
Path form (recommended)POST /api/v3/{api_code}
Parameter formPOST /api/v3/index.php?code={api_code}

Example with the SMS verification API:

# Path form
curl -X POST https://yunsapi.com/api/v3/dxyzm \
  -H "X-APP-ID: YOUR_APP_ID" \
  -H "X-APP-KEY: YOUR_APP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone":"13800138000"}'

# Parameter form
curl -X POST "https://yunsapi.com/api/v3/index.php?code=dxyzm" \
  -H "X-APP-ID: YOUR_APP_ID" \
  -H "X-APP-KEY: YOUR_APP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone":"13800138000"}'

Authentication

Every request must carry credentials. Any of the three placements works; the priority is Header > GET > POST:

ParameterPlacementDescription
app_idHeader X-APP-ID / GET / POSTApplication ID
app_keyHeader X-APP-KEY / GET / POSTApplication secret

The server reads the Header first, then GET, then POST. Using the Header consistently is recommended.

Response format

All APIs return a unified structure:

{
    "code": 0,
    "msg": "success",
    "data": {},
    "request_id": "req_xxx"
}
FieldTypeDescription
codeintBusiness status code; 0 means success, others refer to the error table
msgstringMessage
dataobjectBusiness payload; may be empty on failure
request_idstringRequest tracing ID; include it when reporting issues

Signature

The current version authenticates directly with App ID + App Key and requires no extra signature parameters. RSA2 signing will be introduced in a later version; a migration plan and advance notice will be provided before the upgrade, and legacy calls stay valid during the transition.

Common parameters

Besides business parameters, every request may carry:

ParameterTypeRequiredDescription
app_idstringYesApplication ID
app_keystringYesApplication secret

Parameter types

TypeDescriptionExample
stringText valueName, phone number
integerWhole numberCount, status code
floatDecimal numberAmount, score
booleanTrue/falseSwitch fields like generated
arrayListMismatched field list
objectNested structureUser info

Common error codes

CodeDescription
0Success
1000Invalid request parameters
1001Missing authentication info
1002Invalid App ID
1003Wrong App Key
1004Application disabled
1005API not purchased or package exhausted
1009API not found
1010Deduction failed
1011Internal server error

See Error Codes for the full list.