Update an API key
PUT /v1/apikeys/{id}: Updates an existing API key's labels or lifecycle status.
Updates an existing API key's labels or lifecycle status. Key ID, subject, ownership, key material, validity window, and creation audit fields remain immutable. Label changes require UPDATE_API_KEY; setting status=INACTIVE permanently revokes the key and requires DELETE_API_KEY; a request doing both requires both operations. Revoked keys cannot be reactivated. Side effects include updating administrative audit fields and, for revocation, recording the revocation time and actor.
In: header
Path Parameters
The UUID of the API key to update
API key update details
New status for the API key. INACTIVE is permanent; revoked keys cannot be reactivated.
"ACTIVE""ACTIVE" | "INACTIVE"Replace all existing labels with this set. Mutually exclusive with mergeLabels. The stored map may contain at most 20 entries; keys and values contain at most 255 characters; keys use [a-z0-9._-].
{"environment":"production","service":"recommendation-engine"}properties <= 20Empty Object
Merge these labels with existing ones. Mutually exclusive with replaceLabels. The final stored map may contain at most 20 entries; keys and values contain at most 255 characters; keys use [a-z0-9._-].
{"team":"ml-research"}properties <= 20Empty Object
Response Body
curl -X PUT "https://your-goodmem-server.example.com/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",
"subjectPrincipalId": "70e025f6-76ca-4cbe-b8fc-7dab8e84590a",
"ownerPrincipalId": "b3303d0a-1a4a-493f-b9bf-38e37153b5a2",
"authorityMode": "INHERIT_SUBJECT",
"ceiling": [
{
"assignedResource": {
"resourceId": "550e8400-e29b-41d4-a716-446655440000"
}
}
],
"ceilingOmitted": true,
"keyPrefix": "gm_12345...",
"status": "ACTIVE",
"lifecycleState": "NOT_YET_VALID",
"labels": {
"purpose": "production",
"service": "recommendation-engine"
},
"expiresAt": 1672531200000,
"validFrom": 1640908800000,
"revokedAt": 1640995200000,
"revokedById": "b3303d0a-1a4a-493f-b9bf-38e37153b5a2",
"lastUsedAt": 1640995200000,
"createdAt": 1640908800000,
"updatedAt": 1640908800000,
"createdById": "b3303d0a-1a4a-493f-b9bf-38e37153b5a2",
"updatedById": "b3303d0a-1a4a-493f-b9bf-38e37153b5a2"
}