Setup Wizard
Complete the steps in order: Sign Up → Activate → Signature → Debug → Go Live.
4 Steps to Integrate
Leave everything else to XiaoYingAPI — a unified response {code, msg, data}.
-
1
Create an Account
Sign up with a username / email / phone number — any one works (email and phone sign-up can be enabled).
-
2
Create a Project
Ask the administrator to enable an access project; you then get a dedicated APPID and APPSECRET (projects are created by the administrator in the console).
-
3
Read the Docs + Live Debug
Enter your keys in the API Docs; the page signs the request for you and forwards it for real — verify first, then write code.
-
4
Go live
Implement HMAC-SHA256 signing on your server before going live, and keep the secret in environment variables — never in the frontend.
Account and Credentials
- APPID
- Formatted like
app_xxx, it identifies which project is making the call and takes part in the signature. - APPSECRET
- Formatted like
sk_xxx, used only on the server to compute the signature, must never be sent to the frontend.
Signature Mechanism (HMAC-SHA256)
Endpoints that are Signature Required (auth) must include the common parameters on every request:
app_id / timestamp / nonce / sign.
- Take all parameters except sign (including app_id/timestamp/nonce and business parameters), filtering out empty values;
- Sort by parameter name in ascending ASCII order;
- Concatenate into
key=value&key=value…; - Prepend the uppercase method, a newline, the request path and another newline to form the string to sign (the path includes the trailing slash and excludes the query string);
- Use APPSECRET as the key to sign the whole string with HMAC-SHA256, and output the lowercase hex digest as sign.
timestamp is a Unix timestamp in seconds with a ±5 minute validity window; nonce must be unique per request (the server deduplicates to prevent replay); the path must match the final URL exactly, including the trailing slash.
import hashlib
import hmac
import time
import secrets
APP_ID = 'app_yourAppId'
APP_SECRET = 'sk_yourAppSecret'
def build_sign(params: dict, secret: str, method: str, path: str) -> str:
"""Join the uppercase method, a newline, the path, another newline and the parameters, then output lowercase hex via HMAC-SHA256"""
items = sorted(
(k, str(v)) for k, v in params.items()
if k != 'sign' and v not in (None, '')
)
raw = method.upper() + '\n' + path + '\n' + '&'.join(f'{k}={v}' for k, v in items)
return hmac.new(secret.encode(), raw.encode(), hashlib.sha256).hexdigest()
def signed_params(biz: dict, method: str, path: str):
params = dict(biz)
params.update({
'app_id': APP_ID,
'timestamp': str(int(time.time())),
'nonce': secrets.token_hex(8),
})
params['sign'] = build_sign(params, APP_SECRET, method, path)
return params
Example: signed_params({'keyword': 'Jay Chou'}, 'POST', '/api/music/xiaoying/search/').
Tip: the Live Debug page signs requests automatically with the keys you enter, so beginners don't need to compute signatures by hand; before going to production, make sure your implementation matches the server exactly.
Live Debug
- Open API Docs Center, then select the target service on the left;
- Enter your APPID / APPSECRET in "Auth Settings" on the right (stored only in your local browser, used to sign this request);
- Fill in the parameters and click "Send Request"; the server calls the real /api/ endpoint and returns the result;
- Public Endpoints (badge "Public · No Signature") can be debugged without a key.
What to Try First?
User Center · File Upload · CAPTCHA Recognition · AI Chat and 15 services in total support live debugging.
Note: SMS, CAPTCHA and AI calls hit external services for real and may incur costs or send SMS; confirm before debugging.