Update API Token
Update API Token
POST
/api/portal/v1/apiTokens/{id}
Description
Update the name or restrictions of an existing API token. Only the fields included in the request body are modified. Fields that are omitted are left unchanged.
Authentication
This endpoint requires a Bearer token in the Authorization header.
- Authorization:
Bearer <token>. A valid Portal API session token or API token.
Path Parameters
- id: The
idof the token to update.
Request Body
The request body should be JSON-encoded.
- name (Optional): A human-readable label for the token.
- restrictions (Optional): An object describing limits on how the token can be used. See Create API Token for the full schema.
Response Schema
On success, the endpoint returns the updated token record.
Error Responses
- 401 Unauthorized: The
Authorizationheader is missing or the token is not valid. - 404 Not Found: No token exists with the given
idon the caller’s account.
Example Request
POST https://<your-host>:9909/api/portal/v1/apiTokens/299ce9bf4f244300a96f3926240f9c0d
Authorization: Bearer <token>
Content-Type: application/json
{
"restrictions": {
"hosts": ["maps.example.com", "admin.example.com"]
}
}
Example Response
Status Code: 200 OK
Response Body:
{
"id": "299ce9bf4f244300a96f3926240f9c0d",
"name": "Production Token",
"userId": 1,
"userEmail": "example@zydromarine.com",
"createdAt": 1736942400000,
"lastUsedAt": 1736946000000,
"restrictions": {
"hosts": ["maps.example.com", "admin.example.com"]
}
}