Add

Adds a new personal access token.

Required scopes: TOKEN_MANAGE

Resource URL

POST /user/tokens

POST Parameters

NameTypeDescription
name
Required
StringThe token name.
expires_inIntegerSpecifies the number of days in which the access token expires. Once specified, expires_at can't be set.
expires_atDateTimeSpecifies the expiration period for the token. Once specified, expires_in can't be set.
scopesString[]The list of scopes for the created token. All scopes are available here.
ip_restrictionsString[]The list of IP addresses for which the token will be restricted (wildcards are supported).
workspace_restrictionsString[]The list of workspaces in which the token can be used. A domain must be provided, not workspace name.
You can't create tokens with scopes higher than those in the authorization token.
If there are any IP or workspace restrictions saved in the authorization token, they will be copied to the created token. If you want to change the restrictions, an authorization token without restrictions must be used.

Example

Request

POST https://api.buddy.works/user/tokens

JSON

{
  "name": "My test token",
  "expires_in": 7,
  "scopes": [
      "WORKSPACE"
  ],
  "ip_restrictions": [
      "123.123.123.123"
  ],
  "workspace_restrictions": [
      "buddy"
  ]
}

Sample Response

HTTP

Status: 200 OK
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
  "url": "https://api.buddy.works/user/tokens/ZGU2Mk5ODItMTczYy00MThkLWJiOGtNmJmzFjMWVlYjAy",
  "html_url": "https://app.buddy.works/api-tokens/details/ZGU2Mk5ODItMTczYy00MThkLWJiOGtNmJmzFjMWVlYjAy",
  "id": "ZGU2Mk5ODItMTczYy00MThkLWJiOGtNmJmzFjMWVlYjAy",
  "name": "My test token",
  "token": "ed0f8927-c116-4afe-b555-c888dfd86c92",
  "expires_at": "2023-03-28T13:46:39.238118Z",
  "name": "My test token",
  "scopes": [
      "WORKSPACE"
  ],
  "ip_restrictions": [
      "123.123.123.123"
  ],
  "workspace_restrictions": [
      "buddy"
  ]
}

Last modified on March 30, 2023

Get Started

Sign up for free and deploy your project in less than 10 minutes.