Revoke API Key
DELETE /v1/api-keys/{id}
Revoke an API key immediately. Once revoked, any requests using this key will be rejected with a 401 UNAUTHORIZED error.
Try it
Test this endpoint interactively in the Swagger UI.
Authorization required
Include your API key in the Authorization header.
DANGER
Revoking a key is immediate and permanent. Any systems using this key will immediately lose access. This action cannot be undone -- you will need to create a new key and update your systems.
Request
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <token> | Yes |
Path Parameters
| Param | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The API key ID to revoke (e.g., ak_1a2b3c4d5e6f7g8h). |
Code Examples
bash
curl -X DELETE https://api.docmap.io/v1/api-keys/ak_1a2b3c4d5e6f7g8h \
-H "Authorization: Bearer dm_live_abc123def456ghi789jkl012mno345"typescript
const apiKey = process.env.DOCMAP_API_KEY
const keyId = 'ak_1a2b3c4d5e6f7g8h'
const response = await fetch(
`https://api.docmap.io/v1/api-keys/${keyId}`,
{
method: 'DELETE',
headers: { 'Authorization': `Bearer ${apiKey}` },
},
)
const result = await response.json()
console.log(result) // { success: true }python
import requests
api_key = "dm_live_abc123def456ghi789jkl012mno345"
key_id = "ak_1a2b3c4d5e6f7g8h"
response = requests.delete(
f"https://api.docmap.io/v1/api-keys/{key_id}",
headers={"Authorization": f"Bearer {api_key}"},
)
print(response.json()) # {"success": True}Response
Status: 200 OK
Example
json
{
"success": true
}Errors
| Status | Code | Description |
|---|---|---|
401 | UNAUTHORIZED | Missing, invalid, or expired API key / token. |
403 | FORBIDDEN | The API key belongs to a different user. You can only revoke your own keys. |
404 | NOT_FOUND | No API key found with the specified ID. |
