Skip to main content
PUT
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
api-keys
/
{id}
Update API Key
curl --request PUT \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/api-keys/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "status": "<string>"
}
'

Path Parameters

organizationId
string
required
Organization ID
projectId
string
required
Project ID
id
string
required
API Key ID

Request Body

name
string
Updated name for the API key
status
string
Updated status: active or revoked

Example Request

{
  "name": "Updated Name",
  "status": "active"
}

Response

Returns the updated API Key object (without the key value).
{
  "id": "afd8012b-d81e-41c6-92cd-eed0c6cb3676",
  "projectId": "70093272-90ef-43df-807b-b66dd0a0b322",
  "name": "Updated Name",
  "status": "active",
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-22T14:00:00Z",
  "lastUsed": "2024-03-21T15:30:00Z"
}
Setting status to revoked will immediately prevent the key from being used. This is useful for rotating keys or responding to security incidents.

Error Responses

API Key Not Found

{
  "error": {
    "code": "NOT_FOUND",
    "message": "API key not found"
  }
}

Code Examples

curl -X PUT "https://api.metabind.ai/v1/organizations/org123/projects/proj456/api-keys/key123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Name",
    "status": "active"
  }'