Skip to main content
The organization API is the set of endpoints under /v1/orgs/{orgName}/. Use it from a script to invite and remove members, change roles, read the audit log and set a factory’s control plane. {orgName} is the organization’s name as it appears in the dashboard URL, /orgs/<orgName>/. Case does not matter.

Before you start

  • You need an Enterprise plan. A script calls these endpoints with a management API key (olk_...), and only an Enterprise organization can create one.
  • You need the owner or admin role to create a key.
A factory key (sk_outerlayer_...) or a login token (olu_...) never works on these endpoints. See Authenticate for every credential.

Create a management API key

OuterLayer shows the key once, so copy it when you create it.
  1. Open the organization’s Settings → Management API keys.
  2. Choose Create key.
  3. Enter a Name for what will use the key.
  4. Tick the permissions the key needs. You can grant only permissions you hold.
  5. Choose Create, then copy the key before you choose Done.
Send the key as a bearer token:

What a key can do

  • A key never does more than the member who created it can do now.
  • If the creator moves to a lower role, the key loses the permissions that role lacks.
  • A key answers 403 when its creator has left the organization or holds a custom role.
  • Create keys as a member with a built-in role who will stay.

Rotate or revoke a key

To rotate a key:
  1. Create a new key.
  2. Move your script to the new key.
  3. Revoke the old key in the same tab.
After an organization leaves Enterprise, its keys are refused with 402. The menu then hides the tab, but you can still revoke the keys. Open /orgs/<orgName>/settings/management-api-keys to revoke them.

Permissions

A management key carries organization permissions only. Each endpoint needs one: The key dialog also offers roles.insert, roles.update and roles.delete. No endpoint in this API uses them.

Members and roles

Use the membershipId from the member list or from the invite answer as {inviteId}. Use the member’s id from the member list as {userId}. The built-in roles are owner, admin, write, read, disabled and guest. To invite someone, send their name, email and role:
The key needs members.insert. A sent invite answers 200 with the new membership’s id:
The invite email goes out at once. Send custom_role_id beside role to give someone a custom role. This works on an invite and on a role change. A role that belongs to another organization is refused with 400 custom_role_not_found. A key acts with the permissions of its creator. A role that gives a permission the creator lacks is refused with 403 role_exceeds_own_permissions. This holds for an invite and for a role change. error.missing_permissions lists the permission names. The refusal stores nothing and sends no email. An invite cannot give access to individual factories. A non-empty appRoles is refused with 400 app_roles_not_supported. Set factory access from Settings → Members once the invite is sent. The guest role is the one exception. A guest is free and reads only the factories you give it, so an invite with "role": "guest" carries appIds, the ids of those factories:
A guest invite with no appIds is refused with 400 guest_requires_factory. A factory of another organization is refused with 400 guest_factory_not_found. A guest has no custom role. You cannot change a guest’s role. The audit log records changes made through the API. See Audit log for who an entry names.

Audit log

The audit log needs an Enterprise plan, whichever credential calls it. The list takes these query parameters, all optional: To see every value of actionType and targetType, export the log. The action and target_type columns hold them. The response carries data and pagination, where pagination.totalPages tells you when to stop. An entry names who made the change:
  • A change made by a signed-in member shows that member’s actor_name and actor_email.
  • A change made with a management key has the actor_type api_key. Its actor_label holds the id of the member who created the key.
The export takes no filters. It holds the oldest 50,000 rows. To read a longer log, page through the list. The columns of the export are timestamp_utc, action, actor_email, actor_label, actor_type, actor_id, target_type, target, target_id, ip_address, user_agent, request_id, details, before_state and after_state.

Control planes

You read, set and remove a factory’s control plane at /v1/orgs/{orgName}/apps/{appId}/context-source. {appId} is the factory’s id. The path keeps the old name context-source. PUT sets a repository that the factory links as its control plane. It answers 201. It takes a JSON body:
repository is owner/name. ref is the ref to read, and it defaults to main. GET answers data: null when no control plane is set. DELETE removes the control plane and answers 204. See Manage it through the API.

Errors

Errors gives the error body and what each status means. These are particular to the organization endpoints: The API reference has the full request and response schema of each call. The Org Management group holds the member, role and audit-log calls. The Context group holds the control-plane calls: Read a factory’s control plane, Designate a factory’s control plane and Revoke a factory’s control plane.