# 获取用户令牌

> 用合作方令牌为你系统里的某位用户签发用户级令牌,交给 Embedded SDK 与文件上传接口使用。

POST
  https://platform.ikho.cn/developer/api/open/partner/users/access-token
  试一试 

  
## 鉴权

  

  
    Authorization
    string
    header
    必填
    
  

  Bearer 加上你的合作方访问令牌。

  

  

  
    Content-Type
    string
    header
    必填
    默认 application/json
  

  请求内容类型。

  

  
## 请求体

  

  
    user_id
    string
    
    必填
    
  

  你系统里对该用户的稳定标识,长度 6 到 120 个字符。用于把令牌与用户一一对应。

  

  

  
    expires_in
    integer
    
    
    默认 86400
  

  请求的用户令牌有效期,单位为秒。

  

  
## 响应

  

  
    access_token
    string
    
    
    
  

  用户访问令牌。

  

  

  
    token_type
    string
    
    
    
  

  令牌类型,固定为 bearer。

  

  

  
    expires_in
    integer
    
    
    
  

  用户访问令牌有效期,单位为秒。

  

  

  cURLPython
  

  

  bash
    
  

  
```
curl -X POST "https://platform.ikho.cn/developer/api/open/partner/users/access-token" \
  -H "Authorization: Bearer $PARTNER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "clinic_patient_20489",
    "expires_in": 86400
  }'
```

  ts
    
  

  
```
import requests

resp = requests.post(
    class="tk-str">"https:class="tk-cmt">//platform.ikho.cn/developer/api/open/partner/users/access-token",
    headers={
        class="tk-str">"Authorization": class="tk-str">"Bearer " + partner_token,
        class="tk-str">"Content-Type": class="tk-str">"application/json",
    },
    json={class="tk-str">"user_id": class="tk-str">"clinic_patient_20489", class="tk-str">"expires_in": 86400},
)
print(resp.json()[class="tk-str">"access_token"])
```

  

  200 响应示例
    
  

  
```
{
  "access_token": "eyJhbGci...",
  "token_type": "bearer",
  "expires_in": 86400
}
```
