Skip to content

Create a new API token scoped to this organization

POST
/api/v2/organizations/{organization}/tokens

Authorizations

Parameters

Path Parameters

organization
required
string

Organization identifier

Example
test-org

Request Body required

object
name
required

Name for the token

string
My CI token
preset

Preset scope bundle

string
nullable
content_management
scopes

Individual scopes (mutually exclusive with preset)

Array<string>
nullable
[
"projects:read",
"content:write"
]
projects

Project IDs to restrict this token to

Array<integer>
nullable
expires_in

Token expiration period

string
nullable
Allowed values: 30d 90d 365d never
90d

Responses

201

Token created. The plain token is returned once and cannot be retrieved again.

object
token

The plain text token (shown once)

string
id

Token ID

integer
name
string
scopes
Array<string>
nullable
projects
Array<integer>
nullable
preset
string
nullable
expires_at
string format: date-time
nullable
created_at
string format: date-time

400

Bad request.

object
message
required

Error message

string
The requested resource was not found
error
required

Error flag

boolean
true
{
"message": "The requested resource was not found",
"error": true
}

403

Access is forbidden.

object
message
required

Error message

string
The requested resource was not found
error
required

Error flag

boolean
true
{
"message": "The requested resource was not found",
"error": true
}

422

Validation error.

object
message
required

Error message

string
The requested resource was not found
error
required

Error flag

boolean
true
{
"message": "The requested resource was not found",
"error": true
}