API

JSON over HTTP. Public endpoints need no account; the organization API reads and changes your own organization with a token.

Public endpoints

No token: the blueprint catalogue and the demo organization.

Organization API

Owners and admins create a token under Governance › Settings › API tokens. Every token reads its organization; one with “May record changes” also writes, and costs need “May see and change costs”.

curl https://organizationdatabase.com/api/v1/organization \
  -H "Authorization: Bearer odb_…"
  • GET/api/v1/organizationscope: read

    The organization the token belongs to: name, address, time zone, currency, perspectives and scenarios.

  • GET/api/v1/perspectives/{key}/tree?asOf=&scenario=scope: read

    The organization through one perspective as a tree, on a date or in a scenario.

  • GET/api/v1/nodes?type=&q=&asOf=&scenario=scope: read

    Nodes of one type, or matching a search, in the usual order.

  • GET/api/v1/nodes/{id}?asOf=&scenario=scope: read

    One node with the relations that leave it and arrive at it.

  • GET/api/v1/violations?asOf=&scenario=scope: read

    What the organization's rules report.

  • GET/api/v1/changes?since=&scenario=scope: read

    The change log in order after a seq, 500 at a time, with the seq of the next page.

  • POST/api/v1/changesscope: write

    Records a batch of change operations on one effective date, into the organization or a draft scenario: all or none, with the code of the invariant that refused it.

  • GET/api/v1/scenariosscope: read

    The organization's scenarios and their status.

  • POST/api/v1/scenariosscope: write

    Starts a draft scenario; record changes into it with POST /api/v1/changes and its id. Review, approval and applying stay with people on the screens.

  • GET/api/v1/scenarios/{id}/diff?asOf=scope: read

    What a scenario changes against the organization: nodes and relations added, removed and changed, and the difference in positions, FTE and cost.

Errors are JSON: { error: { code, message } }. 401 without a valid token, 403 without the scope, 402 beyond the plan, 422 when an invariant refuses a change. Changes made through the API are recorded with origin api.

Apps for many organizations (OAuth)

A product used by many organizations asks each one's owner or an admin to allow it, instead of asking for a token. Organization DB speaks OAuth 2.0 with the authorization code and PKCE.

  1. Register the app on your account's page, under Apps: its redirect addresses and what it may ask for. A server app gets a client secret, shown once.
  2. Send the person to /oauth/authorize with response_type=code, your client_id, one of your redirect addresses, the scopes, a state, and an S256 code challenge. They choose an organization they manage and allow the app.
  3. On your redirect address, check the state and exchange the code (valid ten minutes, once) and its code verifier at POST /oauth/token.
  4. Call the organization API with the access token as Authorization: Bearer. It lasts one hour.
  5. Before it ends, exchange the refresh token (grant_type=refresh_token) for a new pair. Each refresh token works once: one used twice ends the app's access to that organization.
GET https://organizationdatabase.com/oauth/authorize
  ?response_type=code&client_id=odb_ci_…
  &redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback
  &scope=read%20people%3Alookup&state=…
  &code_challenge=…&code_challenge_method=S256

curl https://organizationdatabase.com/oauth/token   -u "odb_ci_…:odb_cs_…"   -d grant_type=authorization_code -d code=odb_ac_…   -d redirect_uri=https://app.example.com/callback -d code_verifier=…
  • Scopes: read, write, sensitive and people:lookup. An app that asks only for people:lookup cannot read anything else.
  • A server app sends its client secret in an Authorization: Basic header or as client_secret in the form, not both. A browser or mobile app sends only its client_id; a browser app may call the token endpoint from the site of one of its redirect addresses.
  • Codes last ten minutes and work once; access tokens one hour; refresh tokens 30 days, replaced on every use.
  • Errors come back as error and error_description: on your redirect address for a verified app's refused request, and from the token endpoint as JSON (invalid_request, invalid_client, invalid_grant, unsupported_grant_type). Too many calls answer 429 with Retry-After.
  • A new app is unverified: together, an account's unverified apps reach at most five organizations, and none can allow them sensitive values. Ask for verification on your account's page.

OpenAPI 3.1 description (openapi.json)

Feedback for OrganizationDatabase