API keys

GET/v1/api-keysRequires an API key
POST/v1/api-keysRequires an API key
DELETE/v1/api-keys/{key_id}Requires an API key

Manage the keys that authenticate your calls. The dashboard does the same without code; see Authentication and API keys for advice on keeping keys safe.

Request

GET /v1/api-keys lists your active keys and takes no parameters.

POST /v1/api-keys creates a key. The body is JSON.

Field Type Required Description
name string no A label for the key, up to 100 characters (default Default API Key)

DELETE /v1/api-keys/{key_id} revokes a key.

Parameter In Description
key_id path The id of the key

Response

GET /v1/api-keys returns an array of keys, newest first. POST returns 201 with the same fields plus the full key.

Field Type Description
id integer Key identifier
name string The label
key_prefix string The first characters of the key
is_active boolean true
created_at datetime When it was created
last_used_at datetime or null When it was last used
api_key string Only in the answer to POST: the full key, shown once
{
  "id": 7,
  "name": "ci-pipeline",
  "key_prefix": "ds_live_1a2b",
  "is_active": true,
  "created_at": "2026-10-12T09:15:00",
  "last_used_at": null,
  "api_key": "ds_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

DELETE answers {"success": true, "message": "API Key 'ci-pipeline' (ds_live_1a2b...) has been revoked."}. The key stops working at once.

Errors

Status When
401 Missing, wrong or revoked API key
404 DELETE: the key does not exist or is not yours
422 POST: the body is not valid JSON or name is too long

Examples

Create an API key
curl -s https://api.docslice.app/v1/api-keys \
  -H "Authorization: Bearer $DOCSLICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "ci-pipeline"}'
import json
import os
import requests

response = requests.post(
    "https://api.docslice.app/v1/api-keys",
    headers={"Authorization": f"Bearer {os.environ['DOCSLICE_API_KEY']}"},
    json={"name": "ci-pipeline"},
    timeout=30,
)
print(json.dumps(response.json(), indent=2))
fetch("https://api.docslice.app/v1/api-keys", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.DOCSLICE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ name: "ci-pipeline" }),
})
  .then((response) => response.json())
  .then((data) => console.log(JSON.stringify(data, null, 2)));
<?php
$curl = curl_init('https://api.docslice.app/v1/api-keys');
curl_setopt_array($curl, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('DOCSLICE_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['name' => 'ci-pipeline']),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
]);
echo curl_exec($curl);
curl_close($curl);
List your active API keys
curl -s https://api.docslice.app/v1/api-keys \
  -H "Authorization: Bearer $DOCSLICE_API_KEY"
import json
import os
import requests

response = requests.get(
    "https://api.docslice.app/v1/api-keys",
    headers={"Authorization": f"Bearer {os.environ['DOCSLICE_API_KEY']}"},
    timeout=30,
)
print(json.dumps(response.json(), indent=2))
fetch("https://api.docslice.app/v1/api-keys", {
  headers: { Authorization: `Bearer ${process.env.DOCSLICE_API_KEY}` },
})
  .then((response) => response.json())
  .then((data) => console.log(JSON.stringify(data, null, 2)));
<?php
$curl = curl_init('https://api.docslice.app/v1/api-keys');
curl_setopt_array($curl, [
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('DOCSLICE_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
]);
echo curl_exec($curl);
curl_close($curl);
Revoke an API key
# KEY_ID is the "id" of a key listed by GET /v1/api-keys
curl -s -X DELETE "https://api.docslice.app/v1/api-keys/$KEY_ID" \
  -H "Authorization: Bearer $DOCSLICE_API_KEY"
import json
import os
import requests

key_id = os.environ["KEY_ID"]  # the "id" of a key listed by GET /v1/api-keys
response = requests.delete(
    f"https://api.docslice.app/v1/api-keys/{key_id}",
    headers={"Authorization": f"Bearer {os.environ['DOCSLICE_API_KEY']}"},
    timeout=30,
)
print(json.dumps(response.json(), indent=2))
const keyId = process.env.KEY_ID; // the "id" of a key listed by GET /v1/api-keys

fetch(`https://api.docslice.app/v1/api-keys/${keyId}`, {
  method: "DELETE",
  headers: { Authorization: `Bearer ${process.env.DOCSLICE_API_KEY}` },
})
  .then((response) => response.json())
  .then((data) => console.log(JSON.stringify(data, null, 2)));
<?php
$keyId = getenv('KEY_ID'); // the "id" of a key listed by GET /v1/api-keys
$curl = curl_init("https://api.docslice.app/v1/api-keys/$keyId");
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('DOCSLICE_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
]);
echo curl_exec($curl);
curl_close($curl);