Qeasy Cloud
Get Started
GEThttps://open.youzanyun.com/auth/tokenclient_id + client_secret + kdt_id(silent 授权)

Get access_token for Self-use Apps (silent grant)

有赞云自用型应用鉴权接口:凭 client_id + client_secret + kdt_id(店铺 ID),authorize_type=silent 换取 access_token(默认有效期 7 天),之后凭 token 调用业务 API。

## Overview Youzan Cloud distinguishes tool apps (serving many shops via OAuth code flow) from self-use apps (serving your own shop, no authorization code needed). A self-use app calls this endpoint with authorize_type=silent to directly obtain a shop-scoped access_token, passing client_id, client_secret and kdt_id (the shop ID, visible via youzan.shop.get or the shop admin). The default token lifetime is 7 days; after a refresh, the old token keeps a 1-hour grace period. ### Steps 1. Create a self-use app in the Youzan Cloud console; note client_id/client_secret. 2. Exchange for the token (data.access_token) and keep refresh_token/authority_id for renewal. 3. Apply for the API capability packages (trade, items, ...) under Category Capabilities — calls fail until approved. 4. Business calls follow https://open.youzanyun.com/api/{api_name}/{api_version}?access_token=xxx. ### Response Success: {"success":true,"code":200,"data":{"access_token":"...","expires_in":604800,...}}. Failures return success=false with codes such as 1000 (bad client_secret) or 1103 (unknown client_id or missing grant). ### Production advice Cache the token centrally and refresh ahead of expiry. A token manually refreshed elsewhere dies early and forces re-authorization — never let multiple environments share and overwrite one token. ### Kdt id and retail chains Retail-chain tenants have one kdt_id per shop plus a headquarters id, and tokens are shop-scoped: a chain integration maintains one token per shop and aggregates at the platform layer. Calling a shop API with the headquarters token returns authorization errors that look like permission problems — when a call fails with 4204, check the kdt_id before anything else.

Code examples

curl
curl "https://open.youzanyun.com/auth/token?client_id=xxxx&client_secret=yyyy&authorize_type=silent&kdt_id=12345678"

Error codes

CodeMessageMeaning
1000应用信息错误client_secret 不正确
1103Client 不存在/授权关系不存在client_id 错误或店铺未授权该应用
1105不支持的应用类型工具型应用误用了自用型 token 获取方式