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
| Field | Type | Description |
|---|---|---|
limit | integer | Maximum number of items to return. |
cursor | string | Pagination cursor. |
Example Request
curl -X GET "https://api.targon.com/tha/v3/me/api-tokens?limit=10" \
-H "Authorization: Bearer <YOUR_API_TOKEN>"
Response
| Field | Type | Description |
|---|---|---|
items | array | List of token objects. |
next_cursor | string | Cursor for the next page of results. |
Each item in items:
| Field | Type | Description |
|---|---|---|
uid | string | Unique identifier for the token. |
name | string | Name of the token. |
created_at | string | ISO 8601 creation timestamp. |
updated_at | string | ISO 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 Code | Description |
|---|---|
| 400 - Bad Request | Invalid query parameters. |
| 401 - Unauthorized | Invalid or missing token. |
| 500 - Internal Server Error | Server 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
| Field | Type | Description |
|---|---|---|
name | string | Required. 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
| Field | Type | Description |
|---|---|---|
uid | string | Unique identifier for the token. |
name | string | Name of the token. |
token | string | Raw token value (returned once). |
created_at | string | ISO 8601 creation timestamp. |
updated_at | string | ISO 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 Code | Description |
|---|---|
| 400 - Bad Request | Invalid request body. |
| 401 - Unauthorized | Invalid or missing token. |
| 500 - Internal Server Error | Server error. |
Update API Token
Update a personal access token name.
Endpoint
PATCH /tha/v3/me/api-tokens/{token_uid}
Path Parameters
| Field | Type | Description |
|---|---|---|
token_uid | string | Unique identifier of the token. |
Request Body
| Field | Type | Description |
|---|---|---|
name | string | Required. 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 Code | Description |
|---|---|
| 400 - Bad Request | Invalid request body. |
| 401 - Unauthorized | Invalid or missing token. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Token not found. |
| 500 - Internal Server Error | Server error. |
Delete API Token
Delete a personal access token.
Endpoint
DELETE /tha/v3/me/api-tokens/{token_uid}
Path Parameters
| Field | Type | Description |
|---|---|---|
token_uid | string | Unique 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 Code | Description |
|---|---|
| 401 - Unauthorized | Invalid or missing token. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Token not found. |
| 500 - Internal Server Error | Server error. |