Skip to content

List API Keys

GET /v1/api-keys

List all active (non-revoked) API keys for the authenticated user. The response never includes raw key values or hashes -- only metadata for identification and management.

Try it

Test this endpoint interactively in the Swagger UI.

Authorization required

Include your API key in the Authorization header.

Request

Headers

HeaderValueRequired
AuthorizationBearer <token>Yes

This endpoint takes no query parameters or request body.

Code Examples

bash
curl https://api.docmap.io/v1/api-keys \
  -H "Authorization: Bearer dm_live_abc123def456ghi789jkl012mno345"
typescript
const apiKey = process.env.DOCMAP_API_KEY

const response = await fetch('https://api.docmap.io/v1/api-keys', {
  headers: { 'Authorization': `Bearer ${apiKey}` },
})

const { data } = await response.json()

for (const key of data) {
  console.log(`${key.name} (${key.prefix}...) — created ${key.createdAt}`)
}
python
import requests

api_key = "dm_live_abc123def456ghi789jkl012mno345"

response = requests.get(
    "https://api.docmap.io/v1/api-keys",
    headers={"Authorization": f"Bearer {api_key}"},
)

keys = response.json()["data"]

for key in keys:
    print(f"{key['name']} ({key['prefix']}...) — created {key['createdAt']}")

Response

Status: 200 OK

The response body contains a data array of API key metadata objects.

Fields

Each object in the array contains:

FieldTypeDescription
idstringUnique identifier for the API key.
userIdstringID of the user who owns the key.
namestringDescriptive label for the key.
prefixstringFirst characters of the key for identification (e.g., dm_live_abc1).
expiresAtstring | nullISO 8601 expiration timestamp, or null if the key never expires.
lastUsedAtstring | nullISO 8601 timestamp of the last time the key was used. null if never used.
createdAtstringISO 8601 timestamp of when the key was created.
revokedbooleanWhether the key has been revoked. Always false in this response since only active keys are returned.

Example

json
{
  "data": [
    {
      "id": "ak_1a2b3c4d5e6f7g8h",
      "userId": "uid_a1b2c3d4e5f6",
      "name": "Production Server",
      "prefix": "dm_live_r4nd",
      "expiresAt": "2025-02-18T10:00:00.000Z",
      "lastUsedAt": "2024-11-20T16:45:00.000Z",
      "createdAt": "2024-11-20T10:00:00.000Z",
      "revoked": false
    },
    {
      "id": "ak_9i8h7g6f5e4d3c2b",
      "userId": "uid_a1b2c3d4e5f6",
      "name": "Local Development",
      "prefix": "dm_live_t3st",
      "expiresAt": null,
      "lastUsedAt": "2024-11-19T08:30:00.000Z",
      "createdAt": "2024-10-05T12:00:00.000Z",
      "revoked": false
    }
  ]
}

Errors

StatusCodeDescription
401UNAUTHORIZEDMissing, invalid, or expired API key / token.

DocMap API Documentation