Service Tokens
Service tokens authenticate API requests scoped to an organization. Unlike personal access tokens, service tokens are org-owned and can be used for automation and CI.
Creating and deleting service tokens requires ADMIN or OWNER.
Authentication
Authorization: Bearer <YOUR_API_TOKEN>
List Service Tokens
Lists service tokens for the selected organization.
GET /tha/v3/orgs/{org_slug}/tokens
| Query | Type | Description |
|---|---|---|
limit | integer | Max items. |
cursor | string | Pagination cursor. |
Response
Each item in items:
| Field | Type | Description |
|---|---|---|
uid | string | Token UID. |
name | string | Token name. |
created_by | object | { "email", "username" }. |
created_at | string | ISO 8601 creation timestamp. |
Create Service Token
Creates a service token. The token value is only returned once, on creation.
POST /tha/v3/orgs/{org_slug}/tokens
Request Body
| Field | Type | Description |
|---|---|---|
name | string | Required. Name for the token. |
Example Request
curl -X POST https://api.targon.com/tha/v3/orgs/my-team/tokens \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "ci-deploy"
}'
Response
| Field | Type | Description |
|---|---|---|
uid | string | Token UID. |
name | string | Token name. |
token | string | Raw token value (returned once). |
created_by | object | { "email", "username" }. |
created_at | string | ISO 8601 creation timestamp. |
Delete Service Token
Deletes a service token by UID.
DELETE /tha/v3/orgs/{org_slug}/tokens/{token_uid}
Returns 204 No Content.
Errors
| Status Code | Description |
|---|---|
| 400 | Invalid request or query parameters. |
| 401 | Invalid or missing token. |
| 403 | Insufficient role. |
| 404 | Service token not found. |
| 500 | Server error. |