ZevAuth
Sign up

API reference

Organizations

Creating teams from your backend, and managing them from your app.

From your backend: secret key

POST /v1/organizations
GET /v1/organizations
GET /v1/organizations/{organizationId}
PATCH /v1/organizations/{organizationId}
DELETE /v1/organizations/{organizationId}
POST /v1/organizations/{organizationId}/members
DELETE /v1/organizations/{organizationId}/members/{userId}

Creating one:

{ "name": "Acme Corp", "slug": "acme", "createdBy": "usr_..." }

createdBy becomes the owner. An organization with no owner is one nobody can administer, so the two are created together.

GET /v1/organizations?userId=usr_... lists what one person belongs to. GET /v1/organizations/{organizationId} returns the organization with its members.

Renaming or changing the image:

{ "name": "Acme", "slug": "acme", "imageUrl": null }

Omitting a field leaves it alone; null clears it. imageUrl must be an image you uploaded through us. We do not load images from other hosts: that host would see everyone who views it, and the file behind a link can change after you set it.

DELETE /v1/organizations/{organizationId} removes the organization and its memberships. The people survive.

No permission check applies to these: a secret key owns the environment, so there is no membership to consult. The equivalent calls made with a session token do check, because there the caller is a person whose standing can change.

Full administrative control over any organization in the environment.

From your app: session token

These act on the organization the session is currently acting as, so there is no id in the path.

GET /v1/me/organizations
PATCH /v1/me/organization
GET /v1/me/organization/members
POST /v1/me/organization/members
PATCH /v1/me/organization/members/{userId}
DELETE /v1/me/organization/members/{userId}

Adding somebody:

{ "email": "colleague@example.com", "role": "member" }

They must already have an account in your environment. If they do not, the error says so. The caller is an authenticated admin adding a colleague, and being vague there would just leave them retyping an address that was never going to work.

Renaming it, or changing its picture:

{ "name": "Acme Corp", "imageUrl": "https://assets.example.com/acme.png" }

This needs org:manage, which is a different permission from org:members:manage. Plenty of teams want people who can invite colleagues without being able to rename the company on every screen in the product.

imageUrl must be https. Send null to remove it; omitting the field leaves it alone. To upload rather than link, ask for a ticket at POST /v1/me/assets/upload-url with purpose: "organization_image", then save the URL it returns here.

Two rules apply to removal:

Anybody may remove themselves. Leaving needs no permission, because an organization you cannot leave is a trap.

The last owner cannot be removed, by anyone including themselves, or the organization would be left with nobody able to administer it.

{ "error": { "code": "organization_last_owner", "message": "Cannot remove the last owner. Transfer ownership first." } }

Creating, leaving and deleting

POST /v1/me/organizations
POST /v1/me/organization/leave
DELETE /v1/me/organization

Creating makes the caller its owner and needs no permission. What it does need is your console’s go-ahead, under Organizations → Settings → Policy:

SettingDefaultEffect
Users can create organizationsonOff means only your backend can, with the secret key
Organizations per userunlimitedA cap on how many one person can have
The limit countsCreatedCreated counts organizations the person started. Belongs to also counts the ones they were invited into
Enable slugsoffA slug sent while slugs are off is refused, not dropped
{ "name": "Acme", "slug": "acme" }

There is also an hourly limit on how many organizations one person can create, whatever your own settings, so a script can’t fill your environment. Ordinary use never reaches it. If yours legitimately does, contact ZevAuth support.

Leaving is the caller removing themselves from the active organization, under the same last-owner rule as above.

Deleting removes the organization and every membership in it. Members’ accounts are kept. It’s governed by two console settings:

SettingDefaultEffect
Deleting from your apponOff means only your backend can delete
Who can deleteAny ownerAny owner is anyone whose role holds org:delete. Creator only is the person who created it, and they must still hold org:delete

With Creator only, organizations your backend created have no creator, so nobody can delete them from your app. Delete those from your backend.

Each refusal carries a code listed in Errors. After creating, leaving or deleting, the session switches scope: to the new organization, or back to the personal account.

Updated at, Tuesday, November 24, 2026