Orgs


POST /orgs

Create an organization

Auth: Bearer token required

Request body (application/json)

FieldTypeDescription
namestring(required)
slugstring(required)

Responses

StatusDescriptionSchema
201Created organizationOrganization

GET /orgs/{id}

Get an organization by id or slug

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring

Responses

StatusDescriptionSchema
200The organizationOrganization
404Organization not foundError

DELETE /orgs/{id}

Delete an organization

Owner only.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring

Responses

StatusDescriptionSchema
200Deleted organizationobject
401UnauthorizedError
403Forbidden (not owner)Error
404Organization not foundError

GET /orgs/{id}/users

List organization members

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring

Responses

StatusDescriptionSchema
200Org membersOrgUserList
404Organization not foundError

POST /orgs/{id}/users

Provision and add a member

Owner/admin only. Provisions (or upserts) a user and adds them to the org with the given role.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring

Request body (application/json)

FieldTypeDescription
emailstring(email)(required)
namestring(required)
roleowner | admin | member

Responses

StatusDescriptionSchema
201Added memberobject
401UnauthorizedError
403Forbidden (member role)Error
404Organization not foundError

PATCH /orgs/{id}/users/{userId}

Change a member's role

Owner/admin only. Cannot demote the last owner.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring
userIdstring

Request body (application/json)

FieldTypeDescription
roleowner | admin | member(required)

Responses

StatusDescriptionSchema
200Updated memberobject
400Cannot demote the last ownerError
401UnauthorizedError
403Forbidden (member role)Error
404Member not foundError

DELETE /orgs/{id}/users/{userId}

Remove a member

Owner/admin only. Cascades project memberships and personal tokens scoped to the org. Cannot remove the last owner.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring
userIdstring

Responses

StatusDescriptionSchema
200Member removedobject
400Cannot remove the last ownerError
401UnauthorizedError
403Forbidden (member role)Error
404Member not foundError

POST /orgs/{id}/leave

Leave an organization

The current user removes themselves. The last owner cannot leave.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring

Responses

StatusDescriptionSchema
200Left the orgobject
400Last owner cannot leaveError
401UnauthorizedError
404Not a memberError

GET /orgs/{id}/sso-extras

List org SSO extras

Owner/admin only. Per-provider settings (e.g. forceSso) not covered by the better-auth SSO plumbing.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring

Responses

StatusDescriptionSchema
200SSO extrasOrgSsoExtraList
401UnauthorizedError
403Forbidden (member role)Error

PATCH /orgs/{id}/sso-extras/{providerId}

Toggle force-SSO for an org SSO provider

Owner/admin only.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstring
providerIdstring

Request body (application/json)

FieldTypeDescription
forceSsoboolean(required)

Responses

StatusDescriptionSchema
200Updated SSO extraobject
401UnauthorizedError
403Forbidden (member role)Error
404Provider not foundError

Schemas

Error

FieldTypeDescription
errorstring(required)
codestring

OrgSsoExtraList

Type: object[]

OrgUserList

Type: object[]

Organization

FieldTypeDescription
idstring(required)
namestring(required)
slugstring(required)
createdAtstring | string(required)