Update API Key
Update an existing API key. Users can only update their own API keys.
Request Body
API key object with fields to updateDescriptive name for the key
Array of allowed CORS origins
Array of assistant IDs the key can access
curl -X PUT "https://api.example.com/api/v1/api_keys/1" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"api_key": {
"name": "Updated Production Key",
"allowed_origins": ["https://example.com", "https://app.example.com"],
"allowed_assistants": ["123", "456"]
}
}'
Response
Response status information
{
"status": {
"code": 200,
"message": "API key updated successfully"
},
"data": {
"id": 1,
"key_type": "private",
"name": "Updated Production Key",
"key_value": null,
"allowed_origins": ["https://example.com", "https://app.example.com"],
"allowed_assistants": ["123", "456"],
"transient_assistant": false,
"user_id": 1,
"user_email": "[email protected]",
"created_at": "2024-01-10T08:00:00Z",
"updated_at": "2024-01-15T11:00:00Z"
}
}
Error Responses
Unauthorized - Invalid or missing authentication
Validation error - Invalid request body