Update an API key
Updates an existing API key with new values for status or labels.
IMPORTANT: Key ID, user ownership, key material, and audit fields cannot be modified - only status (ACTIVE/INACTIVE) and labels are mutable. Requires UPDATE_APIKEY_OWN permission for keys you own (or UPDATE_APIKEY_ANY for admin users to modify any user's keys). Side effects include updating the updated_at timestamp and recording the updater's user ID. This operation is idempotent - repeated identical requests have no additional effect.
In: header
Path Parameters
The unique identifier of the API key to update
API key update details
New status for the API key. Allowed values: ACTIVE, INACTIVE.
"ACTIVE""ACTIVE" | "INACTIVE"Replace all existing labels with this set. Mutually exclusive with mergeLabels.
{"environment":"production","service":"recommendation-engine"}Empty Object
Merge these labels with existing ones. Mutually exclusive with replaceLabels.
{"team":"ml-research"}Empty Object
Response Body
curl -X PUT "http://localhost:8080/v1/apikeys/550e8400-e29b-41d4-a716-446655440000" \ -H "Content-Type: application/json" \ -d '{ "status": "ACTIVE", "replaceLabels": { "environment": "production", "service": "recommendation-engine" }, "mergeLabels": { "team": "ml-research" } }'{
"apiKeyId": "550e8400-e29b-41d4-a716-446655440000",
"userId": "b3303d0a-1a4a-493f-b9bf-38e37153b5a2",
"keyPrefix": "gm_12345...",
"status": "ACTIVE",
"labels": {
"purpose": "production",
"service": "recommendation-engine"
},
"expiresAt": 1672531200000,
"lastUsedAt": 1640995200000,
"createdAt": 1640908800000,
"updatedAt": 1640908800000,
"createdById": "b3303d0a-1a4a-493f-b9bf-38e37153b5a2",
"updatedById": "b3303d0a-1a4a-493f-b9bf-38e37153b5a2"
}