Create a deployment token
POST
/tokens
const url = 'https://example.com/tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Deployment token","site_name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Deployment token", "site_name": "example" }'The token value is returned once and cannot be retrieved later.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
CreateTokenRequest
object
name
Name
string
site_name
required
Site Name
string
Responses
Section titled “Responses”Successful Response
Media typeapplication/json
CreatedDeploymentTokenResponse
object
id
required
Id
string
name
required
Name
string
site_name
required
Site Name
string
token
required
Token
string
Examplegenerated
{ "id": "example", "name": "example", "site_name": "example", "token": "example"}Authentication is required.
Media typeapplication/json
ErrorResponse
object
detail
required
Detail
string
Examplegenerated
{ "detail": "example"}A session token and site ownership are required.
Media typeapplication/json
ErrorResponse
object
detail
required
Detail
string
Examplegenerated
{ "detail": "example"}The site does not exist.
Media typeapplication/json
ErrorResponse
object
detail
required
Detail
string
Examplegenerated
{ "detail": "example"}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}