Account management
An account page to view and update your details, delete your account, and create API keys for AI agents.
DataData ModelSections
Data Model Designed
What the service keeps, how the pieces relate, and what every field means. The SQL is on the Schema tab.
Entities
API key
A secret an agent uses to act for a person, within its scopes.
Belongs to one user; deleted with the user.
identity.api_keys
User (from Login)
Deleted by `DELETE /me`.
Its sessions and API keys are deleted with it; its audit events stay, with no foreign key.
identity.users
Life of each record
- API key
- Created by the person → used (last use recorded) → ends when revoked, when it expires, or when the account is deleted. Revoked and expired keys stay until the account is deleted, so audit events can name them.
- Account deletion
- Cognito user deleted → user row deleted with its sessions and keys → `auth.account_deleted` kept without the email → `identity.user.deleted` sent to every service.
Fields
identity.api_keys
One row per API key a person created for an agent or script.
iduuid- The key's ID; appears in access tokens as
akidand in audit events. - Primary key. UUIDv7
user_iduuid- Whose key it is.
- Foreign key to
identity.users, delete cascades nametext- What the key is for, chosen by the person.
- 1 to 100 characters
prefixtext- The first 8 characters after
sk_01s_, so the person can recognise the key in the list. - 8 base64url characters
key_hashtext- SHA-256 of the whole secret. A 256-bit random secret needs no slow hash: it cannot be guessed.
- 64 hex characters; unique
scopestext[]- What the key may do.
- 1 or more, each from the allowed list
last_used_attimestamptzcan be empty- Last exchange, updated at most once a minute.
expires_attimestamptz- When it stops working.
- After
created_at, at most 1 year later revoked_attimestamptzcan be empty- When the person revoked it.
- Not before
created_at created_attimestamptzdefault now()- When it was created.
Account management also writes to Login's identity.audit_events and to the template's identity.outbound_events.
Data model level: business rules the service guarantees
- A key works only if not revoked and not expired.
- A key's access token never has more than the key's scopes.
- Deleting an account deletes the Cognito user first, so a failure leaves everything as it was.
- Every service learns of a deletion through the outbox, never by being called in turn.
What is deliberately not stored
- The API key secret: only its hash.
- The new password: it stays in Cognito.
- Anything about the person after deletion except audit events by ID.