Organisation Keys
Create, list, rename and revoke Organisation Keys under /v1/orgs/{orgId}/keys.
An Organisation Key is a sapi_ key, like a personal API key, but it belongs to the Organisation. It keeps working when the person who created it leaves. Your backend uses it to:
- Manage Tenants and their machines under
/v1/tenants. - Create enrollment codes.
- Exchange for a Tenant token.
It cannot run tasks itself. On /v1/agents/* it gets 403:
{
"error": "tenant_token_required",
"message": "Exchange the Organisation Key for a Tenant token: POST /v1/orgs/:orgId/tenants/:tenantId/token."
}Every other route answers 403 not_available_for_organisation_key.
Owners and admins manage the keys on the console's API keys page. The endpoints below are what the page calls. Like every Organisations API route, they take a signed-in member's session only.
The key object
{
"keyId": "k_8Hq",
"name": "backend",
"mintedByUid": "3fA9kQ2xYz",
"createdAt": 1790000000000,
"lastUsedAt": 1790003600000,
"last4": "AbCd"
}The secret itself is never listed.
Create a key
Owner or admin.
curl -s "$SAI_API_URL/v1/orgs/$ORG_ID/keys" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "backend" }'{ "key": "sapi_...", "keyId": "k_8Hq", "name": "backend", "last4": "AbCd" }key is returned once. Store it in a secret manager.
List keys
Owner or admin.
curl -s "$SAI_API_URL/v1/orgs/$ORG_ID/keys" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN"{
"keys": [
{
"keyId": "k_8Hq",
"name": "backend",
"mintedByUid": "3fA9kQ2xYz",
"createdAt": 1790000000000,
"lastUsedAt": 1790003600000,
"last4": "AbCd"
}
]
}Newest first. Revoked keys are not listed.
Rename a key
Owner or admin.
curl -s -X PATCH "$SAI_API_URL/v1/orgs/$ORG_ID/keys/$KEY_ID" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "backend-prod" }'Unknown fields are rejected. 200 with the key.
Revoke a key
Owner or admin.
curl -s -X DELETE "$SAI_API_URL/v1/orgs/$ORG_ID/keys/$KEY_ID" \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN"204 No Content. A revoked key fails with 401 on its next use. Tenant tokens it exchanged stop working within a minute (401 credential_revoked).