API keys
Create API keys to use AiTM from scripts, CI jobs and integrations.
1 min read
API keys let you use AiTM from your own scripts, CI jobs and integrations. A key acts as you: it is limited to the scopes you pick when you create it, and to what your current plan allows.

Create a key#
- Open Settings → API keys.
- Select Create key.
- Give it a short name (so you remember what it is for), pick the scopes it should have, choose when it expires, and optionally restrict it to one or more IP addresses or CIDR ranges.
- Select Create. The full key is shown once. Copy it now — you can't see it again.
The key looks like pk_<lookup>_<secret>. Use the whole string as a bearer
token.
Use a key#
Send the key as a bearer token:
curl https://api.aitm.io/api/v1/me \
-H "Authorization: Bearer pk_YOUR_KEY_HERE"import requests
res = requests.get(
"https://api.aitm.io/api/v1/me",
headers={"Authorization": "Bearer pk_YOUR_KEY_HERE"},
)
print(res.json())const res = await fetch("https://api.aitm.io/api/v1/me", {
headers: { Authorization: "Bearer pk_YOUR_KEY_HERE" },
});
console.log(await res.json());Scopes#
A scope decides what the key is allowed to do. Each feature has its own
scopes, in the form feature:action — for example ai_assistant:read and
ai_assistant:write.
- read — read data for that feature.
- write — create or change things.
Only scopes allowed by your current plan are offered when you create a key. If your plan later changes, scopes it no longer covers are marked inactive on the key — they won't authorise requests until your plan covers them again.
Expiry and IP restrictions#
- Expiry — a key stops working on its expiry date. Short-lived keys (30 or 90 days) are safer.
- IP restriction — a key only works from the IP addresses or CIDR ranges you list.
Revoke a key#
Open Settings → API keys, select the key, and choose Revoke. Revoked keys stop working immediately and can't be restored.
See also#
- AI API The OpenAI-compatible chat completions endpoint.
- Bring your own key Point AiTM at your own AI provider key (a different thing).