Skip to main content
GET
/
key-check
/
curl -X GET 'https://api.anyformat.ai/key-check/' \
  -H 'Authorization: Bearer YOUR_API_KEY'
import requests

response = requests.get(
    "https://api.anyformat.ai/key-check/",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
response.raise_for_status()
print(response.json()["organization_id"])
const response = await fetch('https://api.anyformat.ai/key-check/', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
});
if (!response.ok) throw new Error(`Invalid API key: ${response.status}`);
const { organization_id, organization_name } = await response.json();
{
  "valid": true,
  "organization_id": "7f4a1c2e-0000-4000-8000-000000000001",
  "organization_name": "Acme Corp"
}
{
  "error": "Invalid API key",
  "detail": "The provided API key is not recognised.",
  "error_code": "INVALID_API_KEY",
  "retryable": false,
  "request_id": "a1b2c3d4e5f67890abcdef1234567890"
}
Confirms the caller’s API key is active and names its owning organization. Unversioned — the same endpoint works for v2 and v3 keys.
  • 200 — the key is valid; response body carries organization_id (and organization_name when available).
  • 401 — standard error envelope with error_code MISSING_API_KEY (no key sent) or INVALID_API_KEY (key not recognised).
Nothing is billed and no run is created, so it’s cheap to call as a probe before the first real request. It hits the same /me/organization/ round-trip every authenticated request runs, so a successful check also warms the org cache.
curl -X GET 'https://api.anyformat.ai/key-check/' \
  -H 'Authorization: Bearer YOUR_API_KEY'
import requests

response = requests.get(
    "https://api.anyformat.ai/key-check/",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
response.raise_for_status()
print(response.json()["organization_id"])
const response = await fetch('https://api.anyformat.ai/key-check/', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
});
if (!response.ok) throw new Error(`Invalid API key: ${response.status}`);
const { organization_id, organization_name } = await response.json();
{
  "valid": true,
  "organization_id": "7f4a1c2e-0000-4000-8000-000000000001",
  "organization_name": "Acme Corp"
}
{
  "error": "Invalid API key",
  "detail": "The provided API key is not recognised.",
  "error_code": "INVALID_API_KEY",
  "retryable": false,
  "request_id": "a1b2c3d4e5f67890abcdef1234567890"
}

Authorizations

Authorization
string
header
required

API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.

Response

Successful Response

Confirms the API key is valid and names its owning organization.

valid
boolean
required

Always true — a failed check returns the standard error envelope with error_code MISSING_API_KEY or INVALID_API_KEY.

Example:

true

organization_id
string
required

UUID of the organization the key belongs to.

Example:

"7f4a1c2e-0000-4000-8000-000000000001"

organization_name
string | null

Display name of the owning organization, when the backend surfaces it.

Example:

"Acme Corp"

scopes
string[] | null

Scopes granted to the key (read, write). null when the backend does not report them.

Example:
["read", "write"]