Skip to content

Identity, access and policy

Identity, access and policy says who acts, for whom and under what authority. One decision answers every move before it runs: allowed, pending, or refused with a cure.

Capability families

FamilyWhat it does
PrincipalsPeople, agents, Keys and apps, each acting for exactly one Customer org, or for you
Progressive identityAn agent pays for one call with no account, a Key adds a Customer, and an org adds members, Roles and single sign-on
TenancyYou, then each product, then each Customer org, then its principals; each org's records live in its own Namespace
Orgs and membersOrgs, members, invites, join by a checked email domain, teams, seats, single sign-on and directory sync, apps a Customer connects
Roles and permissionsThe Roles you declare and the custom Roles a Customer's admin composes from them; permissions per Verb, per field and per record
MandatesThe chain from a person to an org to an agent to a sub-agent; each link scoped, budgeted, time-boxed and revocable, and narrower than the one above
ApprovalsA person approves a class of move: above an amount, by an agent, or out of hours; the move waits, then runs once
Authority beyond RolesCredentials a person holds, acts reserved to a licensed or legally human party, and the jurisdictions an act is valid in
Parties without accountsA signer, a witness or a counterparty acts once through a single-use link; a grant lets several orgs share one case
Support accessAccess a Customer consents to, time-boxed and recorded read by read, offered as Verbs for your operator console

One decision, three answers

Every move asks one question. May this principal, under this mandate, make this Verb on this record, in this state, now, at this price, under these terms and consents?

InputWhere it comes from
The principal, its Roles and its credentialsThis subsystem
The mandate chainThis subsystem, and the buy side of Commerce
The record and its stateModel and records
The Entitlement, the price, the budgetCommerce
Licence termsData and Sources
Consent, residency and the legal floorTrust and operations

The answer's status follows what lifts it, on every Interface.

AnswerWhat the caller getsWhat lifts it
AllowedThe move runs: 200 or 201 with the record, or 202 with its ActionNothing
Pending403 approval_required with an Approval URL; inside a run, the Action waitsA person who approves, signs or supervises
Refused, cured by payment402 with offers, each with its Stripe Checkout link: the OFFER shape, a price to go on atA payment, then the same call
Refused, by the clock429 with Retry-AfterTime
Refused, by authority or state403 role_required or not_entitled, 409 wrong_state with allowedAnother member, another plan, or another move first

The same decision governs a Customer's own agent spending its budget with other sellers.

Lifecycles and states

ThingStatesWhat moves it
A memberinvited, active, suspended, removedAn admin's invite, the member's accept, an admin or directory sync; a removal is restorable
A Keyactive, rolled, revokedA roll keeps the old secret answering for its grace period; a revoke ends it at once
A mandateactive, suspended, then exhausted, expired or revokedSpend, time or its issuer; revoking a link revokes every link below it
An approvalrequested, then granted, declined or expiredThe approver; a grant resumes the waiting move once
A support grantrequested, consented, active, endedThe Customer's admin consents; the time box ends it
A single-use linksent, then used or expiredThe party's one act

Every move above is a Verb and writes its Event, so Mandate.revoked and Approval.granted reach a Watch like any other.

What you declare, what the platform does

You declareThe platform does
Roles, and what each seesApplies each Role to every read, list, search, view, metric and export, on every Interface
A Role on a move or a stepAnswers 403 role_required to anyone without it, and routes a human step to someone with it
Approvals by class of moveHolds the move, sends the Approval URL, and runs it once on the grant
What agents may do aloneRequires a mandate on every agent call, checks each link, and holds the moves you reserve for a person
Credentials and reserved actsSends a reserved act to its person through a single-use link, and records who made it
Nothing elseOrgs, invites, seats, single sign-on, directory sync, Keys, OAuth for apps, support access, and the record of every decision

Example

Reps see their own Deals, a manager sees all of them, and a win an agent proposes waits for a person.

definition.ts
20 lines
import { define } from 'apis.dev'

/** Deals for each Customer, kicked off when won. */
export default define({
  name: 'pipeline', domain: 'pipeline.apis.dev',
  …
  roles: {
    rep:     { see: { Deal: 'own' } },             // a rep sees the Deals they opened
    manager: { has: 'rep', see: { Deal: 'all' } },
  },
  Deal: {
    title: 'string', amount: 'decimal(12,2)', company: '->Company.deals',
    stage: {
      open: [], qualify: 'opened', lose: ['opened', 'qualified'],
      win: { in: 'qualified', role: 'manager', approve: { above: { amount: 50000 } } },
    },
  },
  agents: { approve: ['Deal.win'] },               // an agent's win waits for its person
  offer: { Team: { month: 49, seats: 5, seat: 9 }, 'Deal.open': 0.001 },
})
Response
HTTP/1.1 403 Forbidden
Content-Type: application/problem+json
X-Cost: price=0, currency="USD"
X-Request-Id: req_7c1e09b3a4d2f6e85b10

{
  "type": "https://pipeline.apis.dev/docs/errors#approval_required",
  "title": "Forbidden",
  "status": 403,
  "detail": "An agent's Deal.win waits for its person to approve.",
  "code": "approval_required",
  "approval": "https://pipeline.apis.dev/approvals/apr_1",
  "mandate": ["dana@acme.com", "org_acme", "agent_7"],
  "instance": "req_7c1e09b3a4d2f6e85b10"
}

Contracts with the other subsystems

SubsystemWhat it gives this oneWhat this one gives back
Definition and compileRoles, the Role on each move, approvals, the agent policy, the extension policyWho may deploy, and who may extend each Customer's layer
Model and recordsThe record, its state and its RelationshipsA mask on every field and record a principal may not see, applied before any projection answers
Data and SourcesLicence terms; each Customer's IntegrationsThe Customer's consent to connect, held as a grant and revocable
RuntimeOne request per move, at the gate's decide stepOne answer, which the gate renders and records
WorkCredentials, licensed Roles, cases that span orgsWho may claim, review, supervise or sign; single-use links for parties without accounts
CommerceEntitlements, the price, budgets, buy-side mandatesThe mandate chain, which Commerce narrows at every hop and a seller verifies
Interfaces and distributionEvery call and message, from every InterfaceThe answer for each Interface; the allowed and refused moves in the affordance contract
Trust and operationsResidency, consent, brakesEvery decision as evidence: what was enforced, on which input, and why

What Customers and their agents meet

  • An admin's setup. Create the org, invite members, set Roles and connect single sign-on, through the API, the portal or MCP.
  • A member's view. Each member sees only what their Role allows, in every list, search and metric. An empty result carries its reason.
  • An agent's mandate. An agent presents its mandate on every call, a signed statement the seller verifies, carried over MCP with its OAuth token. Past its scope or budget it is refused with a cure, and a person's approval resumes it.
  • A party without an account. A signer or a counterparty gets a single-use link, makes one act, and the record shows who made it.
  • Support, by consent. A Customer's admin grants support access for a time box and reads each access as it happens.

Every move, from a person, an agent or an app, meets the same one decision and gets the same three answers.