Skip to main content

Update Key

Update the name, scopes, or expiration of an existing API key.

PATCH /api/v1/api-keys/:keyId

Authentication

JWT Bearer Token required via Authorization header.

Path Parameters

ParameterTypeDescription
keyIdstringThe key ID (e.g., key_abc123)

Request Body

All fields are optional. Only provided fields are updated.

FieldTypeDescription
namestringUpdated key name
scopesstring[]Updated permissions
expiresAtstringUpdated expiration (ISO 8601), or null to remove expiration

Example Request

{
"name": "Production Server v2",
"scopes": ["splits:read", "splits:write", "keys:manage"]
}

Response

200 OK

{
"id": "key_abc123",
"name": "Production Server v2",
"keyPreview": "as_live_sk_abc...789",
"scopes": ["splits:read", "splits:write", "keys:manage"],
"lastUsedAt": "2026-03-29T09:45:00Z",
"createdAt": "2026-01-15T10:00:00Z",
"expiresAt": "2027-01-01T00:00:00Z",
"updatedAt": "2026-03-29T10:30:00Z"
}

404 Not Found

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

Code Examples

cURL

curl -X PATCH https://api.audiospliter.com/api/v1/api-keys/key_abc123 \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{"name": "Production Server v2"}'

Node.js

const response = await fetch(
'https://api.audiospliter.com/api/v1/api-keys/key_abc123',
{
method: 'PATCH',
headers: {
'Authorization': `Bearer ${jwtToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Production Server v2' }),
}
);
const updated = await response.json();

Python

import requests

response = requests.patch(
'https://api.audiospliter.com/api/v1/api-keys/key_abc123',
headers={'Authorization': f'Bearer {jwt_token}'},
json={'name': 'Production Server v2'},
)
updated = response.json()