{"openapi":"3.1.0","info":{"title":"Auth API — apps, members and agents","version":"0.1.0","description":"The auth service's own routes (`docs/sales-channels.md` §2.3, `docs/embedded-apps.md`): the app catalogue, an organization's installations — installed, regranted and removed by its owners and admins, each one a fact in the auth journal — the app session that opens an embedded app's page, and how a first-party app records a consent given elsewhere, mints its token, and vouches for a person with an identity claim it signs itself; the roles owners and admins assign members, and ending or restoring a member's access; how many people have joined; read-only mode and going live; a person's grid layouts; social sign-in inside the mobile app and closing one's own account; enrolled stations and the sessions people open in a view; print agents, the program at each site that reaches its printers; and the AI agents a person consents into an organization; and the platform's view across every organization and partner account. Sign-in, organizations, membership and invitations are BetterAuth's own routes and are not described here."},"paths":{"/api/auth/apps":{"get":{"tags":["apps"],"operationId":"apps.catalogue","parameters":[],"security":[{"bearer":[]}],"responses":{"200":{"description":"AppList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppListEncoded"},"examples":{"contract":{"summary":"Abridged to one app: the catalogue lists every app the platform offers.","value":{"apps":[{"id":"app_85cedb60-f616-4fe5-b9ea-dcd3689b4bc6","handle":"xero","name":"Xero","description":"Keep Xero's books in step with Manifold: the general ledger pushed as manual journals, reconciled to the trial balance.","developer":"manifold","scopes":["financials:read","financials:write"],"embedded":true,"redirectOrigins":["https://login.xero.com"],"listing":{"tagline":"Your Manifold ledger in Xero, journal by journal, reconciled to the cent.","overview":["Connect your Xero organisation and Manifold pushes its general ledger there as manual journals: sales invoices, payments and refunds, stock received, cost of sales and write-downs, each on the account you choose.","Every posting reaches Xero once. The connector checks what it has sent against Manifold's trial balance, so a gap is found and filled rather than left for your bookkeeper."],"features":[{"title":"Daily summaries or every posting","body":"One journal per day with each account's totals, or one journal per posting — whichever your bookkeeper prefers."},{"title":"Your chart of accounts, from Xero","body":"Manifold's chart follows Xero's: accounts come across when you connect and whenever you sync, and an account Manifold already had at the same code is kept by Xero from then on. Nothing in Manifold is deleted."},{"title":"Your chart, or ours","body":"Map each Manifold account onto your Xero chart with suggestions, or let the connector create Manifold's accounts in Xero."},{"title":"Start where you choose","body":"Push from a date of your choosing, or the whole ledger from your first sale."},{"title":"Reconciled","body":"What reached Xero is checked against the trial balance, account by account."}],"accent":"#13b5ea","mark":{"path":"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm6.585 14.655c-1.485 0-2.69-1.206-2.69-2.689 0-1.485 1.207-2.691 2.69-2.691 1.485 0 2.69 1.207 2.69 2.691s-1.207 2.689-2.69 2.689zM7.53 14.644c-.099 0-.192-.041-.267-.116l-2.043-2.04-2.052 2.047c-.069.068-.16.108-.258.108-.202 0-.368-.166-.368-.368 0-.099.04-.191.111-.263l2.04-2.05-2.038-2.047c-.075-.069-.113-.162-.113-.261 0-.203.166-.366.368-.366.098 0 .188.037.258.105l2.055 2.048 2.048-2.045c.069-.071.162-.108.26-.108.211 0 .375.165.375.366 0 .098-.029.188-.104.258l-2.056 2.055 2.055 2.051c.068.069.104.16.104.258 0 .202-.165.368-.365.368h-.01zm8.017-4.591c-.796.101-.882.476-.882 1.404v2.787c0 .202-.165.366-.366.366-.203 0-.367-.165-.368-.366v-4.53c0-.204.16-.366.362-.366.166 0 .316.125.346.289.27-.209.6-.317.93-.317h.105c.195 0 .359.165.359.368 0 .201-.164.352-.375.359 0 0-.09 0-.164.008l.053-.002zm-3.091 2.205H8.625c0 .019.003.037.006.057.02.105.045.211.083.31.194.531.765 1.275 1.829 1.29.33-.003.631-.086.9-.229.21-.12.391-.271.525-.428.045-.058.09-.112.12-.168.18-.229.405-.186.54-.083.164.135.18.391.045.57l-.016.016c-.21.27-.435.495-.689.66-.255.164-.525.284-.811.345-.33.09-.645.104-.975.06-1.095-.135-2.01-.93-2.28-2.01-.06-.21-.09-.42-.09-.645 0-.855.421-1.695 1.125-2.205.885-.615 2.085-.66 3-.075.63.405 1.035 1.021 1.185 1.771.075.419-.21.794-.734.81l.068-.046zm6.129-2.223c-1.064 0-1.931.865-1.931 1.931 0 1.064.866 1.931 1.931 1.931s1.931-.867 1.931-1.931c0-1.065-.866-1.933-1.931-1.933v.002zm0 2.595c-.367 0-.666-.297-.666-.666 0-.367.3-.665.666-.665.367 0 .667.299.667.665 0 .369-.3.667-.667.666zm-8.04-2.603c-.91 0-1.672.623-1.886 1.466v.03h3.776c-.203-.855-.973-1.494-1.891-1.494v-.002z","viewBox":"0 0 24 24"},"setupPath":"/apps/xero"},"onboarding":{"path":"/onboarding","role":"accounting","title":"Set up Xero","summary":"Connect your Xero organisation, place Manifold's accounts on your Xero chart, and choose how the ledger is sent."}}]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The app catalogue: every app an organization may install — Manifold's first-party apps until partner apps join it — with what each asks to be granted (`scopes`), whether it has a page of its own in the admin (`embedded`) and its App Store listing.\n\nRequires a signed-in session: Any signed-in person: the catalogue is the same for every organization and holds nothing of one","x-mcp-withheld":"The app catalogue is what Apps › Install in the admin and the App Store show a person deciding what to install; an agent has nothing to act on in it.","x-requires":{"kind":"signed-in","reason":"Any signed-in person: the catalogue is the same for every organization and holds nothing of one"},"x-example-source":{"origin":"contract"}}},"/api/auth/organizations/{organizationId}/installations":{"get":{"tags":["apps"],"operationId":"apps.installations","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"InstallationList","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallationListEncoded"},"examples":{"contract":{"summary":"apps.installations","value":{"installations":[{"id":"ins_01a15cd4-aab8-7f0d-8f5f-fd84ad434e33","appId":"app_85cedb60-f616-4fe5-b9ea-dcd3689b4bc6","tenantId":"org_01a156d2-8680-7738-ab2e-ff985e454887","status":"installed","scopes":["financials:read","financials:write"],"installedBy":"usr_01a15709-7582-7646-b491-261a138f0650","consentVia":"onboarding","installedAt":"2026-10-20T05:02:44.000Z"},{"id":"ins_01a16043-84a2-7c20-8701-12d6f6a127c6","appId":"app_7c2e91d4-5a3b-4f60-8d17-3e9b0a6c4f21","tenantId":"org_01a156d2-8680-7738-ab2e-ff985e454887","status":"installed","scopes":["orders:write","products:read","catalogs:read","stock:read","locations:write","integrations:write"],"installedBy":"usr_01a15709-7582-7646-b491-261a138f0650","consentVia":"consent-card","installedAt":"2026-10-21T21:04:10.000Z"}]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The organization's apps, installed first and then by app: each installation's status, the scopes it was granted, who installed it and when, and where a first-party app's consent was given when it was not the admin's install screen (`consentedThrough`), or where in Manifold the person consented (`consentVia`). A legacy platform's installation shows its `retirement` once the organization has gone live: `draining` to the go-live `cutoff`, since when, until the app reports its drain done — a drain the app never reports stays visible, never retired by itself — then `retired`. 403 `NotAMember` for anyone outside the organization.\n\nRequires a signed-in session: Any active member of the organization, checked against its membership by the route","x-mcp-withheld":"Which apps the organization has installed is read in Apps in the admin; the MCP server does not reach the auth service, and an agent acts through the apps' own tools.","x-requires":{"kind":"signed-in","reason":"Any active member of the organization, checked against its membership by the route"},"x-example-source":{"origin":"contract"}}},"/api/auth/organizations/{organizationId}/installations/{appId}":{"put":{"tags":["apps"],"operationId":"apps.install","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"appId","in":"path","schema":{"$ref":"#/components/schemas/AppId"},"required":true,"example":"app_7c2e91d4-5a3b-4f60-8d17-3e9b0a6c4f21"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Installation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallationEncoded"},"examples":{"contract":{"summary":"apps.install","value":{"id":"ins_01a16043-84a2-7c20-8701-12d6f6a127c6","appId":"app_7c2e91d4-5a3b-4f60-8d17-3e9b0a6c4f21","tenantId":"org_01a156d2-8680-7738-ab2e-ff985e454887","status":"installed","scopes":["orders:write","products:read","catalogs:read","stock:read","locations:write","integrations:write"],"installedBy":"usr_01a15709-7582-7646-b491-261a138f0650","consentVia":"consent-card","installedAt":"2026-10-21T21:04:10.000Z"}}}}}},"400":{"description":"InvalidInstall","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidInstallEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | GrantExceedsYours | OnboardingConsentFirstPartyOnly | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/GrantExceedsYoursEncoded"},{"$ref":"#/components/schemas/OnboardingConsentFirstPartyOnlyEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AppNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppNotFoundEncoded"}}}},"409":{"description":"AppHasNoOnboarding | OrganizationAlreadyLive | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppHasNoOnboardingEncoded"},{"$ref":"#/components/schemas/OrganizationAlreadyLiveEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Install an app in the organization, or consent to it again. The grant is everything the app asks for — the installer never shapes an integration: one who lacks any scope it asks for is refused with 403 `GrantExceedsYours` naming what they lack (ask an owner or admin), and nothing is installed or narrowed. From then the app's token carries exactly that grant, and an embedded app is an entry under Apps in the admin. A re-consent restores the whole grant, and an app the organization removed is installed again by this call. `consentVia` records where the person consented: `consent-card` (the default — the admin's install screen) or `onboarding`, the setup walk's picker (`docs/app-onboarding.md`), where choosing the app is the consent; only a first-party app with a step in the walk is installed so (403 `OnboardingConsentFirstPartyOnly`, 409 `AppHasNoOnboarding`). A legacy platform may not be installed, by this call or any other, once the organization has gone live by decision (409 `OrganizationAlreadyLive`): it was retired then, one-way. 403 `AdminRequired` for a member who is not an owner or admin, 404 `AppNotFound`, 400 `InvalidInstall` for a body that is not this shape. Appends `auth.app-installed`. Idempotent by state: installing an app already installed with everything it asks for is acknowledged and appends nothing, wherever the consent was given.\n\nRequires a signed-in session: An owner or admin of the organization, checked against its membership by the route (the BetterAuth session or the person's tenant JWT for that organization)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"consentVia":{"$ref":"#/components/schemas/AppConsentVia"}},"additionalProperties":false},"example":{"consentVia":"consent-card"}}},"required":true},"x-mcp-withheld":"Installing an app grants it the organization's data under its own identity: an owner's or admin's decision in Apps › Install, never an agent's.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, checked against its membership by the route (the BetterAuth session or the person's tenant JWT for that organization)"},"x-example-source":{"origin":"contract"}},"delete":{"tags":["apps"],"operationId":"apps.uninstall","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"appId","in":"path","schema":{"$ref":"#/components/schemas/AppId"},"required":true,"example":"app_7c2e91d4-5a3b-4f60-8d17-3e9b0a6c4f21"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Installation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallationEncoded"},"examples":{"contract":{"summary":"apps.uninstall","value":{"id":"ins_01a16043-84a2-7c20-8701-12d6f6a127c6","appId":"app_7c2e91d4-5a3b-4f60-8d17-3e9b0a6c4f21","tenantId":"org_01a156d2-8680-7738-ab2e-ff985e454887","status":"uninstalled","scopes":["orders:write","products:read","catalogs:read","stock:read","locations:write","integrations:write"],"installedBy":"usr_01a15709-7582-7646-b491-261a138f0650","consentVia":"consent-card","installedAt":"2026-10-21T21:04:10.000Z","uninstalledAt":"2026-10-22T06:48:02.000Z"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AppNotInstalledToRemove","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppNotInstalledToRemoveEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Remove an app from the organization: every token minted for it from here on is refused, the webhooks service tells the app (`app.uninstalled`), and a first-party app never installs itself again without a fresh consent. 404 `AppNotInstalled` for an app the organization never installed. Appends `auth.app-uninstalled`. Idempotent by state: removing an app already removed is acknowledged and appends nothing.\n\nRequires a signed-in session: An owner or admin of the organization, checked against its membership by the route (the BetterAuth session or the person's tenant JWT for that organization)","x-mcp-withheld":"Removing an app cuts it off from the organization's data: an owner's or admin's decision in Apps, never an agent's.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, checked against its membership by the route (the BetterAuth session or the person's tenant JWT for that organization)"},"x-example-source":{"origin":"contract"}}},"/api/auth/organizations/{organizationId}/installations/{appId}/launch":{"post":{"tags":["apps"],"operationId":"apps.launch","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"appId","in":"path","schema":{"$ref":"#/components/schemas/AppId"},"required":true,"example":"app_85cedb60-f616-4fe5-b9ea-dcd3689b4bc6"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"AppLaunch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppLaunchEncoded"},"examples":{"contract":{"summary":"apps.launch","value":{"url":"https://xero.getmanifold.io/ui","token":"eyJhbGciOiJFZERTQSIsImtpZCI6Imp3a18wMWExNSJ9.eyJzdWIiOiJ1c3JfMDFhMTU3MDkiLCJhdWQiOiJleGFtcGxlIn0.SGVsbG8tc2lnbmVkLWJ5LWF1dGgtc2VydmljZQ","expiresAt":"2026-10-22T03:05:00.000Z"}}}}}},"400":{"description":"InvalidInstall","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidInstallEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | OnboardingLaunchNeedsSetup | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/OnboardingLaunchNeedsSetupEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AppNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppNotFoundEncoded"}}}},"409":{"description":"AppNotInstalledToOpen | AppHasNoOnboarding | InstallationRetiring | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppNotInstalledToOpenEncoded"},{"$ref":"#/components/schemas/AppHasNoOnboardingEncoded"},{"$ref":"#/components/schemas/InstallationRetiringEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Open an embedded app (`docs/embedded-apps.md`): where its page is in this deployment, and an app session token for the page — the person, the organization and the person's own scopes, for five minutes, accepted by the app's own service alone. The admin frames the page and hands it the token over the app bridge. `onboarding: true` is the setup walk framing the app's onboarding page (`docs/app-onboarding.md`): the token then carries the `onboarding` claim, the one thing that lets the app serve that page; 409 `AppHasNoOnboarding` for an app that declares none, 409 `InstallationRetiring` for a legacy platform draining or retired at go-live, 403 `OnboardingLaunchNeedsSetup` for a person who does not hold `setup:write`. The body is optional (400 `InvalidInstall` for one that is not JSON of that shape). 404 `AppNotFound` for an app with no page here, 409 `AppNotInstalled` until it is installed. Appends nothing: a token is not a fact, and nothing changes in the organization. No idempotency key: each call mints a fresh session token, and a second call simply opens the page again.\n\nRequires a signed-in session: Any active member of the organization, checked against its membership by the route","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"onboarding":{"type":"boolean"}},"additionalProperties":false},"example":{"onboarding":true}}},"required":true},"x-mcp-withheld":"Opening an embedded app mints a session for its page in the admin's frame; an agent has no page to open and uses the app's own tools.","x-requires":{"kind":"signed-in","reason":"Any active member of the organization, checked against its membership by the route"},"x-example-source":{"origin":"contract"}}},"/api/auth/apps/{appId}/claim":{"post":{"tags":["appIdentity"],"operationId":"appIdentity.claim","parameters":[{"name":"appId","in":"path","schema":{"$ref":"#/components/schemas/AppId"},"required":true,"example":"app_5bd0f3a8-2c4e-4a71-9e6b-0d3f1c2a7e40"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"created":{"type":"boolean"},"resume":{"anyOf":[{"type":"string","pattern":"^app:[a-z0-9][a-z0-9-]*$"},{"type":"null"}]}},"required":["organizationId","created"],"additionalProperties":false},"examples":{"contract":{"summary":"appIdentity.claim","value":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","created":true,"resume":"app:shopify"}}}}}},"400":{"description":"AppIdentityClaimInvalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppIdentityClaimInvalidEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AppCannotAssertIdentity | NotAMemberOfClaimedOrganization | AppIdentityOrganizationRefused | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppCannotAssertIdentityEncoded"},{"$ref":"#/components/schemas/NotAMemberOfClaimedOrganizationEncoded"},{"$ref":"#/components/schemas/AppIdentityOrganizationRefusedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AppNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppNotFoundEncoded"}}}},"409":{"description":"AppIdentityLinkedElsewhere | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppIdentityLinkedElsewhereEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"AppIdentityDisabled | RequestLogUnavailable","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppIdentityDisabledEncoded"},{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}]}}}}},"description":"A signed-in person redeems the identity claim an app handed their browser (`claim`: who they are in the app's system, and the external account the install is for, signed with the app's own key), with the app's `presence` — its fresh word, fetched by the browser from the app as it redeems, that the same external user of the same account is in front of it now; a claim alone redeems nothing. Both are verified against the key of the app in the path — 400 `ClaimInvalid` for one another app signed, one naming another app, a tampered or an expired one, or a missing, stale or mismatched presence; 404 `AppNotFound` and 403 `AppCannotAssertIdentity` for an app that is not one that may vouch for a person. A claim whose account the app has bound to an organization admits only that organization's members (403 `NotAMember` — its owner invites anyone else); an external user already linked to another person is refused before anything is made (409 `AppIdentityLinkedElsewhere` — a link is never moved). For an unbound account the person chooses: `organizationId` connects it to an organization they own or administer (403 `OrganizationRefused` for one they hold neither role in, a sandbox, or one other than the organization the account is already the app's in), and without it the claim creates the organization, named after the account, with the caller as its owner and `origin: app`. Either way the organization becomes the session's active one, the external user is linked to the person for that app and account, and an email the app's system verified marks the person's matching address verified. Appends `auth.org-created` and `auth.member-added` when it creates the organization, and nothing when it joins or is given one; and `auth.app-user-linked` the first time the external user is linked to the person, in the link's own transaction. No idempotency key: the claim's nonce is not kept here — a repeat for a bound account joins again and appends nothing (the link already stands), and a repeat of an unbound claim, before the app has bound the account, creates another organization.\n\nRequires a signed-in session: The person's BetterAuth session, and a claim that verifies against the key of the app named in the path","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"claim":{"type":"string","minLength":1},"presence":{"type":"string","minLength":1},"organizationId":{"$ref":"#/components/schemas/TenantId"}},"required":["claim","presence"],"additionalProperties":false},"example":{"claim":"eyJhbGciOiJIUzI1NiJ9.eyJhcHBJZCI6ImFwcF81YmQwZjNhOCIsImV4dGVybmFsVXNlcklkIjoiODgxMjA0In0.dm91Y2hlZC1ieS10aGUtYXBw","presence":"eyJhbGciOiJIUzI1NiJ9.eyJleHRlcm5hbFVzZXJJZCI6Ijg4MTIwNCIsImF0IjoxNzkyNjI1MjAwfQ.cHJlc2VudC1ub3c"}}},"required":true},"x-mcp-withheld":"Redeems the signed identity claim an app handed a person's browser, under that person's own session: a sign-in step in the admin, never an agent's.","x-requires":{"kind":"signed-in","reason":"The person's BetterAuth session, and a claim that verifies against the key of the app named in the path"},"x-example-source":{"origin":"contract"}}},"/api/auth/apps/{appId}/session":{"post":{"tags":["appIdentity"],"operationId":"appIdentity.session","parameters":[{"name":"appId","in":"path","schema":{"$ref":"#/components/schemas/AppId"},"required":true,"example":"app_5bd0f3a8-2c4e-4a71-9e6b-0d3f1c2a7e40"}],"security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"sessionToken":{"type":"string"},"organizationId":{"type":"string"},"notMemberOf":{"type":"object","properties":{"organizationId":{"$ref":"#/components/schemas/TenantId"},"organizationName":{"type":"string"}},"required":["organizationId","organizationName"],"additionalProperties":false}},"required":["sessionToken"],"additionalProperties":false},"examples":{"contract":{"summary":"appIdentity.session","value":{"sessionToken":"Xq3mV8tR2pLw6zN1cB5hK9dF4sJ7gA0e","organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887"}}}}}},"400":{"description":"AppIdentityClaimInvalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppIdentityClaimInvalidEncoded"}}}},"403":{"description":"AppCannotAssertIdentity | AppIdentityUserBanned","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppCannotAssertIdentityEncoded"},{"$ref":"#/components/schemas/AppIdentityUserBannedEncoded"}]}}}},"404":{"description":"AppNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppNotFoundEncoded"}}}},"409":{"description":"AppIdentityNotLinked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppIdentityNotLinkedEncoded"}}}},"503":{"description":"AppIdentityDisabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppIdentityDisabledEncoded"}}}}},"description":"A session from the claim and the app's fresh `presence` — no password, no sign-up form — verified exactly as `POST /api/auth/apps/{appId}/claim` verifies it. The person is the one the claim's external user is linked to, for this app and account; an external user linked to nobody yet is linked here to the person whose address is the email the app's system verified (`verifiedEmail`), or to a person created for it (that address, verified, no password: the app's sign-in is their way in until they add another); a claim whose address the app's system has not verified (`email`) creates a person for it, unverified, only while no person holds that address — it never signs anyone in to an existing account. The session opens in the organization the account is bound to, or that registered it, when the person is its member; otherwise in none, and the admin goes on to choose or create one (`organizationId` absent) — or, for an account bound to an organization the person is not a member of, says which (`notMemberOf`, its id and name) so they can ask its owner to admit them (`POST /api/auth/apps/{appId}/join-requests`). Opened from inside the app's system, the app's user decides who the person is: the admin replaces any session it held for someone else with this one. 409 `NotLinked` when the external user is linked to nobody and the claim carries no address, or an unverified one a person already holds: the admin offers sign-in or sign-up instead, and nothing is created. 403 `UserBanned` when the person is banned (this route mints sessions outside BetterAuth's endpoints, so it asks itself). Appends `auth.app-user-linked` when it links the external user, and `auth.signed-in` in the organization the session opens in (nothing when it opens in none). Idempotent by state: a person is created once per address and an external user linked once, so a repeat mints a fresh session for the same person; a claim stops working when it expires.\n\nPublic: The app's signed identity claim and its fresh presence are the credential: verified against the key of the app in the path before any session is made","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"claim":{"type":"string","minLength":1},"presence":{"type":"string","minLength":1}},"required":["claim","presence"],"additionalProperties":false},"example":{"claim":"eyJhbGciOiJIUzI1NiJ9.eyJhcHBJZCI6ImFwcF81YmQwZjNhOCIsImV4dGVybmFsVXNlcklkIjoiODgxMjA0In0.dm91Y2hlZC1ieS10aGUtYXBw","presence":"eyJhbGciOiJIUzI1NiJ9.eyJleHRlcm5hbFVzZXJJZCI6Ijg4MTIwNCIsImF0IjoxNzkyNjI1MjAwfQ.cHJlc2VudC1ub3c"}}},"required":true},"x-mcp-withheld":"Mints a person's session from an app's signed identity claim that only their browser holds; a session is a credential and is never handed to an agent.","x-requires":{"kind":"public","reason":"The app's signed identity claim and its fresh presence are the credential: verified against the key of the app in the path before any session is made"},"x-example-source":{"origin":"contract"}}},"/api/auth/apps/{appId}/join-requests":{"post":{"tags":["appIdentity"],"operationId":"appIdentity.joinRequest","parameters":[{"name":"appId","in":"path","schema":{"$ref":"#/components/schemas/AppId"},"required":true,"example":"app_5bd0f3a8-2c4e-4a71-9e6b-0d3f1c2a7e40"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"$ref":"#/components/schemas/TenantId"},"organizationName":{"type":"string"},"requestedAt":{"type":"string"},"created":{"type":"boolean"},"notified":{"type":"boolean"}},"required":["organizationId","organizationName","requestedAt","created","notified"],"additionalProperties":false},"examples":{"contract":{"summary":"appIdentity.joinRequest","value":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","organizationName":"Acme","requestedAt":"2026-11-05T01:00:00.000Z","created":true,"notified":true}}}}}},"400":{"description":"AppIdentityClaimInvalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppIdentityClaimInvalidEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AppCannotAssertIdentity | JoinRequestNotYours | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppCannotAssertIdentityEncoded"},{"$ref":"#/components/schemas/JoinRequestNotYoursEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AppNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppNotFoundEncoded"}}}},"409":{"description":"JoinRequestNotNeeded | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/JoinRequestNotNeededEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"AppIdentityDisabled | RequestLogUnavailable","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppIdentityDisabledEncoded"},{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}]}}}}},"description":"A signed-in person asks the organization an app's account is bound to to admit them: they opened the app from inside its system (`claim` and the app's fresh `presence`, verified exactly as `POST /api/auth/apps/{appId}/claim` verifies them), and are not that organization's member. The organization's owners and admins are told by mail who asked and from which account, and admit them by inviting them, as membership always works — nothing is granted here. The claim's app user must be linked to the signed-in person (403 `JoinRequestNotYours` otherwise: a session never asks in another person's name). 409 `JoinRequestNotNeeded` for a claim whose account is bound to no organization (the person places it themselves) or a person who is already its member. Appends `auth.join-requested` on the organization's trail, and per owner or admin `auth.join-request-mail-claimed` before their mail is sent (a retry or a second sender leaves one in flight alone), then `auth.join-request-mailed` once the provider accepts it or `auth.join-request-mail-failed`, and `auth.join-request-notified` only once every one is mailed (`notified`); a failed or stranded one is sent again by asking again and by auth's own sweep. Idempotent by state: a person asks an organization once, and a repeat answers the request already made, appending nothing and mailing nobody once its owners have been told.\n\nRequires a signed-in session: The person's BetterAuth session, and a claim that verifies against the key of the app named in the path","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"claim":{"type":"string","minLength":1},"presence":{"type":"string","minLength":1}},"required":["claim","presence"],"additionalProperties":false},"example":{"claim":"eyJhbGciOiJIUzI1NiJ9.eyJhcHBJZCI6ImFwcF81YmQwZjNhOCIsImV4dGVybmFsVXNlcklkIjoiODgxMjA0In0.dm91Y2hlZC1ieS10aGUtYXBw","presence":"eyJhbGciOiJIUzI1NiJ9.eyJleHRlcm5hbFVzZXJJZCI6Ijg4MTIwNCIsImF0IjoxNzkyNjI1MjAwfQ.cHJlc2VudC1ub3c"}}},"required":true},"x-mcp-withheld":"Asks an organization to admit the person an app's signed identity claim vouches for — a claim and presence only their browser in the app's own frame holds; never an agent's.","x-requires":{"kind":"signed-in","reason":"The person's BetterAuth session, and a claim that verifies against the key of the app named in the path"},"x-example-source":{"origin":"contract"}}},"/api/auth/roles/{organizationId}":{"get":{"tags":["members"],"operationId":"members.roles","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"role":{"type":"string"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AssignableRole"}},"effective":{"type":"array","items":{"$ref":"#/components/schemas/Role"}},"deactivated":{"type":"object","properties":{"at":{"type":"string"},"by":{"type":"string"},"reason":{"type":"string"}},"required":["at","by"],"additionalProperties":false}},"required":["userId","role","roles","effective"],"additionalProperties":false}}},"required":["members"],"additionalProperties":false},"examples":{"contract":{"summary":"members.roles","value":{"members":[{"userId":"usr_01a15709-7582-7646-b491-261a138f0650","role":"owner","roles":[],"effective":["owner"]},{"userId":"usr_01a1600c-9600-70f1-9e3a-5bfd672d5b23","role":"member","roles":["fulfilment","receiving"],"effective":["fulfilment","receiving"]},{"userId":"usr_01a16028-0d51-7571-a9e3-6960e8a29986","role":"member","roles":["purchasing"],"effective":["purchasing"]}]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Every member of the organization with the roles an owner or admin assigned them (`roles`), what their tokens carry (`effective`: `owner` or `admin` for governance, which holds every scope, else the assigned roles) and, while it lasts, their deactivation. 403 `AdminRequired` for anyone but an active owner or admin of the organization.\n\nRequires a signed-in session: An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)","x-mcp-withheld":"Who holds which roles is governance, read by an owner or admin in Settings › Users; the MCP server does not reach the auth service, which answers a person's BetterAuth session only.","x-requires":{"kind":"signed-in","reason":"An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)"},"x-example-source":{"origin":"contract"}}},"/api/auth/roles/{organizationId}/{userId}":{"put":{"tags":["members"],"operationId":"members.setRoles","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"userId","in":"path","schema":{"$ref":"#/components/schemas/UsrId"},"required":true,"example":"usr_01a1600c-9600-70f1-9e3a-5bfd672d5b23"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"role":{"type":"string"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AssignableRole"}},"effective":{"type":"array","items":{"$ref":"#/components/schemas/Role"}},"deactivated":{"type":"object","properties":{"at":{"type":"string"},"by":{"type":"string"},"reason":{"type":"string"}},"required":["at","by"],"additionalProperties":false}},"required":["userId","role","roles","effective"],"additionalProperties":false},"examples":{"contract":{"summary":"members.setRoles","value":{"userId":"usr_01a1600c-9600-70f1-9e3a-5bfd672d5b23","role":"member","roles":["fulfilment","receiving"],"effective":["fulfilment","receiving"]}}}}}},"400":{"description":"InvalidRoles","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidRolesEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | GrantExceedsYours | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/GrantExceedsYoursEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"MemberNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Replace one member's assigned roles with `roles` — the whole set, not a change to it. The member's next token carries them (an open admin re-mints the moment the fact is published). Governance is membership, never assigned: an owner or admin holds every scope whatever is stored here. 400 `InvalidRoles` for a name that is not an assignable role or one named twice, 404 `NotAMember` for a person outside the organization, 403 `AdminRequired` for anyone but an owner or admin, 403 `GrantExceedsYours` (naming the excess `scopes` and `views`) for roles reaching beyond what the assigner holds themselves — no one grants more than they hold. Appends `auth.member-roles-changed`. Idempotent by content: assigning the set the member already holds, in any order, is acknowledged and appends nothing.\n\nRequires a signed-in session: An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"roles":{"type":"array","items":{"$ref":"#/components/schemas/AssignableRole"}}},"required":["roles"],"additionalProperties":false},"example":{"roles":["fulfilment","receiving"]}}},"required":true},"x-mcp-withheld":"Assigning roles decides what every member may do: an owner's or admin's decision in Settings › Users, never an agent's — an agent must not widen its own person's reach.","x-requires":{"kind":"signed-in","reason":"An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)"},"x-example-source":{"origin":"contract"}}},"/api/auth/members/{organizationId}/{userId}/deactivate":{"post":{"tags":["members"],"operationId":"members.deactivate","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"userId","in":"path","schema":{"$ref":"#/components/schemas/UsrId"},"required":true,"example":"usr_01a16028-0d51-7571-a9e3-6960e8a29986"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"deactivated":{"anyOf":[{"type":"object","properties":{"deactivatedAt":{"type":"string"},"deactivatedBy":{"type":"string"},"reason":{"type":"string"}},"required":["deactivatedAt","deactivatedBy"],"additionalProperties":false},{"type":"null"}]}},"required":["userId","deactivated"],"additionalProperties":false},"examples":{"contract":{"summary":"members.deactivate","value":{"userId":"usr_01a16028-0d51-7571-a9e3-6960e8a29986","deactivated":{"deactivatedAt":"2026-10-22T04:15:00.000Z","deactivatedBy":"usr_01a15709-7582-7646-b491-261a138f0650","reason":"Left the business."}}}}}}},"400":{"description":"InvalidReason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidReasonEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | MembershipDeactivated | OwnerRequired | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/MembershipDeactivatedEncoded"},{"$ref":"#/components/schemas/OwnerRequiredEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"MemberNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberNotFoundEncoded"}}}},"409":{"description":"CannotDeactivateSelf | LastVerifiedOwner | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CannotDeactivateSelfEncoded"},{"$ref":"#/components/schemas/LastVerifiedOwnerEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"End a member's access to the organization without deleting them — people are never deleted, because the journal names every actor. From their next token they hold nothing here, the organization drops off their list and entering it is refused; their roles are kept for a reactivation. An optional `reason` (at most 500 characters: 400 `InvalidReason` beyond) is recorded with it. 403 `AdminRequired` for anyone but an owner or admin, `MembershipDeactivated` for a caller whose own access has ended, `OwnerRequired` for an admin deactivating an owner; 404 `NotAMember`; 409 `CannotDeactivateSelf`, and 409 `LastVerifiedOwner` for the organization's last active owner with a verified email — every organization keeps one, so elect another verified owner first. Appends `auth.member-deactivated`. Idempotent by state: deactivating a member who is already deactivated is acknowledged and appends nothing.\n\nRequires a signed-in session: An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}},"additionalProperties":false},"example":{"reason":"Left the business."}}},"required":true},"x-mcp-withheld":"Ending a member's access is an owner's or admin's decision in Settings › Users, never an agent's; it answers a person's BetterAuth session only.","x-requires":{"kind":"signed-in","reason":"An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)"},"x-example-source":{"origin":"contract"}}},"/api/auth/members/{organizationId}/{userId}/reactivate":{"post":{"tags":["members"],"operationId":"members.reactivate","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"userId","in":"path","schema":{"$ref":"#/components/schemas/UsrId"},"required":true,"example":"usr_01a16028-0d51-7571-a9e3-6960e8a29986"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"deactivated":{"anyOf":[{"type":"object","properties":{"deactivatedAt":{"type":"string"},"deactivatedBy":{"type":"string"},"reason":{"type":"string"}},"required":["deactivatedAt","deactivatedBy"],"additionalProperties":false},{"type":"null"}]}},"required":["userId","deactivated"],"additionalProperties":false},"examples":{"contract":{"summary":"members.reactivate","value":{"userId":"usr_01a16028-0d51-7571-a9e3-6960e8a29986","deactivated":null}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | MembershipDeactivated | OwnerRequired | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/MembershipDeactivatedEncoded"},{"$ref":"#/components/schemas/OwnerRequiredEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"MemberNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Restore a deactivated member's access exactly as it was: their membership role and the roles assigned them, kept while they were away, are what their next token carries. 403 `AdminRequired` for anyone but an owner or admin, `MembershipDeactivated` for a caller whose own access has ended, `OwnerRequired` for an admin reactivating an owner; 404 `NotAMember`. Appends `auth.member-reactivated`. Idempotent by state: reactivating a member who is active is acknowledged and appends nothing.\n\nRequires a signed-in session: An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)","x-mcp-withheld":"Restoring a member's access is an owner's or admin's decision in Settings › Users, never an agent's; it answers a person's BetterAuth session only.","x-requires":{"kind":"signed-in","reason":"An active owner or admin of the organization, checked against its membership by the route (the person's BetterAuth session)"},"x-example-source":{"origin":"contract"}}},"/api/auth/mode":{"get":{"tags":["mode"],"operationId":"mode.read","parameters":[],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"mode":{"$ref":"#/components/schemas/TenantMode"},"changedAt":{"type":"string"},"changedBy":{"type":"string"},"mailDomains":{"type":"array","items":{"type":"string"}}},"required":["organizationId","mode"],"additionalProperties":false},"examples":{"contract":{"summary":"mode.read","value":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","mode":"read-only","changedAt":"2026-10-20T01:00:02.000Z","changedBy":"usr_01a15709-7582-7646-b491-261a138f0650"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Where the caller's organization stands: `read-only` (Manifold writes nothing outside itself for it — no push to a sales channel or a ledger, no mail to its customers or suppliers, no webhook to an app) or `live`, with who last changed it and when. An organization nobody has decided stands at the deployment's default, which is `read-only`. A sandbox is always `read-only` and never goes live; its `mailDomains` are the one exception — the company domains of its own people, the only addresses its mail may reach (never a public mailbox provider's). This is what every service that writes outward asks at the moment it would, so an app acting for a tenant asks it too.\n\nRequires a signed-in session: Any person, service or app holding a tenant JWT reads its own organization's mode, and no other","x-mcp-withheld":"Whether the organization is read-only is the badge across the admin and what each service asks before it writes outward; the MCP server does not reach the auth service, and a refused push says why.","x-requires":{"kind":"signed-in","reason":"Any person, service or app holding a tenant JWT reads its own organization's mode, and no other"},"x-example-source":{"origin":"contract"}}},"/api/auth/organizations/{organizationId}/go-live":{"post":{"tags":["mode"],"operationId":"mode.goLive","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"mode":{"$ref":"#/components/schemas/TenantMode"},"changedAt":{"type":"string"},"changedBy":{"type":"string"},"mailDomains":{"type":"array","items":{"type":"string"}}},"required":["organizationId","mode"],"additionalProperties":false},"examples":{"contract":{"summary":"mode.goLive","value":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","mode":"live","changedAt":"2026-10-22T00:00:00.000Z","changedBy":"usr_01a15709-7582-7646-b491-261a138f0650"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | MembershipDeactivated | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/MembershipDeactivatedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"SandboxNeverLive | PlanRequiredToGoLive | OpeningStocktakeIncomplete | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SandboxNeverLiveEncoded"},{"$ref":"#/components/schemas/PlanRequiredToGoLiveEncoded"},{"$ref":"#/components/schemas/OpeningStocktakeIncompleteEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"PlanCheckUnavailable | OpeningStocktakeUnavailable | RequestLogUnavailable","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanCheckUnavailableEncoded"},{"$ref":"#/components/schemas/OpeningStocktakeUnavailableEncoded"},{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}]}}}}},"description":"Take the organization out of read-only mode: the business accepts Manifold acting for it, and from here outbound work runs — pushes to its sales channels and its ledger, mail to its customers and suppliers, webhooks to its apps. Nothing refused while it was read-only is sent late; each integration catches up from the state as it now stands. Going live is where the tenant starts paying: an organization billed through an app (the one whose install brought it) goes live only on a plan approved with that app's billing provider — 409 `PlanRequiredToGoLive` names the app and its plan page (`plansUrl`) to approve it on, and 503 `PlanCheckUnavailable` says billing did not answer; either way nothing changed, and this is asked before the books are opened. Going live opens the books: it commands inventory-manager to complete the opening stocktake (`inventory.stocktake-completed`, after `inventory.stocktake-started` when none is open) — the counts entered on it, every pair nobody counted at what inventory holds, every stock SKU at the cost entered or its cost basis — so the general ledger, and every ledger app's history, begins at go-live (`docs/stocktake.md`). 409 `OpeningStocktakeIncomplete` names the stock SKUs with no cost, and 503 `OpeningStocktakeUnavailable` says inventory did not answer; either way nothing changed. 403 `AdminRequired` for anyone but an owner or admin, `MembershipDeactivated` for a caller whose own access has ended; 409 `SandboxNeverLive` for a sandbox, which never goes live. Going live is final: once decided, `read-only` is refused with 409 `GoLiveIsFinal`. Appends `auth.org-went-live`. Idempotent by state: an organization that is already live is acknowledged and appends nothing.\n\nRequires a signed-in session: An active owner or admin of the organization, by their BetterAuth session or their own tenant JWT, checked against its membership by the route","x-mcp-withheld":"Going live is the business accepting that Manifold now writes to its store, its ledger and its customers: an owner's or admin's decision in Settings › General, never an agent's.","x-requires":{"kind":"signed-in","reason":"An active owner or admin of the organization, by their BetterAuth session or their own tenant JWT, checked against its membership by the route"},"x-example-source":{"origin":"contract"}}},"/api/auth/organizations/{organizationId}/read-only":{"post":{"tags":["mode"],"operationId":"mode.setReadOnly","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"mode":{"$ref":"#/components/schemas/TenantMode"},"changedAt":{"type":"string"},"changedBy":{"type":"string"},"mailDomains":{"type":"array","items":{"type":"string"}}},"required":["organizationId","mode"],"additionalProperties":false},"examples":{"contract":{"summary":"mode.setReadOnly","value":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","mode":"read-only","changedAt":"2026-10-20T01:00:02.000Z","changedBy":"usr_01a15709-7582-7646-b491-261a138f0650"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | MembershipDeactivated | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/MembershipDeactivatedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"GoLiveIsFinal | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/GoLiveIsFinalEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Pin an undecided organization in read-only mode — one standing live only by the deployment's default: from here nothing leaves Manifold for it, while orders bridged in, imports and people's own work in Manifold carry on. Going live is final, so an organization that has decided to go live is refused with 409 `GoLiveIsFinal` and nothing changes. 403 `AdminRequired` for anyone but an owner or admin, `MembershipDeactivated` for a caller whose own access has ended. Appends `auth.org-set-read-only`. Idempotent by state: an organization that is already read-only — a sandbox always is — is acknowledged and appends nothing.\n\nRequires a signed-in session: An active owner or admin of the organization, by their BetterAuth session or their own tenant JWT, checked against its membership by the route","x-mcp-withheld":"Stopping everything Manifold sends outward is an owner's or admin's decision in Settings › General, never an agent's.","x-requires":{"kind":"signed-in","reason":"An active owner or admin of the organization, by their BetterAuth session or their own tenant JWT, checked against its membership by the route"},"x-example-source":{"origin":"contract"}}},"/api/auth/organizations/{organizationId}/member-count":{"get":{"tags":["team"],"operationId":"team.memberCount","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"$ref":"#/components/schemas/TenantId"},"members":{"type":"integer","minimum":0}},"required":["organizationId","members"],"additionalProperties":false},"examples":{"contract":{"summary":"team.memberCount","value":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","members":3}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"How many people belong to the organization: its active members, the owner included and the deactivated aside — a count, never who they are. What the setup walk's team step asks to see whether anyone has joined. Read with a tenant JWT for that organization (a person's, a service's or an app's), checked by the route: 403 `NotAMember` for a token minted for another organization, 403 `ScopeRequired` without `setup:read`. Read-only: no fact, no request row.\n\nRequires `setup:read`.","x-mcp-withheld":"The setup walk's own evidence for its team step, read by onboarding-manager with the caller's token; an agent reads the walk itself (`onboarding_get_status`) and invites people in Settings › Users.","x-required-scopes":["setup:read"],"x-example-source":{"origin":"contract"}}},"/api/auth/agent-clients/{clientId}":{"get":{"tags":["agents"],"operationId":"agents.client","parameters":[{"name":"clientId","in":"path","schema":{"type":"string"},"required":true,"example":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"clientId":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"required":["clientId","name"],"additionalProperties":false},"examples":{"contract":{"summary":"agents.client","value":{"clientId":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB","name":"Stockroom Assistant"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AgentClientNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentClientNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The MCP client asking for a person's consent, as the admin's authorization screen shows it: its registered name and icon. 404 `AgentClientNotFound` for a client id the OAuth provider never registered.\n\nRequires a signed-in session: Any signed-in person: the consent screen shows the asking client before an organization is chosen, and it holds nothing of one","x-mcp-withheld":"The consent screen's lookup of the asking client, shown to the person deciding; an agent is the client being asked about, not the one consenting.","x-requires":{"kind":"signed-in","reason":"Any signed-in person: the consent screen shows the asking client before an organization is chosen, and it holds nothing of one"},"x-example-source":{"origin":"contract"}}},"/api/auth/agents/{organizationId}":{"get":{"tags":["agents"],"operationId":"agents.list","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"grants":{"type":"array","items":{"type":"object","properties":{"clientId":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"grantedAt":{"type":"string"},"clientName":{"type":"string"},"userEmail":{"type":"string"},"userName":{"type":"string"}},"required":["clientId","userId","organizationId","scopes","grantedAt","clientName"],"additionalProperties":false}},"holds":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}}},"required":["grants","holds"],"additionalProperties":false},"examples":{"contract":{"summary":"agents.list","value":{"grants":[{"clientId":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB","userId":"usr_01a15709-7582-7646-b491-261a138f0650","organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","scopes":["products:read","stock:read","orders:read"],"grantedAt":"2026-10-22T01:12:09.000Z","clientName":"Stockroom Assistant","userEmail":"dana.whitlock@ridgeline-outdoor.example","userName":"Dana Whitlock"}],"holds":["products:read","products:write","catalogs:read","catalogs:write","stock:read","stock:write","receiving:read","receiving:write","allocations:read","allocations:write","locations:read","locations:write","orders:read","orders:write","shipping:read","shipping:write","payments:read","payments:write","purchasing:read","purchasing:write","customers:read","customers:write","companies:read","companies:write","privacy:read","privacy:write","financials:read","financials:write","books:read","books:write","margins:read","margins:write","reports:read","reports:write","imports:read","imports:write","integrations:read","integrations:write","setup:read","setup:write","billing:read","billing:write","activity:read","activity:write","settings:read","settings:write","notifications:read","notifications:write","saved-views:read","saved-views:write","commissions:read","commissions:write","catalog-override:read","catalog-override:write","printing:read","printing:write"]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The AI agents (MCP clients) consented into the organization — which client, acting as whom, with which scopes, since when; a delegation to a connected surface is listed by `GET /api/auth/surfaces/:organizationId` instead: every grant for an owner or admin, the caller's own for any other member (who may connect, rescope and revoke their own) — and `holds`, the scopes the caller holds there, which is what a consent of theirs may grant. 403 `NotAMember` for anyone outside the organization.\n\nRequires a signed-in session: Any active member of the organization, checked against its membership by the route: an owner or admin reads every grant, anyone else their own","x-mcp-withheld":"Which agents are consented into the organization is read in Agents in the admin; the MCP server does not reach the auth service, and an agent's own grant is the token it holds.","x-requires":{"kind":"signed-in","reason":"Any active member of the organization, checked against its membership by the route: an owner or admin reads every grant, anyone else their own"},"x-example-source":{"origin":"contract"}}},"/api/auth/surfaces/{organizationId}":{"get":{"tags":["agents"],"operationId":"agents.surfaces","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"surfaces":{"type":"array","items":{"type":"object","properties":{"clientId":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"grantedAt":{"type":"string"},"clientName":{"type":"string"},"userEmail":{"type":"string"},"userName":{"type":"string"},"surface":{"type":"string"},"surfaceName":{"type":"string"}},"required":["clientId","userId","organizationId","scopes","grantedAt","clientName","surface","surfaceName"],"additionalProperties":false}}},"required":["surfaces"],"additionalProperties":false},"examples":{"contract":{"summary":"agents.surfaces","value":{"surfaces":[{"clientId":"slack:T04ACMEHQ","userId":"usr_01a15709-7582-7646-b491-261a138f0650","organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","scopes":["products:read","stock:read","orders:read"],"grantedAt":"2026-10-22T01:12:09.000Z","clientName":"Slack","userEmail":"dana.whitlock@ridgeline-outdoor.example","userName":"Dana Whitlock","surface":"slack","surfaceName":"Slack"}]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The connected surfaces of the organization (Settings › Apps › Slack): each person's delegation to a core service they reach from somewhere else — the Slack app now; Teams, WhatsApp or a voice line later (`docs/slack.md` §4) — with the `surface` it is for, since when and with which scopes: every delegation for an owner or admin, the caller's own for any other member. These are agent grants recorded by `PUT /api/auth/delegations/…`, and `GET /api/auth/agents/:organizationId` leaves them out; one is withdrawn with `DELETE /api/auth/agents/:organizationId/:clientId/:userId`, after which the surface's next exchange is refused. Which account on the surface a delegation is for (the Slack workspace's name) is the surface's own data, read from it. 403 `NotAMember` for anyone outside the organization.\n\nRequires a signed-in session: Any active member of the organization, checked against its membership by the route: an owner or admin reads every delegation, anyone else their own","x-mcp-withheld":"Which people have connected Slack (and later other chat and voice surfaces) is read in Settings › Apps › Slack in the admin; the MCP server does not reach the auth service, and an agent is not a surface.","x-requires":{"kind":"signed-in","reason":"Any active member of the organization, checked against its membership by the route: an owner or admin reads every delegation, anyone else their own"},"x-example-source":{"origin":"contract"}}},"/api/auth/agents/{organizationId}/{clientId}":{"put":{"tags":["agents"],"operationId":"agents.connect","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"clientId","in":"path","schema":{"type":"string"},"required":true,"example":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"clientId":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"grantedAt":{"type":"string"},"clientName":{"type":"string"},"userEmail":{"type":"string"},"userName":{"type":"string"}},"required":["clientId","userId","organizationId","scopes","grantedAt","clientName"],"additionalProperties":false},"examples":{"contract":{"summary":"agents.connect","value":{"clientId":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB","userId":"usr_01a15709-7582-7646-b491-261a138f0650","organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","scopes":["products:read","stock:read","orders:read"],"grantedAt":"2026-10-22T01:12:09.000Z","clientName":"Stockroom Assistant","userEmail":"dana.whitlock@ridgeline-outdoor.example","userName":"Dana Whitlock"}}}}}},"400":{"description":"AgentGrantEmpty | AgentAuthorizationInvalid","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AgentGrantEmptyEncoded"},{"$ref":"#/components/schemas/AgentAuthorizationInvalidEncoded"}]}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AgentClientNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentClientNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The caller's consent on the authorization screen: this MCP client may act as them in this organization, with the `scopes` they choose — closed (write implying read) and of what they hold there, never more. The MCP token exchange reads the grant to mint the agent a tenant token carrying the person's roles and the grant as `agentScopes`, and every service holds the two's overlap: owners and admins are narrowed too, and a person whose roles shrink takes their agent down with them. One client acts as one person in one organization at a time, so a grant for the client in another organization moves here. 400 `AgentGrantEmpty` when no scope asked for is one the caller holds, 400 `AgentAuthorizationInvalid` when `oauthQuery` is not an authorization request the provider signed for this client (tampered, hand-made, expired — the consent screen passes the one it was opened with), 403 `NotAMember` for anyone outside the organization, 404 `AgentClientNotFound` for an unregistered client. Appends `auth.agent-connected`. Idempotent by content: a grant already naming this organization and these scopes is acknowledged and appends nothing; other scopes are a change, and a new fact.\n\nRequires a signed-in session: Any active member of the organization, checked against its membership by the route: the consent is the caller's own, for themselves","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"oauthQuery":{"type":"string","description":"The signed OAuth authorization query the consent screen was opened with, verbatim."}},"required":["scopes","oauthQuery"],"additionalProperties":false},"example":{"scopes":["orders:read","stock:read","products:read"],"oauthQuery":"response_type=code&client_id=kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB&redirect_uri=http%3A%2F%2F127.0.0.1%3A33418%2Fcallback&scope=openid+offline_access&state=k2Jd8sQv&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256&exp=1792634400&sig=Rk9yLWNvbnNlbnQtb25seQ"}}},"required":true},"x-mcp-withheld":"Consent is the person's, given on the authorization screen in a browser; an agent never consents for itself.","x-requires":{"kind":"signed-in","reason":"Any active member of the organization, checked against its membership by the route: the consent is the caller's own, for themselves"},"x-example-source":{"origin":"contract"}}},"/api/auth/agents/{organizationId}/{clientId}/{userId}":{"put":{"tags":["agents"],"operationId":"agents.rescope","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"clientId","in":"path","schema":{"type":"string"},"required":true,"example":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB"},{"name":"userId","in":"path","schema":{"$ref":"#/components/schemas/UsrId"},"required":true,"example":"usr_01a15709-7582-7646-b491-261a138f0650"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"clientId":{"type":"string"},"userId":{"type":"string"},"organizationId":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"grantedAt":{"type":"string"},"clientName":{"type":"string"},"userEmail":{"type":"string"},"userName":{"type":"string"}},"required":["clientId","userId","organizationId","scopes","grantedAt","clientName"],"additionalProperties":false},"examples":{"contract":{"summary":"agents.rescope","value":{"clientId":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB","userId":"usr_01a15709-7582-7646-b491-261a138f0650","organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","scopes":["stock:read","orders:read"],"grantedAt":"2026-10-22T01:12:09.000Z","clientName":"Stockroom Assistant","userEmail":"dana.whitlock@ridgeline-outdoor.example","userName":"Dana Whitlock"}}}}}},"400":{"description":"AgentGrantEmpty","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentGrantEmptyEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | AdminRequired | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"AgentGrantNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentGrantNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Change what an existing agent grant holds: the person's own, to any `scopes` they now hold (as a fresh consent would), or anyone's for an owner or admin, who may only narrow it — of what it already holds — since consent to more is the person's alone. 400 `AgentGrantEmpty` when nothing asked for may be granted, 403 `NotAMember` for anyone outside the organization and `AdminRequired` for another person's grant without being an owner or admin, 404 `AgentGrantNotFound` when the person has no grant for the client here. Appends `auth.agent-connected` with the grant as it now stands, the caller as its actor. Idempotent by content: scopes the grant already holds are acknowledged and append nothing.\n\nRequires a signed-in session: The person whose grant it is, or an owner or admin of the organization for anyone's, checked against its membership by the route","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}}},"required":["scopes"],"additionalProperties":false},"example":{"scopes":["orders:read","stock:read"]}}},"required":true},"x-mcp-withheld":"What an agent may do is the person's consent, changed in Agents in the admin; an agent never widens or narrows its own grant.","x-requires":{"kind":"signed-in","reason":"The person whose grant it is, or an owner or admin of the organization for anyone's, checked against its membership by the route"},"x-example-source":{"origin":"contract"}},"delete":{"tags":["agents"],"operationId":"agents.revoke","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a156d2-8680-7738-ab2e-ff985e454887"},{"name":"clientId","in":"path","schema":{"type":"string"},"required":true,"example":"kQ7vXpLmTsWnhRbyJdcFgzNaeHuVrKoB"},{"name":"userId","in":"path","schema":{"$ref":"#/components/schemas/UsrId"},"required":true,"example":"usr_01a15709-7582-7646-b491-261a138f0650"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean"}},"required":["revoked"],"additionalProperties":false},"examples":{"contract":{"summary":"agents.revoke","value":{"revoked":true}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AdminRequired | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AdminRequiredEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Withdraw an agent's grant — or a delegation to a connected surface, whose next exchange is then refused: the caller's own, or any in the organization for an owner or admin. Every access and refresh token the client holds for the person is deleted with it, so the agent's next call is refused; `revoked` says whether there was a grant to withdraw. 403 `AdminRequired` for another person's grant without being an owner or admin. Appends `auth.agent-revoked`. Idempotent by state: revoking a grant already withdrawn is acknowledged, answers `revoked: false` and appends nothing.\n\nRequires a signed-in session: The person whose grant it is, or an owner or admin of the organization for anyone's, checked against its membership by the route","x-mcp-withheld":"Withdrawing an agent's access (or a connected surface's) is the person's or an admin's in Agents or Settings › Apps › Slack in the admin; an agent that wants to stop simply stops calling.","x-requires":{"kind":"signed-in","reason":"The person whose grant it is, or an owner or admin of the organization for anyone's, checked against its membership by the route"},"x-example-source":{"origin":"contract"}}},"/api/auth/me/grid-layouts":{"get":{"tags":["gridLayouts"],"operationId":"gridLayouts.list","parameters":[],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"layouts":{"type":"array","items":{"type":"object","properties":{"grid":{"$ref":"#/components/schemas/GridKey"},"order":{"type":"array","items":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,63}$"},"maxItems":64},"hidden":{"type":"array","items":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,63}$"},"maxItems":64},"updatedAt":{"type":"string"}},"required":["grid","order","hidden","updatedAt"],"additionalProperties":false}}},"required":["layouts"],"additionalProperties":false},"examples":{"contract":{"summary":"gridLayouts.list","value":{"layouts":[{"grid":"orders","order":["order","customer","status","payment","lines","created","reference","source"],"hidden":["reference","source"],"updatedAt":"2026-10-22T02:31:40.000Z"}]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"How the signed-in person arranged the admin's lists: for each grid they have arranged, its columns in the order they put them (`order`; columns it does not name follow in the grid's own order) and the ones they switched off (`hidden`). A grid they never arranged is absent and shows as the admin declares it. The person's own, the same in every organization they belong to. Read-only.\n\nRequires a signed-in session: The signed-in person's own layouts, read from their BetterAuth session; no path names anyone else","x-mcp-withheld":"How a person arranged the admin's grids is a display preference of the admin itself; the MCP server does not reach the auth service, and an agent reads records, not columns.","x-requires":{"kind":"signed-in","reason":"The signed-in person's own layouts, read from their BetterAuth session; no path names anyone else"},"x-example-source":{"origin":"contract"}}},"/api/auth/me/grid-layouts/{grid}":{"put":{"tags":["gridLayouts"],"operationId":"gridLayouts.set","parameters":[{"name":"grid","in":"path","schema":{"$ref":"#/components/schemas/GridKey"},"required":true,"example":"orders"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"grid":{"$ref":"#/components/schemas/GridKey"},"order":{"type":"array","items":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,63}$"},"maxItems":64},"hidden":{"type":"array","items":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,63}$"},"maxItems":64},"updatedAt":{"type":"string"}},"required":["grid","order","hidden","updatedAt"],"additionalProperties":false},"examples":{"contract":{"summary":"gridLayouts.set","value":{"grid":"orders","order":["order","customer","status","payment","lines","created","reference","source"],"hidden":["reference","source"],"updatedAt":"2026-10-22T02:31:40.000Z"}}}}}},"400":{"description":"InvalidGridLayout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidGridLayoutEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Replace how the signed-in person arranged one grid with `order` and `hidden` — the whole layout, not a change to it; both empty restores the grid's own. 400 `InvalidGridLayout` for a malformed column key, one named twice, or more than 64 in either list. An impersonating platform admin's arrangement is answered and not stored. Appends `auth.grid-layout-set`. Idempotent by content: the layout the grid already has (`hidden` in any order) is acknowledged and appends nothing.\n\nRequires a signed-in session: The signed-in person's own layouts, read from their BetterAuth session; no path names anyone else","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"array","items":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,63}$"},"maxItems":64},"hidden":{"type":"array","items":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,63}$"},"maxItems":64}},"required":["order","hidden"],"additionalProperties":false},"example":{"order":["order","customer","status","payment","lines","created","reference","source"],"hidden":["reference","source"]}}},"required":true},"x-mcp-withheld":"A person arranges their own grids by dragging columns in the admin; an agent has no grid to arrange and the MCP server does not reach the auth service.","x-requires":{"kind":"signed-in","reason":"The signed-in person's own layouts, read from their BetterAuth session; no path names anyone else"},"x-example-source":{"origin":"contract"}}},"/api/auth/native/redeem":{"post":{"tags":["nativeSignIn"],"operationId":"nativeSignIn.redeem","parameters":[],"security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"sessionToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},"provider":{"$ref":"#/components/schemas/SocialProvider"}},"required":["sessionToken","user","provider"],"additionalProperties":false},"examples":{"contract":{"summary":"nativeSignIn.redeem","value":{"sessionToken":"se1Fq2mWx7cKd9Lr0Tz4","user":{"id":"usr_01a15709-7582-7646-b491-261a138f0650","email":"sam@example.com","name":"Sam Rivera"},"provider":"google"}}}}}},"404":{"description":"NativeHandoffInvalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NativeHandoffInvalidEncoded"}}}}},"description":"Redeem the one-time `code` a native social sign-in handed the Manifold mobile app (`manifold://auth?code=…`) with the `verifier` whose SHA-256 started it: the answer is the session the provider's round trip opened in the system browser, as a bearer the app keeps like any sign-in's. A code redeems for five minutes from the round trip's return. 404 `NativeHandoffInvalid` for a code that is unknown, expired, never finished, or presented with another verifier — one answer for each. Appends `auth.native-handoff-redeemed`. Idempotent by state: a handoff is redeemed once, so a retry of the same `code` with the same verifier inside the five minutes is acknowledged, answers the same session and appends nothing.\n\nPublic: The one-time code a native handoff answered with and the PKCE verifier only the page that started it holds, both checked by the route before anything is read","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemNativeHandoffEncoded"},"example":{"code":"q3Jb7n0yJm1oQvV5c8XkS2eZ4hTgW9aLdRfPuY6iNxE","verifier":"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"}}},"required":true},"x-mcp-withheld":"The mobile app's own hand-off of a person's social sign-in from the system browser, redeemed with a verifier only that app holds; a session is never handed to an agent, whose own is the MCP exchange.","x-requires":{"kind":"public","reason":"The one-time code a native handoff answered with and the PKCE verifier only the page that started it holds, both checked by the route before anything is read"},"x-example-source":{"origin":"contract"}}},"/api/auth/me/close":{"post":{"tags":["account"],"operationId":"account.close","parameters":[],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UsrId"},"closedAt":{"type":"string"},"organizations":{"type":"array","items":{"type":"string"}},"signInMethodsRemoved":{"type":"integer","minimum":0}},"required":["userId","closedAt","organizations","signInMethodsRemoved"],"additionalProperties":false},"examples":{"contract":{"summary":"account.close","value":{"userId":"usr_01a15709-7582-7646-b491-261a138f0650","closedAt":"2026-10-30T02:15:00.000Z","organizations":["org_01a156d2-8680-7738-ab2e-ff985e454887"],"signInMethodsRemoved":2}}}}}},"400":{"description":"AccountClosureUnconfirmed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountClosureUnconfirmedEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"AccountClosureRefused | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AccountClosureRefusedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"AccountClosureBlocked | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AccountClosureBlockedEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Close the signed-in person's own account, for good: `confirm` must say `delete my account`. People are never deleted — every fact keeps naming them by `usr_` id — so closing deactivates their membership in every organization (an `auth.member-deactivated` on each organization's trail), ends every session, removes every way in (the password, social accounts, passkeys) and erases their name and email. 400 `AccountClosureUnconfirmed` when `confirm` says anything else; 409 `AccountClosureBlocked` while they are the last active owner with a verified email of any organization, naming each — elect another owner there first; 403 `AccountClosureRefused` for a platform admin impersonating them. Appends `auth.account-closed`. Idempotent by state: closing ends the session that asked, so a retry is refused 401 and appends nothing.\n\nRequires a signed-in session: The signed-in person's own account, read from their BetterAuth session; no path names anyone else","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseAccountEncoded"},"example":{"confirm":"delete my account"}}},"required":true},"x-mcp-withheld":"Closing an account is final and is the person's own decision, typed by them on their account page in the app; an agent never closes the account of the person it acts for.","x-requires":{"kind":"signed-in","reason":"The signed-in person's own account, read from their BetterAuth session; no path names anyone else"},"x-example-source":{"origin":"contract"}}},"/api/auth/stations/{organizationId}":{"get":{"tags":["stations"],"operationId":"stations.list","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"stations":{"type":"array","items":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"view":{"$ref":"#/components/schemas/StationView"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/StationName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"lastUnlock":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UsrId"},"method":{"$ref":"#/components/schemas/StationUnlockMethod"},"at":{"type":"string"}},"required":["userId","method","at"],"additionalProperties":false}},"required":["stationId","view","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false}}},"required":["stations"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"stations":[{"stationId":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","view":"pick-pack","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Bench 2","enrolledAt":"2026-08-17T09:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c"}]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The organization's enrolled stations, newest first: each one's view, location and name, who enrolled it and when, whether it was revoked, and who last unlocked it and how. An owner or admin sees every station; anyone else the stations of the views their roles open. 403 `NotAMember` for anyone outside the organization. Read-only.\n\nRequires a signed-in session: An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)","x-mcp-withheld":"Which devices are enrolled as stations is read in Settings › Stations and on the ops board; the MCP server does not reach the auth service, and an agent works no station.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":4}},"post":{"tags":["stations"],"operationId":"stations.enrol","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"station":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"view":{"$ref":"#/components/schemas/StationView"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/StationName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"lastUnlock":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UsrId"},"method":{"$ref":"#/components/schemas/StationUnlockMethod"},"at":{"type":"string"}},"required":["userId","method","at"],"additionalProperties":false}},"required":["stationId","view","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false},"credential":{"$ref":"#/components/schemas/StationCredential"}},"required":["station","credential"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"station":{"stationId":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","view":"pick-pack","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Bench 2","enrolledAt":"2026-08-17T09:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c"},"credential":"stc_Qm9vdGgtMi1pbi10aGUtd2FyZWhvdXNl"}}}}}},"400":{"description":"InvalidStation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidStationEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | ViewNotOpened | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/ViewNotOpenedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"StationIdTaken | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/StationIdTakenEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Enrol a device as a station: signed in to one station `view` (pick-pack, receiving, stocktake or the register) at one `locationId`, under the `stationId` the enroller minted. The answer carries the device's `credential` — shown once, hashed at rest — which the device keeps and presents to unlock. Nobody enrols a station for a view their own roles do not open: 403 `ViewNotOpened`, owners and admins excepted. 400 `InvalidStation` for a view that is not a station's or a malformed name, 403 `NotAMember` for anyone outside the organization. Appends `auth.station-enrolled`. Idempotent on `stationId`: a retry by the same person with the same body within a day answers the original station and credential and appends nothing; any other use of the id is 409 `StationIdTaken`.\n\nRequires a signed-in session: An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"view":{"$ref":"#/components/schemas/StationView"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/StationName"}},"required":["stationId","view","locationId","name"],"additionalProperties":false},"example":{"stationId":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","view":"pick-pack","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Bench 2"}}},"required":true},"x-mcp-withheld":"Enrolling a device hands it a credential that keeps it signed in to the organization: a person's decision at the device in Settings › Stations, and a credential is never handed to an agent.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":2}}},"/api/auth/stations/{organizationId}/{stationId}":{"patch":{"tags":["stations"],"operationId":"stations.rename","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"},{"name":"stationId","in":"path","schema":{"$ref":"#/components/schemas/StnId"},"required":true,"example":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"view":{"$ref":"#/components/schemas/StationView"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/StationName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"lastUnlock":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UsrId"},"method":{"$ref":"#/components/schemas/StationUnlockMethod"},"at":{"type":"string"}},"required":["userId","method","at"],"additionalProperties":false}},"required":["stationId","view","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"stationId":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","view":"pick-pack","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Packing bench 2","enrolledAt":"2026-08-17T09:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c"}}}}}},"400":{"description":"InvalidStation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidStationEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | ViewNotOpened | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/ViewNotOpenedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"StationNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Rename a station — what the device and Settings › Stations call it. 403 `ViewNotOpened` for a station of a view the caller's roles do not open, 404 `StationNotFound` for an id no station of the organization has, 400 `InvalidStation` for a malformed name. Appends `auth.station-renamed`. Idempotent by content: the name the station already has is acknowledged and appends nothing.\n\nRequires a signed-in session: An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"$ref":"#/components/schemas/StationName"}},"required":["name"],"additionalProperties":false},"example":{"name":"Packing bench 2"}}},"required":true},"x-mcp-withheld":"A station's name is what the people at the device read, changed in Settings › Stations; the MCP server does not reach the auth service.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":5}}},"/api/auth/stations/{organizationId}/{stationId}/revoke":{"post":{"tags":["stations"],"operationId":"stations.revoke","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"},{"name":"stationId","in":"path","schema":{"$ref":"#/components/schemas/StnId"},"required":true,"example":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"view":{"$ref":"#/components/schemas/StationView"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/StationName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"lastUnlock":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UsrId"},"method":{"$ref":"#/components/schemas/StationUnlockMethod"},"at":{"type":"string"}},"required":["userId","method","at"],"additionalProperties":false}},"required":["stationId","view","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"stationId":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","view":"pick-pack","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Packing bench 2","enrolledAt":"2026-08-17T09:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","revokedAt":"2026-08-17T09:00:00.000Z","revokedBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | ViewNotOpened | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/ViewNotOpenedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"StationNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Revoke a station: its device credential unlocks nothing from now on, and the sessions it handed out end with their short life. Final — the device is enrolled again as a new station. 403 `ViewNotOpened` for a station of a view the caller's roles do not open, 404 `StationNotFound` for an unknown id. Appends `auth.station-revoked`. Idempotent by state: a station already revoked is answered as it stands and appends nothing.\n\nRequires a signed-in session: An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)","x-mcp-withheld":"Revoking a station signs a device out of the organization for good: a person's decision in Settings › Stations, never an agent's.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, or a member whose roles open the station's view, checked against its membership by the route (the BetterAuth session)"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":9}}},"/api/auth/station-pins/{organizationId}":{"put":{"tags":["stations"],"operationId":"stations.setPin","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"$ref":"#/components/schemas/TenantId"},"userId":{"$ref":"#/components/schemas/UsrId"},"setAt":{"type":"string"}},"required":["organizationId","userId","setAt"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"organizationId":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","userId":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","setAt":"2026-08-17T09:00:00.000Z"}}}}}},"400":{"description":"InvalidStationPin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidStationPinEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Set the signed-in person's own station PIN for the organization: 4 to 8 digits (6 to 8 for an owner or admin), hashed at rest, never shown again. It unlocks a station only together with the device's own credential, and a new one lifts the person's lockout. 400 `InvalidStationPin` for anything else, 403 `NotAMember` for anyone who is not an active member — and for an impersonating platform admin, since a PIN is the person's own secret. Appends `auth.station-pin-set`. Idempotent by content: the PIN the person already has is acknowledged and appends nothing.\n\nRequires a signed-in session: The signed-in person's own station PIN in an organization they are an active member of; no path names anyone else","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"pin":{"$ref":"#/components/schemas/StationPin"}},"required":["pin"],"additionalProperties":false},"example":{"pin":"482913"}}},"required":true},"x-mcp-withheld":"A station PIN is a person's own secret, typed by them in their profile; a secret is never typed into a chat or handed to an agent.","x-requires":{"kind":"signed-in","reason":"The signed-in person's own station PIN in an organization they are an active member of; no path names anyone else"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":1}}},"/api/auth/station/roster":{"post":{"tags":["stations"],"operationId":"stations.roster","parameters":[],"security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"station":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"view":{"$ref":"#/components/schemas/StationView"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/StationName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"lastUnlock":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UsrId"},"method":{"$ref":"#/components/schemas/StationUnlockMethod"},"at":{"type":"string"}},"required":["userId","method","at"],"additionalProperties":false}},"required":["stationId","view","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false},"people":{"type":"array","items":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UsrId"},"name":{"type":"string"}},"required":["userId","name"],"additionalProperties":false}}},"required":["station","people"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"station":{"stationId":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","view":"pick-pack","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Packing bench 2","enrolledAt":"2026-08-17T09:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c"},"people":[{"userId":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","name":"Avery Lin"}]}}}}}},"400":{"description":"InvalidStation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidStationEncoded"}}}},"401":{"description":"StationCredentialInvalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationCredentialInvalidEncoded"}}}}},"description":"What an enrolled device shows on its lock screen: the station as enrolled, and the people who may unlock it — the organization's active members with a station PIN whose roles open its view. 401 `StationCredentialInvalid` for an unknown credential or a revoked station, 400 `InvalidStation` for a malformed body. Appends nothing: a read that carries the device's credential in its body, which a `GET` could not. No idempotency key: a retry reads the roster again and appends nothing.\n\nPublic: The enrolled device's own credential, verified by the route before anything is read: a station signs in as itself, and nobody is signed in on it yet","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"credential":{"$ref":"#/components/schemas/StationCredential"}},"required":["credential"],"additionalProperties":false},"example":{"credential":"stc_Qm9vdGgtMi1pbi10aGUtd2FyZWhvdXNl"}}},"required":true},"x-mcp-withheld":"A station's lock screen, read by the enrolled device under its own credential; no person or agent holds that credential, and an agent works no station.","x-requires":{"kind":"public","reason":"The enrolled device's own credential, verified by the route before anything is read: a station signs in as itself, and nobody is signed in on it yet"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":6}}},"/api/auth/station/unlock":{"post":{"tags":["stations"],"operationId":"stations.unlock","parameters":[],"security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expiresAt":{"type":"string"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"userId":{"$ref":"#/components/schemas/UsrId"},"view":{"$ref":"#/components/schemas/View"},"station":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"locationId":{"$ref":"#/components/schemas/LocId"}},"required":["stationId","locationId"],"additionalProperties":false}},"required":["token","expiresAt","tenantId","userId","view"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"token":"eyJhbGciOiJFZERTQSJ9.eyJ2aWV3IjoicGljay1wYWNrIn0.c3RhdGlvbi1zZXNzaW9u","expiresAt":"2026-08-17T09:15:00.000Z","tenantId":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","userId":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","view":"pick-pack","station":{"stationId":"stn_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d"}}}}}}},"400":{"description":"InvalidStation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidStationEncoded"}}}},"401":{"description":"StationCredentialInvalid | StationUnlockRefused","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/StationCredentialInvalidEncoded"},{"$ref":"#/components/schemas/StationUnlockRefusedEncoded"}]}}}},"403":{"description":"ViewNotOpened","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ViewNotOpenedEncoded"}}}},"429":{"description":"StationPinLocked | StationLocked","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/StationPinLockedEncoded"},{"$ref":"#/components/schemas/StationLockedEncoded"}]}}}}},"description":"Unlock a station as a person: the device's `credential` with their `userId` and station `pin` (`method: pin`). No sign-in left open on the device unlocks it. The answer is a short-lived token whose subject is the person, in the station's `view`, carrying the `station` and its location — every service narrows the person's roles by the view's ceiling, an owner's or admin's too, and what they do is theirs on the trail. 401 `StationCredentialInvalid` for an unknown credential or a revoked station, 401 `StationUnlockRefused` for a wrong PIN (`attemptsLeft`), no PIN, an owner's or admin's PIN under six digits, or someone who is not an active member, 429 `StationPinLocked` after five wrong PINs in a row for that person (`auth.station-pin-locked` is appended as it locks), 429 `StationLocked` after ten failed unlocks in a row at the station whoever they named (`auth.station-locked` is appended as it locks) — each lockout fifteen minutes, doubling with every lockout in a row up to a day until an unlock succeeds — 403 `ViewNotOpened` when the person's roles do not open the station's view, 400 `InvalidStation` for a malformed body. Appends `auth.station-unlocked`. No idempotency key: each unlock is a fresh sign-in at the device, like any sign-in, and mints a fresh token.\n\nPublic: The enrolled device's own credential, verified by the route before anything is read: a station signs in as itself, and nobody is signed in on it yet, with the person's own station PIN","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"method":{"type":"string","enum":["pin"]},"credential":{"$ref":"#/components/schemas/StationCredential"},"userId":{"$ref":"#/components/schemas/UsrId"},"pin":{"$ref":"#/components/schemas/StationPin"}},"required":["method","credential","userId","pin"],"additionalProperties":false},"example":{"method":"pin","credential":"stc_Qm9vdGgtMi1pbi10aGUtd2FyZWhvdXNl","userId":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","pin":"482913"}}},"required":true},"x-mcp-withheld":"Unlocking a station takes the device's credential and a person's PIN or passkey at the device itself; a credential is never handed to an agent.","x-requires":{"kind":"public","reason":"The enrolled device's own credential, verified by the route before anything is read: a station signs in as itself, and nobody is signed in on it yet, with the person's own station PIN"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":7}}},"/api/auth/print-agents/{organizationId}":{"get":{"tags":["printAgents"],"operationId":"printAgents.list","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"agents":{"type":"array","items":{"type":"object","properties":{"agentId":{"$ref":"#/components/schemas/PagId"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/PrintAgentName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"lastSeenAt":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"build":{"type":"object","properties":{"version":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"},"channel":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,31}$"},"available":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"}},"required":["version","channel"],"additionalProperties":false}},"required":["agentId","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false}}},"required":["agents"],"additionalProperties":false},"examples":{"contract":{"summary":"printAgents.list","value":{"agents":[{"agentId":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Dispatch PC","enrolledAt":"2026-10-30T02:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","lastSeenAt":"2026-10-30T02:05:00.000Z","build":{"version":"1.3.0","channel":"latest","available":"1.4.0"}}]}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | PrintAgentsNotManaged | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/PrintAgentsNotManagedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"The organization's print agents, newest first: each one's location and name, who enrolled it and when, when it last signed in (`lastSeenAt` — roughly when it was last online) and whether it was revoked. 403 `PrintAgentsNotManaged` for a member whose roles do not read the organization's locations, 403 `NotAMember` for anyone outside the organization. Read-only.\n\nRequires a signed-in session: An owner or admin of the organization, or a member whose roles hold locations:read, checked against its membership by the route (the BetterAuth session)","x-mcp-withheld":"Which print agents a site has, and when each was last online, is read in Settings › Printing; the MCP server does not reach the auth service, and an agent sends no label to a printer.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, or a member whose roles hold locations:read, checked against its membership by the route (the BetterAuth session)"},"x-example-source":{"origin":"contract"}},"post":{"tags":["printAgents"],"operationId":"printAgents.enrol","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"type":"object","properties":{"agentId":{"$ref":"#/components/schemas/PagId"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/PrintAgentName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"lastSeenAt":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"build":{"type":"object","properties":{"version":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"},"channel":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,31}$"},"available":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"}},"required":["version","channel"],"additionalProperties":false}},"required":["agentId","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false},"credential":{"$ref":"#/components/schemas/PrintAgentCredential"}},"required":["agent","credential"],"additionalProperties":false},"examples":{"contract":{"summary":"printAgents.enrol","value":{"agent":{"agentId":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Dispatch PC","enrolledAt":"2026-10-30T02:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c"},"credential":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b.Rm9yLXRoZS1kaXNwYXRjaC16ZWJyYS1vbmx5"}}}}}},"400":{"description":"InvalidPrintAgent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidPrintAgentEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | PrintAgentsNotManaged | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/PrintAgentsNotManagedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"PrintAgentIdTaken | MirroredFromSource","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PrintAgentIdTakenEncoded"},{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}]}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Enrol a print agent — the program at a site that sends labels to its printers, such as the desktop app's agent mode — at one `locationId`, under the `agentId` the enroller minted. The answer carries the agent's `credential`, shown once and hashed at rest, which the agent keeps and exchanges for its device token. 403 `PrintAgentsNotManaged` for a member whose roles do not configure locations, 403 `NotAMember` for anyone outside the organization, 400 `InvalidPrintAgent` for a malformed id, location or name. Appends `auth.print-agent-enrolled`. Idempotent on `agentId`: a retry by the same person with the same body within a day answers the original agent and credential and appends nothing; any other use of the id is 409 `PrintAgentIdTaken`.\n\nRequires a signed-in session: An owner or admin of the organization, or a member whose roles hold locations:write, checked against its membership by the route (the BetterAuth session)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"$ref":"#/components/schemas/PagId"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/PrintAgentName"}},"required":["agentId","locationId","name"],"additionalProperties":false},"example":{"agentId":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Dispatch PC"}}},"required":true},"x-mcp-withheld":"Enrolling a print agent hands the program at a site a credential that keeps it signed in to the organization: a person's decision at that machine, and a credential is never handed to an agent.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, or a member whose roles hold locations:write, checked against its membership by the route (the BetterAuth session)"},"x-example-source":{"origin":"contract"}}},"/api/auth/print-agents/{organizationId}/{agentId}/revoke":{"post":{"tags":["printAgents"],"operationId":"printAgents.revoke","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"},{"name":"agentId","in":"path","schema":{"$ref":"#/components/schemas/PagId"},"required":true,"example":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"$ref":"#/components/schemas/PagId"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/PrintAgentName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"lastSeenAt":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"build":{"type":"object","properties":{"version":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"},"channel":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,31}$"},"available":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"}},"required":["version","channel"],"additionalProperties":false}},"required":["agentId","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false},"examples":{"contract":{"summary":"printAgents.revoke","value":{"agentId":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Dispatch PC","enrolledAt":"2026-10-30T02:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","revokedAt":"2026-10-30T03:00:00.000Z","revokedBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | PrintAgentsNotManaged | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/PrintAgentsNotManagedEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"PrintAgentNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrintAgentNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Revoke a print agent: its credential mints no token from now on, and the tokens it holds end with their fifteen minutes; its printers wait for another agent. Final — the device is enrolled again as a new agent. 403 `PrintAgentsNotManaged` for a member whose roles do not configure locations, 404 `PrintAgentNotFound` for an id no agent of the organization has. Appends `auth.print-agent-revoked`. Idempotent by state: an agent already revoked is answered as it stands and appends nothing.\n\nRequires a signed-in session: An owner or admin of the organization, or a member whose roles hold locations:write, checked against its membership by the route (the BetterAuth session)","x-mcp-withheld":"Revoking a print agent signs the program at a site out of the organization for good and stops its printers: a person's decision in Settings › Printing, never an agent's.","x-requires":{"kind":"signed-in","reason":"An owner or admin of the organization, or a member whose roles hold locations:write, checked against its membership by the route (the BetterAuth session)"},"x-example-source":{"origin":"contract"}}},"/api/auth/organizations/{organizationId}/print-agents/{agentId}":{"get":{"tags":["printAgents"],"operationId":"printAgents.get","parameters":[{"name":"organizationId","in":"path","schema":{"$ref":"#/components/schemas/TenantId"},"required":true,"example":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d"},{"name":"agentId","in":"path","schema":{"$ref":"#/components/schemas/PagId"},"required":true,"example":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"$ref":"#/components/schemas/PagId"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/PrintAgentName"},"enrolledAt":{"type":"string"},"enrolledBy":{"type":"string"},"lastSeenAt":{"type":"string"},"revokedAt":{"type":"string"},"revokedBy":{"type":"string"},"build":{"type":"object","properties":{"version":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"},"channel":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,31}$"},"available":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"}},"required":["version","channel"],"additionalProperties":false}},"required":["agentId","locationId","name","enrolledAt","enrolledBy"],"additionalProperties":false},"examples":{"contract":{"summary":"printAgents.get","value":{"agentId":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d","name":"Dispatch PC","enrolledAt":"2026-10-30T02:00:00.000Z","enrolledBy":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","lastSeenAt":"2026-10-30T02:05:00.000Z"}}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"NotAMember | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NotAMemberEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"PrintAgentNotFound","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrintAgentNotFoundEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"One print agent of the organization: its location and name, when it was enrolled and last signed in, and whether it was revoked. Read with a tenant JWT for that organization (a person's, a service's or an app's), checked by the route — what fulfillment asks before a printer may name the agent, which must stand at the printer's site and not be revoked. 403 `NotAMember` for a token minted for another organization, 403 `ScopeRequired` without `locations:read`, 404 `PrintAgentNotFound` for an id no agent of the organization has. Read-only.\n\nRequires `locations:read`.","x-mcp-withheld":"Fulfillment's own check that a printer names an agent enrolled at its site, read with the caller's token; a person sees the agents in Settings › Printing, and the MCP server does not reach the auth service.","x-required-scopes":["locations:read"],"x-example-source":{"origin":"contract"}}},"/api/auth/print-agent/token":{"post":{"tags":["printAgents"],"operationId":"printAgents.token","parameters":[],"security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expiresAt":{"type":"string"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"printAgent":{"type":"object","properties":{"agentId":{"$ref":"#/components/schemas/PagId"},"locationId":{"$ref":"#/components/schemas/LocId"}},"required":["agentId","locationId"],"additionalProperties":false}},"required":["token","expiresAt","tenantId","printAgent"],"additionalProperties":false},"examples":{"contract":{"summary":"printAgents.token","value":{"token":"eyJhbGciOiJFZERTQSJ9.eyJwcmludEFnZW50Ijp0cnVlfQ.ZGV2aWNlLXRva2Vu","expiresAt":"2026-10-30T02:20:00.000Z","tenantId":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","printAgent":{"agentId":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b","locationId":"loc_01a15852-46d1-7a3b-9c0d-1e2f3a4b5c6d"}}}}}}},"401":{"description":"PrintAgentCredentialInvalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrintAgentCredentialInvalidEncoded"}}}}},"description":"Exchange a print agent's `credential` for its device token: fifteen minutes, subject `device:<agentId>`, the agent's organization and the `printAgent` claim naming the agent and the location it was enrolled at — no person and no roles, so every service gives it only what a print agent holds (its own print jobs, read and reported). The agent calls it again before the token lapses — its heartbeat: each call stamps the agent's `lastSeenAt` and keeps the build it reports (`agent`: its version, update channel and the newest version its updater found), which the organization's list shows so a person sees an agent that is behind. 401 `PrintAgentCredentialInvalid` for an unknown credential or a revoked agent. Appends nothing: a mint changes no state. No idempotency key: a retry mints another short-lived token and appends nothing.\n\nPublic: The print agent's own credential, verified by the route before anything is read: an agent signs in as itself, with no person behind it","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"credential":{"$ref":"#/components/schemas/PrintAgentCredential"},"agent":{"type":"object","properties":{"version":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"},"channel":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,31}$"},"available":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][0-9A-Za-z.-]{1,40})?$"}},"required":["version","channel"],"additionalProperties":false}},"required":["credential","agent"],"additionalProperties":false},"example":{"credential":"pag_01a1a3c2-5d6e-7f80-9a1b-2c3d4e5f6a7b.Rm9yLXRoZS1kaXNwYXRjaC16ZWJyYS1vbmx5","agent":{"version":"1.3.0","channel":"latest","available":"1.4.0"}}}},"required":true},"x-mcp-withheld":"The print agent's own protocol, exchanging its credential for a device token at the site; no person or agent holds that credential, and a token is never handed to an agent.","x-requires":{"kind":"public","reason":"The print agent's own credential, verified by the route before anything is read: an agent signs in as itself, with no person behind it"},"x-example-source":{"origin":"contract"}}},"/api/auth/views/{view}/session":{"post":{"tags":["views"],"operationId":"views.session","parameters":[{"name":"view","in":"path","schema":{"$ref":"#/components/schemas/View"},"required":true,"example":"reporting"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expiresAt":{"type":"string"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"userId":{"$ref":"#/components/schemas/UsrId"},"view":{"$ref":"#/components/schemas/View"},"station":{"type":"object","properties":{"stationId":{"$ref":"#/components/schemas/StnId"},"locationId":{"$ref":"#/components/schemas/LocId"}},"required":["stationId","locationId"],"additionalProperties":false}},"required":["token","expiresAt","tenantId","userId","view"],"additionalProperties":false},"examples":{"work-a-station":{"summary":"Set up a station and unlock it with a PIN","value":{"token":"eyJhbGciOiJFZERTQSJ9.eyJ2aWV3IjoicmVwb3J0aW5nIn0.dmlldy1zZXNzaW9u","expiresAt":"2026-08-17T09:15:00.000Z","tenantId":"org_01a1586e-f9f6-7a8b-9c7d-6e5f4a3b2c1d","userId":"usr_01a15869-1d2e-7f3a-8b4c-5d6e7f8a9b0c","view":"reporting"}}}}}},"400":{"description":"ViewNeedsStation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ViewNeedsStationEncoded"}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"ViewNotOpened | NoActiveOrganization | TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ViewNotOpenedEncoded"},{"$ref":"#/components/schemas/NoActiveOrganizationEncoded"},{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"404":{"description":"UnknownView","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnknownViewEncoded"}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Exchange the signed-in person's session for a token in one personal `view` — reporting, the B2B order form, the support desk, the ops board or the back office — which the view's app carries on every call: the person's own claims with the view, whose ceiling every service narrows their roles by. 403 `ViewNotOpened` when their roles do not open the view, 400 `ViewNeedsStation` for a station's view (those open by unlocking an enrolled station), 403 `NoActiveOrganization` when the session names no organization the person still reaches, 404 `UnknownView` for a view there is not. Appends nothing: a mint changes no state, and the sign-in it is minted from was journalled when it happened. No idempotency key: a retry mints another short-lived token and appends nothing.\n\nRequires a signed-in session: The signed-in person's own session, in the organization it is active in; the view's app calls it after sign-in","x-mcp-withheld":"Opening a session in a view mints a token for that view's app after a person signs in; a token is never handed to an agent, whose own session is the MCP exchange.","x-requires":{"kind":"signed-in","reason":"The signed-in person's own session, in the organization it is active in; the view's app calls it after sign-in"},"x-example-source":{"origin":"workflow","workflow":"work-a-station","step":8}}},"/events":{"get":{"tags":["events"],"operationId":"events.list","parameters":[{"name":"since","in":"query","schema":{"type":"string"},"required":false,"example":"17"}],"security":[{"bearer":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/auth.signed-inEncoded"},{"$ref":"#/components/schemas/auth.org-createdEncoded"},{"$ref":"#/components/schemas/auth.org-updatedEncoded"},{"$ref":"#/components/schemas/auth.org-went-liveEncoded"},{"$ref":"#/components/schemas/auth.org-set-read-onlyEncoded"},{"$ref":"#/components/schemas/auth.org-deletedEncoded"},{"$ref":"#/components/schemas/auth.member-addedEncoded"},{"$ref":"#/components/schemas/auth.member-removedEncoded"},{"$ref":"#/components/schemas/auth.member-role-changedEncoded"},{"$ref":"#/components/schemas/auth.member-roles-changedEncoded"},{"$ref":"#/components/schemas/auth.member-deactivatedEncoded"},{"$ref":"#/components/schemas/auth.member-reactivatedEncoded"},{"$ref":"#/components/schemas/auth.invitation-createdEncoded"},{"$ref":"#/components/schemas/auth.invitation-changedEncoded"},{"$ref":"#/components/schemas/auth.invitation-cancelledEncoded"},{"$ref":"#/components/schemas/auth.invitation-rejectedEncoded"},{"$ref":"#/components/schemas/auth.impersonation-startedEncoded"},{"$ref":"#/components/schemas/auth.impersonation-stoppedEncoded"},{"$ref":"#/components/schemas/auth.user-bannedEncoded"},{"$ref":"#/components/schemas/auth.user-unbannedEncoded"},{"$ref":"#/components/schemas/auth.user-role-changedEncoded"},{"$ref":"#/components/schemas/auth.user-removedEncoded"},{"$ref":"#/components/schemas/auth.agent-connectedEncoded"},{"$ref":"#/components/schemas/auth.agent-revokedEncoded"},{"$ref":"#/components/schemas/auth.app-installedEncoded"},{"$ref":"#/components/schemas/auth.app-uninstalledEncoded"},{"$ref":"#/components/schemas/auth.app-drainingEncoded"},{"$ref":"#/components/schemas/auth.app-retiredEncoded"},{"$ref":"#/components/schemas/auth.passkey-registeredEncoded"},{"$ref":"#/components/schemas/auth.passkey-removedEncoded"},{"$ref":"#/components/schemas/auth.grid-layout-setEncoded"},{"$ref":"#/components/schemas/auth.native-handoff-redeemedEncoded"},{"$ref":"#/components/schemas/auth.account-closedEncoded"},{"$ref":"#/components/schemas/auth.station-enrolledEncoded"},{"$ref":"#/components/schemas/auth.station-renamedEncoded"},{"$ref":"#/components/schemas/auth.station-revokedEncoded"},{"$ref":"#/components/schemas/auth.station-unlockedEncoded"},{"$ref":"#/components/schemas/auth.station-pin-setEncoded"},{"$ref":"#/components/schemas/auth.station-pin-lockedEncoded"},{"$ref":"#/components/schemas/auth.station-lockedEncoded"},{"$ref":"#/components/schemas/auth.print-agent-enrolledEncoded"},{"$ref":"#/components/schemas/auth.print-agent-revokedEncoded"},{"$ref":"#/components/schemas/auth.social-account-linkedEncoded"},{"$ref":"#/components/schemas/auth.social-account-unlinkedEncoded"},{"$ref":"#/components/schemas/auth.app-user-linkedEncoded"},{"$ref":"#/components/schemas/auth.join-requestedEncoded"},{"$ref":"#/components/schemas/auth.join-request-notifiedEncoded"},{"$ref":"#/components/schemas/auth.join-request-mail-claimedEncoded"},{"$ref":"#/components/schemas/auth.join-request-mailedEncoded"},{"$ref":"#/components/schemas/auth.join-request-mail-failedEncoded"},{"$ref":"#/components/schemas/auth.partner-createdEncoded"},{"$ref":"#/components/schemas/auth.partner-removedEncoded"},{"$ref":"#/components/schemas/auth.partner-bannedEncoded"},{"$ref":"#/components/schemas/auth.partner-unbannedEncoded"},{"$ref":"#/components/schemas/auth.partner-member-invitedEncoded"},{"$ref":"#/components/schemas/auth.partner-invitation-endedEncoded"},{"$ref":"#/components/schemas/auth.partner-member-joinedEncoded"},{"$ref":"#/components/schemas/auth.partner-member-removedEncoded"},{"$ref":"#/components/schemas/auth.partner-client-createdEncoded"},{"$ref":"#/components/schemas/auth.partner-client-handed-overEncoded"},{"$ref":"#/components/schemas/auth.partner-sandbox-createdEncoded"},{"$ref":"#/components/schemas/auth.partner-sandbox-retiredEncoded"},{"$ref":"#/components/schemas/auth.sandbox-createdEncoded"},{"$ref":"#/components/schemas/auth.sandbox-retiredEncoded"},{"$ref":"#/components/schemas/auth.partner-invitedEncoded"},{"$ref":"#/components/schemas/auth.partner-access-requestedEncoded"},{"$ref":"#/components/schemas/auth.partner-access-approvedEncoded"},{"$ref":"#/components/schemas/auth.partner-link-acceptedEncoded"},{"$ref":"#/components/schemas/auth.partner-link-roles-changedEncoded"},{"$ref":"#/components/schemas/auth.partner-link-endedEncoded"},{"$ref":"#/components/schemas/auth.partner-staff-assignedEncoded"},{"$ref":"#/components/schemas/auth.partner-session-startedEncoded"}]}},"examples":{"contract":{"summary":"events.list","value":[{"_tag":"auth.app-installed","eventId":"evt_01a1618d-1c6e-7499-b5fa-49137bea8262","txId":"tx_01a161a8-93bf-7037-acb8-c1dc75fb5a72","tenantId":"org_01a156d2-8680-7738-ab2e-ff985e454887","sequence":17,"occurredAt":"2026-10-21T21:04:10.000Z","source":"auth-service","version":1,"actor":{"_tag":"user","id":"usr_01a15709-7582-7646-b491-261a138f0650"},"correlationId":"req_01a161c4-0b10-777e-9078-3f678235f4a8","payload":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887","installationId":"ins_01a16043-84a2-7c20-8701-12d6f6a127c6","appId":"app_7c2e91d4-5a3b-4f60-8d17-3e9b0a6c4f21","scopes":["orders:write","products:read","catalogs:read","stock:read","locations:write","integrations:write"],"consentVia":"consent-card"}},{"_tag":"auth.org-went-live","eventId":"evt_01a161df-8261-7db5-906a-0d1bd65d56ea","txId":"tx_01a161fa-f9b2-7085-812b-e1aa46077bb8","tenantId":"org_01a156d2-8680-7738-ab2e-ff985e454887","sequence":18,"occurredAt":"2026-10-22T00:00:00.000Z","source":"auth-service","version":1,"actor":{"_tag":"user","id":"usr_01a15709-7582-7646-b491-261a138f0650"},"correlationId":"req_01a16216-7103-7926-9f2b-56008fdc0a95","payload":{"organizationId":"org_01a156d2-8680-7738-ab2e-ff985e454887"}}]}}}}},"401":{"description":"Unauthorized | TokenAlreadyUsed","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UnauthorizedEncoded"},{"$ref":"#/components/schemas/TokenAlreadyUsedEncoded"}]}}}},"402":{"description":"SubscriptionRequired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequiredEncoded"}}}},"403":{"description":"TenantRequired | ScopeRequired | PlatformAdminRequired","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TenantRequiredEncoded"},{"$ref":"#/components/schemas/ScopeRequiredEncoded"},{"$ref":"#/components/schemas/PlatformAdminRequiredEncoded"}]}}}},"409":{"description":"MirroredFromSource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MirroredFromSourceEncoded"}}}},"503":{"description":"RequestLogUnavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLogUnavailableEncoded"}}}}},"description":"Replay the organization's auth facts at-or-after `since` (a journal sequence number), oldest first: the organization created, members and invitations, roles, agents connected, apps installed and removed, the partner program's links.\n\nRequires a signed-in session: Any person or service holding a tenant JWT reads that organization's own journal, and no other","x-mcp-withheld":"The journal replay a consumer pages through to build its projection; agents read the projections the list and get tools serve, and the audit trail (`audit_trail`) for history.","x-requires":{"kind":"signed-in","reason":"Any person or service holding a tenant JWT reads that organization's own journal, and no other"},"x-example-source":{"origin":"contract"}}}},"components":{"schemas":{"AppId":{"type":"string","pattern":"^app_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A app-prefixed uuid, e.g. app_9f8c1c2e-0000-4000-8000-000000000000"},"AppDeveloperKind":{"type":"string","enum":["manifold","partner"],"description":"`manifold` — first-party, deployed with the platform; `partner` — built by a partner account (`prt_`)"},"PrtId":{"type":"string","pattern":"^prt_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A prt-prefixed uuid, e.g. prt_9f8c1c2e-0000-4000-8000-000000000000"},"Scope":{"type":"string","enum":["products:read","products:write","catalogs:read","catalogs:write","stock:read","stock:write","receiving:read","receiving:write","allocations:read","allocations:write","locations:read","locations:write","orders:read","orders:write","shipping:read","shipping:write","payments:read","payments:write","purchasing:read","purchasing:write","customers:read","customers:write","companies:read","companies:write","privacy:read","privacy:write","financials:read","financials:write","books:read","books:write","margins:read","margins:write","reports:read","reports:write","imports:read","imports:write","integrations:read","integrations:write","setup:read","setup:write","billing:read","billing:write","activity:read","activity:write","settings:read","settings:write","notifications:read","notifications:write","saved-views:read","saved-views:write","commissions:read","commissions:write","catalog-override:read","catalog-override:write","printing:read","printing:write"],"description":"A permission an endpoint requires, `<resource>:<read|write>`; holding `write` implies `read`."},"AppRedirectOrigin":{"type":"string","pattern":"^https:\\/\\/[a-z0-9-]+(\\.[a-z0-9-]+)+$","description":"An https origin (scheme and host, no path) an embedded app's page may send the browser to."},"AppFeatureEncoded":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":60},"body":{"type":"string","minLength":1,"maxLength":240}},"required":["title","body"],"additionalProperties":false},"AppListingEncoded":{"type":"object","properties":{"tagline":{"type":"string","minLength":1,"maxLength":120},"overview":{"type":"array","items":{"type":"string","minLength":1,"maxLength":600},"minItems":1,"maxItems":4},"features":{"type":"array","items":{"$ref":"#/components/schemas/AppFeatureEncoded"},"minItems":1,"maxItems":6},"accent":{"type":"string","pattern":"^#[0-9a-f]{6}$"},"mark":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":8000,"pattern":"^[MmZzLlHhVvCcSsQqTtAa0-9eE.,\\s+-]+$"},"viewBox":{"type":"string","pattern":"^-?\\d+(\\.\\d+)? -?\\d+(\\.\\d+)? \\d+(\\.\\d+)? \\d+(\\.\\d+)?$"}},"required":["path"],"additionalProperties":false},"setupPath":{"type":"string","pattern":"^\\/[a-z0-9/-]*$"}},"required":["tagline","overview","features","accent"],"additionalProperties":false},"AppOnboardingRole":{"type":"string","enum":["legacy-platform","sales-channel","accounting","shipping"],"description":"The part of setup an app answers for: `legacy-platform` — the ERP or inventory system the merchant is leaving, whose import answers products, locations, parties and stock, retired at go-live; `sales-channel` — a place the tenant sells (Shopify, Amazon), done when its channel is connected and publishes a catalog; `accounting` — accounting software (Xero, MYOB, QuickBooks), any number in parallel, done when its ledger is connected, its settings saved and every account the chart's roles need has a place (nothing unplaced or unmapped); `shipping` — a shipping app that books labels with the merchant's carrier account, done when an account of its is connected and every fulfillable site has an address"},"AppEncoded":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/AppId"},"handle":{"type":"string","pattern":"^[a-z][a-z0-9-]{1,39}$"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":300},"developer":{"$ref":"#/components/schemas/AppDeveloperKind"},"partnerId":{"$ref":"#/components/schemas/PrtId"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"channelType":{"type":"string"},"embedded":{"type":"boolean"},"redirectOrigins":{"type":"array","items":{"$ref":"#/components/schemas/AppRedirectOrigin"}},"listing":{"$ref":"#/components/schemas/AppListingEncoded"},"onboarding":{"type":"object","properties":{"path":{"type":"string","enum":["/onboarding"]},"role":{"$ref":"#/components/schemas/AppOnboardingRole"},"title":{"type":"string","minLength":1,"maxLength":60},"summary":{"type":"string","minLength":1,"maxLength":160}},"required":["path","role","summary"],"additionalProperties":false}},"required":["id","handle","name","description","developer","scopes","listing"],"additionalProperties":false},"AppListEncoded":{"type":"object","properties":{"apps":{"type":"array","items":{"$ref":"#/components/schemas/AppEncoded"}}},"required":["apps"],"additionalProperties":false},"UnauthorizedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["Unauthorized"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"TokenAlreadyUsedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["TokenAlreadyUsed"]},"tokenId":{"type":"string"}},"required":["_tag","tokenId"],"additionalProperties":false},"RequestLogUnavailableEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["RequestLogUnavailable"]},"tokenId":{"type":"string"},"reason":{"type":"string"}},"required":["_tag","tokenId","reason"],"additionalProperties":false},"TenantRequiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["TenantRequired"]},"userId":{"type":"string"}},"required":["_tag","userId"],"additionalProperties":false},"ScopeRequiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ScopeRequired"]},"required":{"type":"array","items":{"type":"string"}}},"required":["_tag","required"],"additionalProperties":false},"PlatformAdminRequiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PlatformAdminRequired"]},"userId":{"type":"string"}},"required":["_tag","userId"],"additionalProperties":false},"SubscriptionRequiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["SubscriptionRequired"]},"status":{"type":"string"}},"required":["_tag","status"],"additionalProperties":false},"MirroredFromSourceEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["MirroredFromSource"]},"source":{"type":"string"}},"required":["_tag","source"],"additionalProperties":false},"TenantId":{"type":"string","pattern":"^org_(test_)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"An org-prefixed uuid, e.g. org_9f8c1c2e-0000-4000-8000-000000000000; a sandbox tenant is org_test_<uuid>"},"InsId":{"type":"string","pattern":"^ins_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A ins-prefixed uuid, e.g. ins_9f8c1c2e-0000-4000-8000-000000000000"},"InstallationStatus":{"type":"string","enum":["installed","uninstalled"],"description":"`installed` — the app may act in the tenant with its granted scopes; `uninstalled` — the tenant removed it: its tokens are refused, and only a new install grants it again"},"AppConsentVia":{"type":"string","enum":["consent-card","onboarding"],"description":"Where the person consented to an install made in Manifold: `consent-card` — the admin's install screen, showing what the app asks for (every app); `onboarding` — the setup walk's picker, where choosing a first-party app is the consent (first-party apps only)"},"InstallationRetirementStatus":{"type":"string","enum":["draining","retired"],"description":"A legacy platform's installation after go-live: `draining` — the organization went live at the cutoff and the app is finishing its sync up to it; its tokens still mint; `retired` — the app reported its drain done; no token is minted for it again (403 `AppRetired`)"},"InstallationEncoded":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/InsId"},"appId":{"$ref":"#/components/schemas/AppId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"status":{"$ref":"#/components/schemas/InstallationStatus"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"installedBy":{"type":"string","minLength":1},"consentedThrough":{"type":"string"},"consentVia":{"$ref":"#/components/schemas/AppConsentVia"},"installedAt":{"type":"string"},"uninstalledAt":{"type":"string"},"retirement":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/InstallationRetirementStatus"},"cutoff":{"type":"string"},"since":{"type":"string"}},"required":["status","cutoff","since"],"additionalProperties":false}},"required":["id","appId","tenantId","status","scopes","installedBy","installedAt"],"additionalProperties":false},"InstallationListEncoded":{"type":"object","properties":{"installations":{"type":"array","items":{"$ref":"#/components/schemas/InstallationEncoded"}}},"required":["installations"],"additionalProperties":false},"NotAMemberEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["NotAMember"]}},"required":["_tag"],"additionalProperties":false},"AdminRequiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AdminRequired"]}},"required":["_tag"],"additionalProperties":false},"View":{"type":"string","enum":["back-office","reporting","pick-pack","receiving","stocktake","pos","b2b-order-form","support-desk","ops-board"],"description":"An entire interface a session is opened in: `back-office` (the admin), `reporting`, the `pick-pack`, `receiving` and `stocktake` stations, the `pos` register, the `b2b-order-form`, the `support-desk` or the `ops-board`."},"GrantExceedsYoursEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["GrantExceedsYours"]},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"views":{"type":"array","items":{"$ref":"#/components/schemas/View"}}},"required":["_tag","scopes","views"],"additionalProperties":false},"OnboardingConsentFirstPartyOnlyEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["OnboardingConsentFirstPartyOnly"]},"appId":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"AppHasNoOnboardingEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AppHasNoOnboarding"]},"appId":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"OrganizationAlreadyLiveEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["OrganizationAlreadyLive"]},"appId":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"AppNotFoundEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AppNotFound"]},"appId":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"InvalidInstallEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InvalidInstall"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AppNotInstalledToRemoveEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AppNotInstalled"]},"appId":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"AppLaunchEncoded":{"type":"object","properties":{"url":{"type":"string"},"token":{"type":"string"},"expiresAt":{"type":"string"}},"required":["url","token","expiresAt"],"additionalProperties":false},"OnboardingLaunchNeedsSetupEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["OnboardingLaunchNeedsSetup"]},"appId":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"AppNotInstalledToOpenEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AppNotInstalled"]},"appId":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"InstallationRetiringEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InstallationRetiring"]},"appId":{"type":"string"},"status":{"$ref":"#/components/schemas/InstallationRetirementStatus"}},"required":["_tag","appId","status"],"additionalProperties":false},"AppIdentityClaimInvalidEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ClaimInvalid"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AppCannotAssertIdentityEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AppCannotAssertIdentity"]},"appId":{"type":"string"},"reason":{"type":"string"}},"required":["_tag","appId","reason"],"additionalProperties":false},"NotAMemberOfClaimedOrganizationEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["NotAMember"]},"organizationId":{"type":"string"},"reason":{"type":"string"}},"required":["_tag","organizationId","reason"],"additionalProperties":false},"AppIdentityOrganizationRefusedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["OrganizationRefused"]},"organizationId":{"type":"string"},"reason":{"type":"string"}},"required":["_tag","organizationId","reason"],"additionalProperties":false},"AppIdentityLinkedElsewhereEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AppIdentityLinkedElsewhere"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AppIdentityDisabledEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AppIdentityDisabled"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AppIdentityUserBannedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["UserBanned"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AppIdentityNotLinkedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["NotLinked"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"JoinRequestNotYoursEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["JoinRequestNotYours"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"JoinRequestNotNeededEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["JoinRequestNotNeeded"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AssignableRole":{"type":"string","enum":["fulfilment","receiving","stock-control","purchasing","merchandising","finance","store","wholesale-rep","sales-manager","analyst","data-migration","support","ops-lead"],"description":"A role an administrator assigns to a member: fulfilment, receiving, stock-control, purchasing, merchandising, finance, store, wholesale-rep, sales-manager, analyst, data-migration, support or ops-lead (governance roles are membership, never assigned)."},"Role":{"type":"string","enum":["owner","admin","fulfilment","receiving","stock-control","purchasing","merchandising","finance","store","wholesale-rep","sales-manager","analyst","data-migration","support","ops-lead"],"description":"A fixed bundle of scopes and views. `owner` and `admin` come from membership and hold everything; the rest (fulfilment, receiving, stock-control, purchasing, merchandising, finance, store, wholesale-rep, sales-manager, analyst, data-migration, support, ops-lead) are assigned."},"UsrId":{"type":"string","pattern":"^usr_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A usr-prefixed uuid, e.g. usr_9f8c1c2e-0000-4000-8000-000000000000"},"InvalidRolesEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InvalidRoles"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"MemberNotFoundEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["NotAMember"]},"userId":{"type":"string"}},"required":["_tag","userId"],"additionalProperties":false},"MembershipDeactivatedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["MembershipDeactivated"]}},"required":["_tag"],"additionalProperties":false},"OwnerRequiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["OwnerRequired"]}},"required":["_tag"],"additionalProperties":false},"InvalidReasonEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InvalidReason"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"CannotDeactivateSelfEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["CannotDeactivateSelf"]}},"required":["_tag"],"additionalProperties":false},"LastVerifiedOwnerEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["LastVerifiedOwner"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"TenantMode":{"type":"string","enum":["read-only","live"],"description":"Whether Manifold may write outside itself for a tenant: `read-only` (running beside the system it is replacing — nothing is pushed to a sales channel or a ledger, mailed to its customers or suppliers, or delivered to an app) or `live` (an owner or admin accepted it, and outbound work runs). A sandbox is always `read-only`"},"SandboxNeverLiveEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["SandboxNeverLive"]}},"required":["_tag"],"additionalProperties":false},"PlanRequiredToGoLiveEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PlanRequiredToGoLive"]},"appId":{"type":"string"},"plansUrl":{"type":"string"}},"required":["_tag","appId"],"additionalProperties":false},"OpeningStocktakeIncompleteEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["OpeningStocktakeIncomplete"]},"stocktakeId":{"type":"string"},"missing":{"type":"integer","minimum":0},"skus":{"type":"array","items":{"type":"string"}}},"required":["_tag","stocktakeId","missing","skus"],"additionalProperties":false},"PlanCheckUnavailableEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PlanCheckUnavailable"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"OpeningStocktakeUnavailableEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["OpeningStocktakeUnavailable"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"GoLiveIsFinalEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["GoLiveIsFinal"]}},"required":["_tag"],"additionalProperties":false},"AgentClientNotFoundEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AgentClientNotFound"]},"clientId":{"type":"string"}},"required":["_tag","clientId"],"additionalProperties":false},"AgentGrantEmptyEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AgentGrantEmpty"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AgentAuthorizationInvalidEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AgentAuthorizationInvalid"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AgentGrantNotFoundEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AgentGrantNotFound"]},"clientId":{"type":"string"},"userId":{"type":"string"}},"required":["_tag","clientId","userId"],"additionalProperties":false},"GridKey":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,63}$","description":"The grid a layout is for: a lower-case slug of at most 64 characters, as the admin names its lists (`orders`, `quotes`)."},"InvalidGridLayoutEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InvalidGridLayout"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"RedeemNativeHandoffEncoded":{"type":"object","properties":{"code":{"type":"string","minLength":32,"maxLength":128},"verifier":{"type":"string","pattern":"^[A-Za-z0-9\\-._~]{43,128}$"}},"required":["code","verifier"],"additionalProperties":false},"SocialProvider":{"type":"string","enum":["google","apple"],"description":"A social sign-in: `google` — Sign in with Google; `apple` — Sign in with Apple (the web's Services ID, and the iOS app's bundle id for a native identity token)."},"NativeHandoffInvalidEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["NativeHandoffInvalid"]}},"required":["_tag"],"additionalProperties":false},"CloseAccountEncoded":{"type":"object","properties":{"confirm":{"type":"string","maxLength":64}},"required":["confirm"],"additionalProperties":false},"AccountClosureUnconfirmedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AccountClosureUnconfirmed"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"AccountClosureBlockedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AccountClosureBlocked"]},"reason":{"type":"string"},"organizations":{"type":"array","items":{"type":"object","properties":{"organizationId":{"type":"string"},"name":{"type":"string"}},"required":["organizationId","name"],"additionalProperties":false}}},"required":["_tag","reason","organizations"],"additionalProperties":false},"AccountClosureRefusedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["AccountClosureRefused"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"StnId":{"type":"string","pattern":"^stn_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A stn-prefixed uuid, e.g. stn_9f8c1c2e-0000-4000-8000-000000000000"},"StationView":{"type":"string","enum":["pick-pack","receiving","stocktake","pos"],"description":"A view that runs on an enrolled station rather than a person's own device: the `pick-pack` bench, the `receiving` (goods-in) scanner, the `stocktake` counter, or the `pos` register."},"LocId":{"type":"string","pattern":"^loc_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A loc-prefixed uuid, e.g. loc_9f8c1c2e-0000-4000-8000-000000000000"},"StationName":{"type":"string","pattern":"^\\S[\\s\\S]*\\S$|^\\S$|^$","minLength":1,"maxLength":80,"description":"What the station is called: trimmed, 1–80 characters (\"Bench 2\", \"Front counter\")."},"StationUnlockMethod":{"type":"string","enum":["pin"],"description":"How a person unlocked a station: `pin` (their station PIN for the organization)."},"StationCredential":{"type":"string","minLength":20,"maxLength":200,"description":"The enrolled device's own credential (`<stationId>.<secret>`): issued once at enrolment, hashed at rest, ended by revoking the station."},"ViewNotOpenedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ViewNotOpened"]},"view":{"$ref":"#/components/schemas/View"}},"required":["_tag","view"],"additionalProperties":false},"InvalidStationEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InvalidStation"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"StationIdTakenEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["StationIdTaken"]},"stationId":{"type":"string"},"reason":{"type":"string"}},"required":["_tag","stationId","reason"],"additionalProperties":false},"StationNotFoundEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["StationNotFound"]},"stationId":{"type":"string"}},"required":["_tag","stationId"],"additionalProperties":false},"StationPin":{"type":"string","pattern":"^[0-9]{4,8}$","description":"A person's station PIN for one organization: 4 to 8 digits, hashed at rest, never shown again."},"InvalidStationPinEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InvalidStationPin"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"StationCredentialInvalidEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["StationCredentialInvalid"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"StationUnlockRefusedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["StationUnlockRefused"]},"reason":{"type":"string"},"attemptsLeft":{"type":"integer","minimum":0}},"required":["_tag","reason"],"additionalProperties":false},"StationPinLockedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["StationPinLocked"]},"until":{"type":"string"}},"required":["_tag","until"],"additionalProperties":false},"StationLockedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["StationLocked"]},"until":{"type":"string"}},"required":["_tag","until"],"additionalProperties":false},"PagId":{"type":"string","pattern":"^pag_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A pag-prefixed uuid, e.g. pag_9f8c1c2e-0000-4000-8000-000000000000"},"PrintAgentName":{"type":"string","pattern":"^\\S[\\s\\S]*\\S$|^\\S$|^$","minLength":1,"maxLength":80,"description":"What the print agent is called: trimmed, 1–80 characters (\"Dispatch PC\", \"Back office Mac\")."},"PrintAgentsNotManagedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PrintAgentsNotManaged"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"PrintAgentCredential":{"type":"string","minLength":20,"maxLength":200,"description":"The print agent's own credential (`<agentId>.<secret>`): issued once at enrolment, hashed at rest, ended by revoking the agent."},"InvalidPrintAgentEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InvalidPrintAgent"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"PrintAgentIdTakenEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PrintAgentIdTaken"]},"agentId":{"type":"string"},"reason":{"type":"string"}},"required":["_tag","agentId","reason"],"additionalProperties":false},"PrintAgentNotFoundEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PrintAgentNotFound"]},"agentId":{"type":"string"}},"required":["_tag","agentId"],"additionalProperties":false},"PrintAgentCredentialInvalidEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PrintAgentCredentialInvalid"]},"reason":{"type":"string"}},"required":["_tag","reason"],"additionalProperties":false},"UnknownViewEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["UnknownView"]},"view":{"type":"string"}},"required":["_tag","view"],"additionalProperties":false},"NoActiveOrganizationEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["NoActiveOrganization"]}},"required":["_tag"],"additionalProperties":false},"ViewNeedsStationEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ViewNeedsStation"]},"view":{"$ref":"#/components/schemas/View"}},"required":["_tag","view"],"additionalProperties":false},"OrganizationOrigin":{"type":"string","enum":["web","app","partner","sandbox"],"description":"The channel an organization was created through: `web` (signed up on the website or by an agent), `app` (created by an app's install — the fact names the app and the external account it was installed for), `partner` (a partner created it for a client) or `sandbox` (a test tenant)."},"CellId":{"type":"string","enum":["au","uk","us"],"description":"The cell an organisation's data lives in — one region's deployment of the tenant-data services: `au` (Sydney, the default), `uk` (London) or `us` (Ohio)."},"PlkId":{"type":"string","pattern":"^plk_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A plk-prefixed uuid, e.g. plk_9f8c1c2e-0000-4000-8000-000000000000"},"PartnerRole":{"type":"string","enum":["owner","admin","member"],"description":"A partner staff member's role in the partner's own organization: `owner`, `admin` or `member` — never a role in a client."},"PinvId":{"type":"string","pattern":"^pinv_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A pinv-prefixed uuid, e.g. pinv_9f8c1c2e-0000-4000-8000-000000000000"},"EvtId":{"type":"string","pattern":"^evt_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A evt-prefixed uuid, e.g. evt_9f8c1c2e-0000-4000-8000-000000000000"},"TxId":{"type":"string","pattern":"^tx_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A tx-prefixed uuid, e.g. tx_9f8c1c2e-0000-4000-8000-000000000000"},"CplId":{"type":"string","pattern":"^cpl_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A cpl-prefixed uuid, e.g. cpl_9f8c1c2e-0000-4000-8000-000000000000"},"Actor":{"anyOf":[{"type":"object","properties":{"_tag":{"type":"string","enum":["user"]},"id":{"$ref":"#/components/schemas/UsrId"},"impersonatedBy":{"type":"string","minLength":1},"viaPartner":{"type":"string","minLength":1}},"required":["_tag","id"],"additionalProperties":false},{"type":"object","properties":{"_tag":{"type":"string","enum":["system"]},"id":{"type":"string","minLength":1}},"required":["_tag","id"],"additionalProperties":false},{"type":"object","properties":{"_tag":{"type":"string","enum":["app"]},"id":{"$ref":"#/components/schemas/AppId"},"installationId":{"$ref":"#/components/schemas/InsId"}},"required":["_tag","id","installationId"],"additionalProperties":false},{"type":"object","properties":{"_tag":{"type":"string","enum":["customer"]},"id":{"$ref":"#/components/schemas/CplId"}},"required":["_tag","id"],"additionalProperties":false}]},"auth.signed-inEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.signed-in"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"email":{"type":"string"}},"required":["userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"CountryCode":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2, upper case"},"auth.org-createdEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.org-created"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string"},"userId":{"type":"string","minLength":1},"origin":{"$ref":"#/components/schemas/OrganizationOrigin"},"appId":{"$ref":"#/components/schemas/AppId"},"account":{"type":"object","properties":{"externalId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1}},"required":["externalId","name"],"additionalProperties":false},"homeCell":{"$ref":"#/components/schemas/CellId"},"signUpCountry":{"$ref":"#/components/schemas/CountryCode"}},"required":["organizationId","userId","origin"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.org-updatedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.org-updated"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string"},"slug":{"type":"string"}},"required":["organizationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.org-went-liveEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.org-went-live"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.org-set-read-onlyEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.org-set-read-only"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1}},"required":["organizationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.org-deletedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.org-deleted"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"name":{"type":"string"}},"required":["organizationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.member-addedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.member-added"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"email":{"type":"string"},"role":{"type":"string"},"invitationId":{"type":"string","minLength":1}},"required":["organizationId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.member-removedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.member-removed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"email":{"type":"string"}},"required":["organizationId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.member-role-changedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.member-role-changed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"role":{"type":"string","minLength":1}},"required":["organizationId","userId","role"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.member-roles-changedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.member-roles-changed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AssignableRole"}},"grantedBy":{"type":"string","minLength":1}},"required":["organizationId","userId","roles","grantedBy"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.member-deactivatedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.member-deactivated"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"reason":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["organizationId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.member-reactivatedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.member-reactivated"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1}},"required":["organizationId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.invitation-createdEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.invitation-created"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"invitationId":{"type":"string","minLength":1},"email":{"type":"string","minLength":1},"role":{"type":"string"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AssignableRole"}}},"required":["organizationId","invitationId","email","roles"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.invitation-changedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.invitation-changed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"invitationId":{"type":"string","minLength":1},"email":{"type":"string","minLength":1},"role":{"type":"string","minLength":1},"roles":{"type":"array","items":{"$ref":"#/components/schemas/AssignableRole"}}},"required":["organizationId","invitationId","email","role","roles"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.invitation-cancelledEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.invitation-cancelled"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"invitationId":{"type":"string","minLength":1},"email":{"type":"string"}},"required":["organizationId","invitationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.invitation-rejectedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.invitation-rejected"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"invitationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1}},"required":["organizationId","invitationId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.impersonation-startedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.impersonation-started"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"adminUserId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1}},"required":["adminUserId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.impersonation-stoppedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.impersonation-stopped"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"adminUserId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1}},"required":["adminUserId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.user-bannedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.user-banned"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"reason":{"type":"string"},"expiresAt":{"type":"string"}},"required":["userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.user-unbannedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.user-unbanned"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1}},"required":["userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.user-role-changedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.user-role-changed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"role":{"type":"string","minLength":1}},"required":["userId","role"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.user-removedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.user-removed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1}},"required":["userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.agent-connectedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.agent-connected"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"clientId":{"type":"string","minLength":1},"clientName":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}}},"required":["organizationId","userId","clientId","scopes"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.agent-revokedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.agent-revoked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"clientId":{"type":"string","minLength":1},"revokedBy":{"type":"string","minLength":1}},"required":["organizationId","userId","clientId","revokedBy"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.app-installedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.app-installed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"installationId":{"$ref":"#/components/schemas/InsId"},"appId":{"$ref":"#/components/schemas/AppId"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"consentedThrough":{"type":"string","minLength":1},"consentVia":{"$ref":"#/components/schemas/AppConsentVia"}},"required":["organizationId","installationId","appId","scopes"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.app-uninstalledEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.app-uninstalled"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"installationId":{"$ref":"#/components/schemas/InsId"},"appId":{"$ref":"#/components/schemas/AppId"}},"required":["organizationId","installationId","appId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.app-drainingEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.app-draining"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"installationId":{"$ref":"#/components/schemas/InsId"},"appId":{"$ref":"#/components/schemas/AppId"},"cutoff":{"type":"string"}},"required":["organizationId","installationId","appId","cutoff"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.app-retiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.app-retired"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"installationId":{"$ref":"#/components/schemas/InsId"},"appId":{"$ref":"#/components/schemas/AppId"},"cutoff":{"type":"string"}},"required":["organizationId","installationId","appId","cutoff"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.passkey-registeredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.passkey-registered"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"passkeyId":{"type":"string","minLength":1},"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"deviceType":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["userId","passkeyId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.passkey-removedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.passkey-removed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"passkeyId":{"type":"string","minLength":1}},"required":["userId","passkeyId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.grid-layout-setEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.grid-layout-set"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"grid":{"$ref":"#/components/schemas/GridKey"},"order":{"type":"array","items":{"type":"string"}},"hidden":{"type":"array","items":{"type":"string"}}},"required":["userId","grid","order","hidden"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"NhfId":{"type":"string","pattern":"^nhf_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A nhf-prefixed uuid, e.g. nhf_9f8c1c2e-0000-4000-8000-000000000000"},"auth.native-handoff-redeemedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.native-handoff-redeemed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"handoffId":{"$ref":"#/components/schemas/NhfId"},"userId":{"type":"string","minLength":1},"provider":{"$ref":"#/components/schemas/SocialProvider"}},"required":["handoffId","userId","provider"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.account-closedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.account-closed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"organizations":{"type":"array","items":{"type":"string","minLength":1}},"signInMethodsRemoved":{"type":"integer","minimum":0}},"required":["userId","organizations","signInMethodsRemoved"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.station-enrolledEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.station-enrolled"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"stationId":{"$ref":"#/components/schemas/StnId"},"view":{"$ref":"#/components/schemas/StationView"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/StationName"}},"required":["organizationId","stationId","view","locationId","name"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.station-renamedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.station-renamed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"stationId":{"$ref":"#/components/schemas/StnId"},"name":{"$ref":"#/components/schemas/StationName"}},"required":["organizationId","stationId","name"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.station-revokedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.station-revoked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"stationId":{"$ref":"#/components/schemas/StnId"}},"required":["organizationId","stationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.station-unlockedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.station-unlocked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"stationId":{"$ref":"#/components/schemas/StnId"},"userId":{"type":"string","minLength":1},"method":{"$ref":"#/components/schemas/StationUnlockMethod"}},"required":["organizationId","stationId","userId","method"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.station-pin-setEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.station-pin-set"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1}},"required":["organizationId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.station-pin-lockedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.station-pin-locked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"stationId":{"$ref":"#/components/schemas/StnId"},"until":{"type":"string"}},"required":["organizationId","userId","stationId","until"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.station-lockedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.station-locked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"stationId":{"$ref":"#/components/schemas/StnId"},"until":{"type":"string"}},"required":["organizationId","stationId","until"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.print-agent-enrolledEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.print-agent-enrolled"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"agentId":{"$ref":"#/components/schemas/PagId"},"locationId":{"$ref":"#/components/schemas/LocId"},"name":{"$ref":"#/components/schemas/PrintAgentName"}},"required":["organizationId","agentId","locationId","name"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.print-agent-revokedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.print-agent-revoked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"agentId":{"$ref":"#/components/schemas/PagId"}},"required":["organizationId","agentId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.social-account-linkedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.social-account-linked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"accountId":{"type":"string","minLength":1},"providerId":{"type":"string","minLength":1}},"required":["userId","accountId","providerId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.social-account-unlinkedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.social-account-unlinked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"accountId":{"type":"string","minLength":1},"providerId":{"type":"string","minLength":1}},"required":["userId","accountId","providerId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.app-user-linkedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.app-user-linked"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"appId":{"$ref":"#/components/schemas/AppId"},"accountExternalId":{"type":"string","minLength":1},"externalUserId":{"type":"string","minLength":1}},"required":["userId","appId","accountExternalId","externalUserId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.join-requestedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.join-requested"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"appId":{"$ref":"#/components/schemas/AppId"},"accountExternalId":{"type":"string","minLength":1},"externalUserId":{"type":"string","minLength":1}},"required":["organizationId","userId","appId","accountExternalId","externalUserId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.join-request-notifiedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.join-request-notified"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"recipients":{"type":"integer","minimum":0}},"required":["organizationId","userId","recipients"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.join-request-mail-claimedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.join-request-mail-claimed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"recipientId":{"type":"string","minLength":1}},"required":["organizationId","userId","recipientId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.join-request-mailedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.join-request-mailed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"recipientId":{"type":"string","minLength":1}},"required":["organizationId","userId","recipientId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.join-request-mail-failedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.join-request-mail-failed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"recipientId":{"type":"string","minLength":1}},"required":["organizationId","userId","recipientId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-createdEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-created"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"},"name":{"type":"string","minLength":1},"handle":{"type":"string","minLength":1}},"required":["partnerId","name","handle"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-removedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-removed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"}},"required":["partnerId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-bannedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-banned"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"},"reason":{"type":"string","minLength":1}},"required":["partnerId","reason"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-unbannedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-unbanned"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"},"reason":{"type":"string","minLength":1}},"required":["partnerId","reason"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-member-invitedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-member-invited"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"},"invitationId":{"$ref":"#/components/schemas/PinvId"},"email":{"type":"string","minLength":1},"role":{"$ref":"#/components/schemas/PartnerRole"}},"required":["partnerId","invitationId","email","role"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"PartnerInvitationEndedBy":{"type":"string","enum":["invitee","partner"],"description":"Who ended a partner staff invitation without anyone joining: the `invitee` declined, or the `partner` withdrew it."},"auth.partner-invitation-endedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-invitation-ended"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"},"invitationId":{"$ref":"#/components/schemas/PinvId"},"endedBy":{"$ref":"#/components/schemas/PartnerInvitationEndedBy"}},"required":["partnerId","invitationId","endedBy"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-member-joinedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-member-joined"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"},"userId":{"type":"string","minLength":1},"role":{"$ref":"#/components/schemas/PartnerRole"},"invitationId":{"$ref":"#/components/schemas/PinvId"}},"required":["partnerId","userId","role","invitationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-member-removedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-member-removed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"partnerId":{"$ref":"#/components/schemas/PrtId"},"userId":{"type":"string","minLength":1}},"required":["partnerId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-client-createdEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-client-created"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"linkId":{"$ref":"#/components/schemas/PlkId"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/Role"}},"ownerEmail":{"type":"string","minLength":1}},"required":["organizationId","partnerId","linkId","roles","ownerEmail"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-client-handed-overEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-client-handed-over"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"userId":{"type":"string","minLength":1}},"required":["organizationId","partnerId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"SbxId":{"type":"string","pattern":"^sbx_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","description":"A sbx-prefixed uuid, e.g. sbx_9f8c1c2e-0000-4000-8000-000000000000"},"auth.partner-sandbox-createdEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-sandbox-created"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"sandboxId":{"$ref":"#/components/schemas/SbxId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"linkId":{"$ref":"#/components/schemas/PlkId"}},"required":["sandboxId","organizationId","partnerId","linkId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-sandbox-retiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-sandbox-retired"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"sandboxId":{"$ref":"#/components/schemas/SbxId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"}},"required":["sandboxId","organizationId","partnerId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.sandbox-createdEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.sandbox-created"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"sandboxId":{"$ref":"#/components/schemas/SbxId"},"organizationId":{"$ref":"#/components/schemas/TenantId"},"liveOrganizationId":{"$ref":"#/components/schemas/TenantId"}},"required":["sandboxId","organizationId","liveOrganizationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.sandbox-retiredEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.sandbox-retired"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"sandboxId":{"$ref":"#/components/schemas/SbxId"},"organizationId":{"$ref":"#/components/schemas/TenantId"},"liveOrganizationId":{"$ref":"#/components/schemas/TenantId"}},"required":["sandboxId","organizationId","liveOrganizationId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-invitedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-invited"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/Role"}}},"required":["linkId","organizationId","partnerId","roles"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-access-requestedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-access-requested"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"}},"required":["linkId","organizationId","partnerId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-access-approvedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-access-approved"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/Role"}}},"required":["linkId","organizationId","partnerId","roles"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-link-acceptedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-link-accepted"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"}},"required":["linkId","organizationId","partnerId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-link-roles-changedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-link-roles-changed"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/Role"}}},"required":["linkId","organizationId","partnerId","roles"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"PartnerLinkEndedBy":{"type":"string","enum":["client","partner","platform"],"description":"Who ended a partner link: the `client` revoked it, the `partner` left or declined, or the `platform` removed the partner."},"auth.partner-link-endedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-link-ended"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"endedBy":{"$ref":"#/components/schemas/PartnerLinkEndedBy"},"wasActive":{"type":"boolean"}},"required":["linkId","organizationId","partnerId","endedBy","wasActive"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-staff-assignedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-staff-assigned"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"userId":{"type":"string","minLength":1},"roles":{"type":"array","items":{"$ref":"#/components/schemas/Role"}}},"required":["linkId","organizationId","partnerId","userId","roles"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false},"auth.partner-session-startedEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["auth.partner-session-started"]},"eventId":{"$ref":"#/components/schemas/EvtId"},"txId":{"$ref":"#/components/schemas/TxId"},"tenantId":{"$ref":"#/components/schemas/TenantId"},"sequence":{"type":"integer","minimum":0},"occurredAt":{"type":"string"},"source":{"type":"string","minLength":1},"version":{"type":"number","enum":[1]},"actor":{"$ref":"#/components/schemas/Actor"},"correlationId":{"type":"string","minLength":1},"causationId":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"linkId":{"$ref":"#/components/schemas/PlkId"},"organizationId":{"type":"string","minLength":1},"partnerId":{"$ref":"#/components/schemas/PrtId"},"userId":{"type":"string","minLength":1}},"required":["linkId","organizationId","partnerId","userId"],"additionalProperties":false}},"required":["_tag","eventId","txId","tenantId","sequence","occurredAt","source","version","actor","correlationId","payload"],"additionalProperties":false}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"A tenant JWT: sign in through the auth service, choose the organization, then `GET /api/auth/token`. Tokens last 15 minutes."}}},"security":[],"tags":[{"name":"apps","description":"The app catalogue, and the apps an organization has installed."},{"name":"appIdentity","description":"How a first-party app vouches for who a person is: the identity claim it signs, redeemed for an organization or a session."},{"name":"members","description":"Who may do what in the organization: members' assigned roles, and ending or restoring a member's access."},{"name":"mode","description":"Read-only mode: whether Manifold may write outside itself for the organization, and an owner's or admin's decision to go live."},{"name":"team","description":"The organization's people as the setup walk reads them: how many have joined."},{"name":"agents","description":"AI agents (MCP clients) a person has consented into an organization, and how that consent is given and withdrawn."},{"name":"gridLayouts","description":"A person's arrangement of the admin's grids: which columns show, and in what order."},{"name":"nativeSignIn","description":"Social sign-in inside the mobile app: the system browser's session handed to the app by a one-time code."},{"name":"account","description":"A person's own account: closing it, which deactivates, ends and erases rather than deletes."},{"name":"stations","description":"Enrolled stations: devices kept signed in to one view at one location, unlocked by the people who work them."},{"name":"printAgents","description":"Print agents: the program at each site that reaches its printers, signed in as itself."},{"name":"views","description":"Sessions in a personal view: each interface is its own app, and a session is opened in it."},{"name":"events","description":"The auth service's append-only event log."}],"servers":[{"url":"https://auth.getmanifold.io","description":"Production"}]}