Skip to main content

User

Manage personal access tokens. Use these tokens to authenticate user-scoped endpoints and to access organization resources.

Wallet and credit balance endpoints moved to Organizations.

Authentication

All user endpoints require authentication using a Bearer token:

Authorization: Bearer <YOUR_API_TOKEN>

List API Tokens

List personal access tokens for the authenticated user.

Endpoint

GET /tha/v3/me/api-tokens

Query Parameters

FieldTypeDescription
limitintegerMaximum number of items to return.
cursorstringPagination cursor.

Example Request

curl -X GET "https://api.targon.com/tha/v3/me/api-tokens?limit=10" \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Response

FieldTypeDescription
itemsarrayList of token objects.
next_cursorstringCursor for the next page of results.

Each item in items:

FieldTypeDescription
uidstringUnique identifier for the token.
namestringName of the token.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.

Example Response

{
"items": [
{
"uid": "tok-abc123def456",
"name": "my-token",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
],
"next_cursor": ""
}

Errors

Status CodeDescription
400 - Bad RequestInvalid query parameters.
401 - UnauthorizedInvalid or missing token.
500 - Internal Server ErrorServer error.

Create API Token

Create a personal access token. The token value is only returned once, on creation.

Endpoint

POST /tha/v3/me/api-tokens

Request Body

FieldTypeDescription
namestringRequired. Name for the new token.

Example Request

curl -X POST https://api.targon.com/tha/v3/me/api-tokens \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "my-new-token"
}'

Response

FieldTypeDescription
uidstringUnique identifier for the token.
namestringName of the token.
tokenstringRaw token value (returned once).
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.

Example Response

{
"uid": "tok-abc123def456",
"name": "my-new-token",
"token": "tgn_...",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}

Errors

Status CodeDescription
400 - Bad RequestInvalid request body.
401 - UnauthorizedInvalid or missing token.
500 - Internal Server ErrorServer error.

Update API Token

Update a personal access token name.

Endpoint

PATCH /tha/v3/me/api-tokens/{token_uid}

Path Parameters

FieldTypeDescription
token_uidstringUnique identifier of the token.

Request Body

FieldTypeDescription
namestringRequired. New name for the token.

Example Request

curl -X PATCH https://api.targon.com/tha/v3/me/api-tokens/tok-abc123def456 \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "renamed-token"
}'

Response

Returns the updated token object.

Errors

Status CodeDescription
400 - Bad RequestInvalid request body.
401 - UnauthorizedInvalid or missing token.
403 - ForbiddenNot allowed.
404 - Not FoundToken not found.
500 - Internal Server ErrorServer error.

Delete API Token

Delete a personal access token.

Endpoint

DELETE /tha/v3/me/api-tokens/{token_uid}

Path Parameters

FieldTypeDescription
token_uidstringUnique identifier of the token.

Example Request

curl -X DELETE https://api.targon.com/tha/v3/me/api-tokens/tok-abc123def456 \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Response

Returns 204 No Content on success.

Errors

Status CodeDescription
401 - UnauthorizedInvalid or missing token.
403 - ForbiddenNot allowed.
404 - Not FoundToken not found.
500 - Internal Server ErrorServer error.