Update Personal Access Token
Update a personal access token (name and scopes only).
Endpoint
PATCH /api/v1/auth/tokens/{token_id}
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Content-Type | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token_id | integer | Yes | Token ID |
Request Body
{
"name": "Updated Token Name",
"scopes": ["read", "write", "admin"]
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Token name/description |
scopes | array | No | Token scopes |
Response
Success (200)
{
"success": true,
"data": {
"id": 1,
"name": "Updated Token Name",
"scopes": ["read", "write", "admin"],
"organization_id": 1,
"expires_at": "2024-04-01T12:00:00Z",
"created_at": "2024-01-01T12:00:00Z",
"last_used_at": "2024-01-15T10:30:00Z"
},
"message": "Token updated successfully"
}
Error (404)
{
"success": false,
"error": {
"code": "token_not_found",
"message": "Token not found"
}
}
Features
- Update token name and scopes
- Token value itself cannot be changed
- Only token owner can update their tokens
Example
curl -X PATCH "https://api.rivergen.com/api/v1/auth/tokens/1" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Token Name",
"scopes": ["read", "write", "admin"]
}'
Related Endpoints
- List Tokens - List all tokens
- Revoke Token - Revoke token