Management APIs/API Keys
Delete API Key
DELETE
Overview
Revoke an API key by numeric ID. You cannot revoke the currently used key from the same request context.
Authentication
All API requests require a Bearer token in the request header.
Authorization: Bearer YOUR_API_KEYCreate and manage API keys from API Keys or use https://www.apimall.ai/api-keys.
Request
API Information
- URL:
DELETE https://gateway.apimall.ai/api/v1/keys/{id}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Required | Numeric API key ID. |
Request Example
DELETE https://gateway.apimall.ai/api/v1/keys/13Response Example
{
"success": true,
"data": {
"id": 13,
"status": "revoked"
},
"request_id": "req_01HQ9M7J7X9P7Y8T6W5V4U3S2R"
}cURL Example
curl --request DELETE 'https://gateway.apimall.ai/api/v1/keys/13' \
--header 'Authorization: Bearer YOUR_API_KEY'JavaScript Example
const API_KEY = process.env.APIMALL_API_KEY;
const id = "13";
const response = await fetch(`https://gateway.apimall.ai/api/v1/keys/${encodeURIComponent(String(id))}`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${API_KEY}`,
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const data = await response.json();
console.log(data);Response Parameters
| Parameter | Type | Description |
|---|---|---|
success | boolean | Whether the request completed successfully. |
data.id | integer | id field returned by the API. |
data.status | string | Current status value returned by the API. Generation task endpoints use normalized values such as `pending`, `processing`, `completed`, `failed`, or `unknown`; management endpoints may return resource states such as `created`, `revoked`, or `active`. |
request_id | string | Request identifier for debugging and support. |
Error Response Example
{
"success": false,
"error": {
"code": "not_found",
"message": "API key not found"
},
"request_id": "req_01HQ9M7J7X9P7Y8T6W5V4U3S2R"
}Integration Notes
- Store your API key on the server side only.
Error Codes
Common Error Codes
| Status Code | Description |
|---|---|
| 200 | Request successful |
| 400 | Invalid request parameters |
| 401 | API key required or invalid API key |
| 403 | API access not approved or request made on a non-gateway host |
| 404 | Resource not found |
| 429 | Rate limit exceeded or too many concurrent jobs |
| 500 | Internal server error |