Skip to main content

Update Personal Access Token

Update a personal access token (name and scopes only).

Endpoint

PATCH /api/v1/auth/tokens/{token_id}

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>
Content-TypeYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
token_idintegerYesToken ID

Request Body

{
"name": "Updated Token Name",
"scopes": ["read", "write", "admin"]
}

Parameters

FieldTypeRequiredDescription
namestringNoToken name/description
scopesarrayNoToken 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"]
}'