Skip to main content
POST
/
v1
/
user
/
tokens
Create a personal access token
curl --request POST \
  --url https://api.cnap.tech/v1/user/tokens \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "My CLI token",
  "expires_at": 1742169600
}
'
{
  "id": "<string>",
  "name": "<string>",
  "token": "cnap_pat_a3b2c4d5e6f7g8h9i0j1k2l3m4n5o6p7"
}

Authorizations

Authorization
string
header
required

Personal Access Token (cnap_pat_...) or OAuth2 JWT. Create tokens at https://dash.cnap.tech/account/tokens

Body

application/json
name
string
required

Human-readable name for the token

Required string length: 1 - 100
Example:

"My CLI token"

expires_at
integer

Unix timestamp (seconds) when the token expires. Omit for no expiry.

Required range: x > 0
Example:

1742169600

Response

Token created. The token field is shown only once.

id
string
required
name
string
required
token
string
required

The full token. This is shown only once — store it securely.

Example:

"cnap_pat_a3b2c4d5e6f7g8h9i0j1k2l3m4n5o6p7"