Orgs


GET /orgs

List organizations the caller is a member of

Auth: Bearer token required

Responses

StatusDescriptionSchema
200OKOrgList
401UnauthorizedError
403ForbiddenError

POST /orgs

Create an organization

Auth: Bearer token required

Request body (application/json)

FieldTypeDescription
namestringDisplay name (required)
slugstringURL slug (lowercase, hyphens only) (required)

Responses

StatusDescriptionSchema
201CreatedOrganization
401UnauthorizedError
403ForbiddenError
409ConflictError

GET /orgs/{id}

Get an organization by id or slug

Org membership required.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Responses

StatusDescriptionSchema
200OKOrganization
401UnauthorizedError
403ForbiddenError
404Not FoundError

PATCH /orgs/{id}

Rename an organization

Org owner/admin only.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Request body (application/json)

FieldTypeDescription
namestringDisplay name (required)

Responses

StatusDescriptionSchema
200OKOrganization
401UnauthorizedError
403ForbiddenError
404Not FoundError

DELETE /orgs/{id}

Delete an organization

Org owner only.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Responses

StatusDescriptionSchema
200OKobject
401UnauthorizedError
403ForbiddenError
404Not FoundError

GET /orgs/{id}/users

List organization members

Org membership required.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Responses

StatusDescriptionSchema
200OKOrgUserList
401UnauthorizedError
403ForbiddenError

POST /orgs/{id}/users

Provision and add a member

Org 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
idstringOrganization ID or slug

Request body (application/json)

FieldTypeDescription
emailstring(email)User email (required)
namestringUser full name (required)
roleowner | admin | memberRole (owner|admin|member)

Responses

StatusDescriptionSchema
201Createdobject
401UnauthorizedError
403ForbiddenError
404Not FoundError

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

Change a member's role

Org owner/admin only. Cannot demote the last owner.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug
userIdstringUser ID

Request body (application/json)

FieldTypeDescription
roleowner | admin | memberNew role (required)

Responses

StatusDescriptionSchema
200OKobject
400Bad RequestError
401UnauthorizedError
403ForbiddenError
404Not FoundError

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

Remove a member

Org 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
idstringOrganization ID or slug
userIdstringUser ID

Responses

StatusDescriptionSchema
200OKobject
400Bad RequestError
401UnauthorizedError
403ForbiddenError
404Not FoundError

POST /orgs/{id}/leave

Leave an organization

Org membership required. The current user removes themselves. The last owner cannot leave.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Responses

StatusDescriptionSchema
200OKobject
400Bad RequestError
401UnauthorizedError
403ForbiddenError

GET /orgs/{id}/sso-extras

List org SSO extras

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

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Responses

StatusDescriptionSchema
200OKOrgSsoExtraList
401UnauthorizedError
403ForbiddenError

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

Toggle force-SSO for an org SSO provider

Org owner/admin only.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug
providerIdstringSSO provider ID

Request body (application/json)

FieldTypeDescription
forceSsobooleanForce-SSO toggle for this provider (required)

Responses

StatusDescriptionSchema
200OKobject
401UnauthorizedError
403ForbiddenError
404Not FoundError

GET /orgs/{id}/invitations

List organization invitations

Org membership required.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Responses

StatusDescriptionSchema
200OKOrgInvitation[]
400Bad RequestError
401UnauthorizedError
403ForbiddenError
404Not FoundError

POST /orgs/{id}/invitations

Invite a user to an organization

Org owner/admin only. Returns a copyable acceptUrl; email delivery is best-effort and never blocks creation.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug

Request body (application/json)

FieldTypeDescription
emailstring(email)Invitee email (required)
roleowner | admin | memberRole to grant on acceptance (required)
resendbooleanRe-send when an invitation already exists

Responses

StatusDescriptionSchema
201CreatedOrgInvitation
400Bad RequestError
401UnauthorizedError
403ForbiddenError
404Not FoundError

DELETE /orgs/{id}/invitations/{invitationId}

Cancel an organization invitation

Org owner/admin only.

Auth: Bearer token required

Path parameters

NameTypeDescription
idstringOrganization ID or slug
invitationIdstringInvitation ID

Responses

StatusDescriptionSchema
200OKobject
401UnauthorizedError
403ForbiddenError
404Not FoundError

POST /orgs/invitations/{token}/accept

Accept an organization invitation

Creates the membership with the invitation's role and marks the invitation accepted. The caller need not already belong to the org — this is how they join it. Pending/expiry/invitee-email checks are in-handler (spec route-contracts #299 §15.3).

Auth: Bearer token required

Path parameters

NameTypeDescription
tokenstringInvitation ID (from its acceptUrl)

Responses

StatusDescriptionSchema
201CreatedOrgInvitationAcceptance
400Bad RequestError
401UnauthorizedError
403ForbiddenError
404Not FoundError

Schemas

Error

FieldTypeDescription
errorstring(required)
codestring

OrgInvitation

FieldTypeDescription
idstring(required)
emailstring(required)
rolestring(required)
statusstring(required)
expiresAtstring(required)
createdAtstring(required)
inviterIdstring(required)
organizationIdstring(required)
acceptUrlstring(required)

OrgInvitationAcceptance

FieldTypeDescription
idstring(required)
organizationIdstring(required)
userIdstring(required)
roleowner | admin | member(required)
createdAtstring | string(required)

OrgList

Type: Organization[]

OrgSsoExtraList

Type: object[]

OrgUserList

Type: object[]

Organization

FieldTypeDescription
idstring(required)
namestring(required)
slugstring(required)
logostring | null(required)
createdAtstring | string(required)
metadataobject | null(required)
suspendedAtstring | string | null(required)