Org admin API

Manage members, invites, roles, projects, audit, billing, SSO and SCIM tokens from a script or Terraform with an account key restricted to one organization.

Embed
Preview of the card
<a href="https://lucidace.com/help/org-admin-api"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/87094cd8-bb2c-4b0c-88b2-8626a3bb4d61/social-card.svg?v=3e7ae33eec8b" alt="Org admin API" width="600" height="315"></a>

Everything an org admin does in Settings for people and access can be done with the API: provision members from a script, rotate SCIM tokens, pull the audit log into your SIEM, or manage client orgs as an agency.

The key

Use an account key (lc_pat_...) restricted to one organization, with the area scopes you need:

Scope

Allows

members:read / members:write

list and read members and open invites; change a role, remove a member, invite, revoke an invite

roles:read / roles:write

list and read roles; create, edit, delete custom roles; assign a custom role to a member

projects

the existing project:read / project:write scopes: list, create, update and delete projects

audit:read

read the audit log, CSV and NDJSON exports, verify the chain

billing:read

plan, usage and quota, invoices

sso:read / sso:write

list and read SSO connections; create, update, delete, verify a domain, enforce

scim:read / scim:write

list SCIM token metadata; issue (shown once) and revoke tokens

write includes read. There is no audit:write or billing:write.

Create it in Personal settings > API keys (tick the scopes, and optionally the organizations it may reach), or with a signed-in session:

POST /v1/me/keys   {"name": "provisioning", "scopes": ["members:write", "roles:read", "audit:read"], "org_ids": ["<org_id>"]}

The secret is shown once; Lucida stores only its hash.

What limits a key

  • Organizations. A key with org_ids answers 404 for any other org. A key with no org_ids reaches every org you belong to, including ones you create with it later.

  • admin is the setup key. An account key holding admin opens every org route your role allows (members, roles, audit, billing, SSO, SCIM, domains, teams, security, org keys) without listing the area scopes. With no org_ids it can also create orgs and mint, rotate and revoke your other account keys (/v1/me/keys), so one key can set up a whole org from start to finish. Any other key calling /v1/me/keys answers 403.

  • Your role is the ceiling, at creation and on every call. You can only hand out a scope your role could use yourself: a plain member cannot mint members:write, sso:read or billing:read (400). If your role drops later, the key drops with it. An admin's key still cannot grant ownership or remove an owner (403); only an owner can.

  • Scopes are exact. A missing scope answers 403 and names it (this key needs the members:write scope). org:write, *:write and admin do not open these routes.

  • Project keys (lc_sk_) never reach them (404).

  • Every change is written to the audit log with the key id.

Routes

All under /v1/orgs/{org_id}. Lists answer {data, next_cursor}. Errors are RFC 9457 problem+json. The OpenAPI document lists each route's x-required-scopes.

Route

Scope

GET /members, GET /members/{user_id}

members:read

PATCH /members/{user_id} {role}, DELETE /members/{user_id}

members:write

GET /invites (no tokens)

members:read

POST /invites {email, role}, DELETE /invites/{id}

members:write

GET /roles, GET /roles/{id}

roles:read

POST /roles, PATCH /roles/{id}, DELETE /roles/{id}, PUT /members/{user_id}/role

roles:write

GET /projects, POST /projects; GET/PATCH/DELETE /v1/projects/{project_id}

project:read / project:write

GET /audit?since=&until=&user_id=&actor_kind=&action=&resource_type=&project_id=&q=, /audit/export, /audit/export.csv, /audit/verify

audit:read

GET /usage (plan, daily usage, limits, quota), GET /billing/invoices

billing:read

POST /billing/checkout {plan: "team" | "business"} (Stripe Checkout URL; owners and admins, session only)

none for keys

GET /v1/plans (public, no key: prices and quotas)

none

PUT /v1/orgs/{org_id}/plan {plan} → {plan, previous} (Stripe, card on file; see Plans and limits)

admin

GET /sso, GET /sso/{id}

sso:read

POST /sso, PATCH /sso/{id}, DELETE /sso/{id}, POST /sso/{id}/verify-domain, PUT /sso/{id}/enforce

sso:write

GET /scim/tokens

scim:read

POST /scim/tokens, DELETE /scim/tokens/{id}

scim:write

SSO secrets are write-only: the OIDC client secret and the SAML certificate are sealed on write and never returned. PATCH /sso/{id} changes the default role, the just-in-time switch and, if you send oidc or saml, replaces the sealed config (the protocol cannot change; to change domains, delete and recreate). Deleting a project, removing the last owner and the other safety rules are the same as in the app.

curl -H "Authorization: Bearer $LUCIDA_ACCOUNT_KEY" https://<your-host>/v1/orgs/$ORG/members
curl -X POST -H "Authorization: Bearer $LUCIDA_ACCOUNT_KEY" -H 'Content-Type: application/json' \
  -d '{"email":"new@example.com","role":"member"}' https://<your-host>/v1/orgs/$ORG/invites

An invite answers the one-time token; deliver it to the invitee yourself (Lucida does not email it from this route).

SCIM

Set up automatic provisioning from your IdP: SCIM setup for Okta, Entra ID and Google.

Updated