Skip to content
# Organizations

Organizations

Team organizations, invites and members.

GET/organizations

List the organizations you belong to.

json
[
  {
    "id": "org_4Nq...",
    "name": "Acme Inc",
    "slug": "acme-inc",
    "role": "owner",
    "isOwner": true
  }
]

role is one of owner, admin, member, billing, read_only.

GET/organizations/{id}

Organization detail with members. Pending invites are included only when your role is owner or admin.

json
{
  "id": "org_4Nq...",
  "name": "Acme Inc",
  "slug": "acme-inc",
  "ownerUserId": "usr_1Ab...",
  "role": "owner",
  "members": [
    {
      "userId": "usr_1Ab...",
      "username": "alice",
      "role": "owner",
      "isOwner": true,
      "joinedAt": "2026-06-01T10:00:00Z"
    }
  ],
  "invites": [
    {
      "id": "inv_9Zx...",
      "email": "[email protected]",
      "role": "member",
      "invitedBy": "usr_1Ab...",
      "expiresAt": "2026-07-08T10:00:00Z",
      "createdAt": "2026-07-01T10:00:00Z"
    }
  ]
}
POST+DELETE/organizations/{id}/invites

Invite a member (owner/admin only, 7-day expiry, emailed to the invitee). DELETE /organizations/{id}/invites/{inviteId} revokes a pending invite. POST /organizations/invites/accept joins the caller using the emailed token.

POST /organizations/{id}/invites → 201
json
{
  "email": "[email protected]",
  "role": "member"
}

→ { "id": "inv_9Zx..." }
POST /organizations/invites/accept → 200
json
{
  "token": "a1b2c3…"
}

→ { "organizationId": "org_4Nq..." }

An already-used invite → 409 invite_already_used; a revoked or expired one → 410 invite_revoked / invite_expired.

PATCH+DELETE/organizations/{id}/members/{userId}

Change a member's role (PATCH) or remove them (DELETE) — owner/admin only. POST /organizations/{id}/leave removes the caller. The organization's owner can't be role-changed, removed, or leave this way — ownership transfer is console-only.

PATCH body → 200
json
{
  "role": "admin"
}

→ { "ok": true }
DELETE / leave → 200
json
{ "ok": true }