GoodMem
ReferenceAPIREST APIAPI Keys

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.

PUT
/v1/apikeys/{id}
x-api-key<token>

In: header

Path Parameters

idstring

The unique identifier of the API key to update

API key update details

validateLabelStrategy?object

Empty Object

status?string | null

New status for the API key. Allowed values: ACTIVE, INACTIVE.

replaceLabels?object | null

Replace all existing labels with this set. Mutually exclusive with mergeLabels.

Empty Object

mergeLabels?object | null

Merge these labels with existing ones. Mutually exclusive with replaceLabels.

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"    }  }'
{
  "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"
}
Empty
Empty
Empty
Empty