Skip to content

app.api_keys

TableRow level security on

Org-scoped API keys for servers (ADR 0003): hashed, capability-scoped and expiring. The secret is shown once at creation; only its SHA-256 hash is stored.

Primary key: id

Columns of app.api_keys
ColumnTypeNullableDescription
iduuidNoPrimary key, UUID v7.
org_iduuidNoOwning org. A row never moves to another org.References app.organizations.id
nametextNoKey name shown in Settings, for example Accounting Sync.
service_account_iduuidYesService account the key acts for, once service accounts exist; null for an org key.References app.service_accounts.id
scopestext[]NoCapability groups (the first segment of capability codes in the registry) the key may use.
expires_attimestamp with time zoneNoWhen the key stops working. At most one year after it is set.
prefixtextNoVisible start of the secret (xos_live_ and 8 hex digits), so people can tell keys apart.
secret_hashbyteaNoSHA-256 of the full secret. Never readable by signed-in callers.
last_used_attimestamp with time zoneYesWhen the key last authenticated a request, to the minute.
revoked_attimestamp with time zoneYesWhen the key was revoked; a revoked key never works again.
revoked_byuuidYesPerson who revoked the key.References app.people.id
created_attimestamp with time zoneNoWhen the row was inserted. Set by the database.
created_byuuidYesPerson who inserted the row, or null for a platform process. Set by the database.References app.people.id
updated_attimestamp with time zoneNoWhen the row last changed. Set by the database.
updated_byuuidYesPerson who last changed the row, or null for a platform process. Set by the database.References app.people.id
deleted_attimestamp with time zoneYesSoft delete time. A row with deleted_at set is ignored by every access helper.