API keys
Give each app or connected system its own key, with only the scopes it needs, and revoke it when it's done.
The key object
Ochio keeps a hash of each key, never the key itself, and shows the key once, when it's created. All key endpoints need the admin scope. The scopes are listed under Authentication.
| Field | Holds |
|---|---|
id | The key's id, key_…. |
name | Its name. Requests made with it show as key:<name>. |
prefix | The first characters of the key, to tell keys apart. |
scopes | What it may do. |
created_at, last_used_at | When it was made, and last used (to the minute). |
{
"id": "key_365d1809087d",
"name": "partner",
"prefix": "ochio_ex01",
"scopes": [
"read",
"alerts:write",
"missions:request",
"webhooks:write"
],
"created_at": "2026-10-19T21:30:10.072Z",
"last_used_at": "2026-10-19T21:34:46.535Z"
}List API keys
Every key, without the keys themselves.
Returns{"data": [...]} with a key for each.
curl "$OCHIO_URL/v1/keys" \
-H "Authorization: Bearer $OCHIO_API_KEY"import os
import requests
r = requests.get(
f"{os.environ['OCHIO_URL']}/v1/keys",
headers={"Authorization": f"Bearer {os.environ['OCHIO_API_KEY']}"},
)
print(r.status_code, r.json())const res = await fetch(`${process.env.OCHIO_URL}/v1/keys`, {
headers: { Authorization: `Bearer ${process.env.OCHIO_API_KEY}` },
});
console.log(res.status, await res.json());{
"data": [
{
"id": "key_9e5cecad4d1f",
"name": "operator",
"prefix": "ochio_ex02",
"scopes": [
"read",
"alerts:write",
"sensors:write",
"missions:request",
"missions:launch",
"missions:approve",
"webhooks:write",
"admin"
],
"created_at": "2026-10-19T21:30:10.072Z",
"last_used_at": "2026-10-19T21:34:02.364Z"
},
{
"id": "key_365d1809087d",
"name": "partner",
"prefix": "ochio_ex01",
"scopes": [
"read",
"alerts:write",
"missions:request",
"webhooks:write"
],
"created_at": "2026-10-19T21:30:10.072Z",
"last_used_at": "2026-10-19T21:34:46.535Z"
}
]
}Create an API key
Makes a key. The answer is the only time Ochio shows it.
Body., _ and -, up to 64 characters.read, alerts:write, sensors:write, missions:request, missions:launch, missions:approve, webhooks:write, admin.201 with the key and key, the key itself.
| Status | Code | When |
|---|---|---|
409 | key_exists | A key with this name exists. |
400 | invalid_request | An unknown scope, or a name that isn't valid. |
curl -X POST "$OCHIO_URL/v1/keys" \
-H "Authorization: Bearer $OCHIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "vms-connector",
"scopes": [
"read",
"alerts:write"
]
}'import os
import requests
r = requests.post(
f"{os.environ['OCHIO_URL']}/v1/keys",
headers={"Authorization": f"Bearer {os.environ['OCHIO_API_KEY']}"},
json={
"name": "vms-connector",
"scopes": [
"read",
"alerts:write"
]
},
)
print(r.status_code, r.json())const res = await fetch(`${process.env.OCHIO_URL}/v1/keys`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OCHIO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "vms-connector",
scopes: [
"read",
"alerts:write"
]
}),
});
console.log(res.status, await res.json());{
"id": "key_fbf104143394",
"name": "vms-connector",
"prefix": "ochio_ex03",
"scopes": [
"read",
"alerts:write"
],
"created_at": "2026-10-19T21:34:49.545Z",
"last_used_at": null,
"key": "ochio_ex03_example_key_not_real_000000"
}Revoke an API key
Revokes a key at once. A key can't revoke itself; use another admin key.
Its webhook subscriptions stay, and keep receiving deliveries: delete them first if they should stop. Subscriptions belong to a key's name, so a new key with the same name takes them over.
Path{"id", "name", "deleted": true}.
| Status | Code | When |
|---|---|---|
409 | key_in_use | That's the key making the request. |
404 | not_found | No key with this id or name. |
curl -X DELETE "$OCHIO_URL/v1/keys/vms-connector" \
-H "Authorization: Bearer $OCHIO_API_KEY"import os
import requests
r = requests.delete(
f"{os.environ['OCHIO_URL']}/v1/keys/vms-connector",
headers={"Authorization": f"Bearer {os.environ['OCHIO_API_KEY']}"},
)
print(r.status_code, r.json())const res = await fetch(`${process.env.OCHIO_URL}/v1/keys/vms-connector`, {
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.OCHIO_API_KEY}` },
});
console.log(res.status, await res.json());{
"id": "key_fbf104143394",
"name": "vms-connector",
"deleted": true
}{
"error": {
"code": "key_in_use",
"message": "That is the key making this request; delete it with another admin key."
}
}