Products · Identity V1

Account management

An account page to view and update your details, delete your account, and create API keys for AI agents.

Version 1 · Identity, second partDesigned, not builtModule 2 of 15

ProductRead MeSections

Read Me

Account management lets a person see their account, change their password, delete their account, and give AI agents their own keys to act for them.

It is the second part of the Identity service, after Login. It adds one table (API keys), the endpoint that announces a deleted account to every other service, and the lookup Delivery uses to find a person's email.

Why it exists

People own their data

Deleting an account really deletes it, everywhere, and keeps only anonymized orders for the accounts.

Agents are first-class users

An agent gets its own key with narrow scopes, instead of a person's password or cookie, and every call it makes is audited as that key.

A key can be cut off on its own

Revoking one agent's key leaves the person and their other agents signed in.

Dangerous actions keep a person in the loop

Only a browser session can create keys, change the password or delete the account; agents cannot pay.

In this version

  • `GET /me`, password change through Cognito, account deletion with `identity.user.deleted`
  • API keys: create, list, revoke, scopes, expiry, exchange at the gateway
  • A service lookup of a user's email for Delivery
  • Components for any app's account page

Not in this version

  • Changing the email address: not planned for MVP1
  • OAuth for agents instead of keys: later, after MVP2
  • A password change on our own page: IDENTITY-V2-E8, when identity is built by hand
  • Exporting my data: not planned

How it works

  1. Browser. The account page shows Identity's components with DocFlow's totals and Payment's orders.
  2. This service. Change password: starts a login and sends the person to Cognito's page, which returns them to /account.
  3. This service. Delete: deletes the Cognito user, then the account, and puts identity.user.deleted in the outbox for every service.
  4. Other services. Delete or anonymize their own rows for that user when the event arrives.
  5. Browser. Creates an API key; the secret is shown once and only its hash is kept.
  6. Gateway. Exchanges an agent's key for a 5-minute access token carrying the key's scopes.

Words used here

API key
A secret starting sk_01s_ that an agent sends instead of a cookie. Only its SHA-256 hash is stored.
Scope
One thing a key may do, such as upload:write. A key has one or more.
Session only
An endpoint that refuses API keys: managing keys, the password and the account.
Outbox
Events are written in the same transaction as the change, then delivered, so identity.user.deleted is never lost.

Quick start

These examples work once the service is built and deployed.

1. Create a key

From the account page, or as a signed-in browser:

curl -X POST https://01scale.com/api/identity/v1/api-keys \
  -H 'Content-Type: application/json' -b cookies.txt \
  -d '{"name":"Claude Desktop","scopes":["upload:write","docflow:read","docflow:write"]}'

2. Use the key from an agent

Any endpoint the key's scopes allow:

curl https://01scale.com/api/docflow/v1/documents \
  -H "Authorization: Bearer $ZEROONE_API_KEY"

3. Delete an account

Session only:

curl -X DELETE https://01scale.com/api/identity/v1/me \
  -H 'Content-Type: application/json' -H 'Origin: https://01scale.com' -b cookies.txt \
  -d '{"confirm":"DELETE"}'

Configuration

Environment variables on the service's own deployment. Secrets are never committed.

COGNITO_USER_POOL_ID
From the Cognito setup, for AdminDeleteUser
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEYsecret
An IAM user allowed only cognito-idp:AdminDeleteUser on the pool
EVENT_ROUTES
From the service template; identity.user.deleted is platform-wide, so it goes to every service and app
EVENTS_SIGNING_KEYsecret
32 random bytes, base64

Open questions

  • Decided by Nikhil on 20 Nov 2026 (#70): the password change goes through Cognito's forgot-password page (a code by email) in MVP1; our own screens come with MVP2 (IDENTITY-V2-E8-10).
  • Decided (#70): the column is user_id, as in identity.sessions; story IDENTITY-V1-E1-10 (then MVP1-E0-06) is updated.
  • Decided (#70): the key prefix is the first 8 characters after sk_01s_, since every key starts with sk_01s_.
  • Decided (#70): GET /users/{userId} is listed in IDENTITY-V1-E1-05 (Identity, which owns it) and DELIVERY-V1-E7-03 (Delivery, which calls it).
  • Decided by Nikhil on 20 Nov 2026 (#70): in MVP1, deleting an account deletes it at once, as designed here. Deactivation with a 30-day restore window is MVP2 story IDENTITY-V2-E8-11, and only Identity changes.
  • API keys have no payment:write scope: only a person, through Stripe's page, completes a payment (CORE-V1-E0-06 AC5).
  • docs/infra/cognito.md needs a step for the IAM user that may call AdminDeleteUser.
  • Starting limits: 10 active keys per person, 90-day default expiry, 1 year at most.