Skip to main content
POST
/
api
/
svc
/
v1
/
personal-access-tokens
Create a personal access token
curl --request POST \
  --url https://{controlPlaneURL}/api/svc/v1/personal-access-tokens \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "my-ci-token",
  "expirationDate": "2026-09-01T12:00",
  "accountName": "<string>",
  "teamName": "<string>"
}
'
import requests

url = "https://{controlPlaneURL}/api/svc/v1/personal-access-tokens"

payload = {
"name": "my-ci-token",
"expirationDate": "2026-09-01T12:00",
"accountName": "<string>",
"teamName": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-ci-token',
expirationDate: '2026-09-01T12:00',
accountName: '<string>',
teamName: '<string>'
})
};

fetch('https://{controlPlaneURL}/api/svc/v1/personal-access-tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{controlPlaneURL}/api/svc/v1/personal-access-tokens",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my-ci-token',
'expirationDate' => '2026-09-01T12:00',
'accountName' => '<string>',
'teamName' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{controlPlaneURL}/api/svc/v1/personal-access-tokens"

payload := strings.NewReader("{\n \"name\": \"my-ci-token\",\n \"expirationDate\": \"2026-09-01T12:00\",\n \"accountName\": \"<string>\",\n \"teamName\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{controlPlaneURL}/api/svc/v1/personal-access-tokens")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-ci-token\",\n \"expirationDate\": \"2026-09-01T12:00\",\n \"accountName\": \"<string>\",\n \"teamName\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{controlPlaneURL}/api/svc/v1/personal-access-tokens")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-ci-token\",\n \"expirationDate\": \"2026-09-01T12:00\",\n \"accountName\": \"<string>\",\n \"teamName\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "token": "<string>"
}
{
"statusCode": 123,
"message": "<string>",
"code": 123,
"details": [
{}
]
}
{
"statusCode": 123,
"message": "<string>",
"code": 123,
"details": [
{}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required

Name for the personal access token. Must be 3-36 characters, start with a lowercase letter, end with a lowercase alphanumeric character, and contain only lowercase letters, numbers, and hyphens.

Example:

"my-ci-token"

expirationDate
string | null

Expiration date in ISO format. The token becomes invalid after this date.

Example:

"2026-09-01T12:00"

accountName
string | null

Account name that owns this personal access token.

teamName
string | null

Team name that owns this personal access token.

tokenType
enum<string> | null

Format of the issued token. Leave empty to use the tenant override or platform default.

Available options:
jwt,
opaque

Response

The newly created personal access token.

token
string
required

The generated authentication token. Store this securely — it cannot be retrieved later.