Create a personal access token

更新时间:
复制 MD 格式

An enterprise administrator can use this API to create a personal access token.

Supported editions

Enterprise Dedicated Edition

Service endpoints

Get the service endpoint and replace {domain} in the API request syntax with your endpoint .

Authorization information

Product

Resource

Required permissions

organization management

user

Read and write

Request syntax

POST https://{domain}/oapi/v1/platform/users/admin/personalAccessTokens

Request

Create a personal access token

curl -X 'POST' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/platform/users/admin/personalAccessTokens' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "description": "Sample token description",
        "expiredAt": "2025-05-22T12:44:50.048Z",
        "name": "Sample token name",
        "permissions": ["base_user_read"],
        "userId": "3001****-****-4229-a7f2-********41ad"
    }'

Request headers

x-yunxiao-token string (Required)

The access token. See Access token for details.

Example: pt-0fh3****0fbG_35af****0484.

Request parameters

expiredAt string (Required)

The expiration time of the token.

name string (Required)

The name of the token.

permissions array[string] (Required)

The permission scopes for the token. You can obtain these scopes by using the Enterprise Dedicated Edition API.

userId string (Required)

The user ID. Use the ListUsers - Query a list of users API to obtain this ID.

descriptionstring (Optional)

The description of the token.

Response parameters

Response example

{
    "createdAt": "2025-05-22T12:44:50.048Z",
    "description": "Sample token description",
    "expiredAt": "2025-05-22T12:44:50.048Z",
    "name": "Sample token name",
    "permissions": ["base_user_read"],
    "token": "pt-0fh3****0fbG_35af****0484",
    "tokenId": "pt-0fh3****0fbG",
    "userId": "3001****-****-4229-a7f2-********41ad"
}

createdAt string

The time when the token was created.

description string

The description of the token.

expiredAt string

The expiration time of the token.

name string

The name of the token.

permissions array[string]

The permission scopes of the token.

token string

The personal access token.

tokenId string

The token ID.

userId string

The user ID.

Error codes

For more information, see Error codes.