Organizations API

Multi-tenant organization management with RBAC, invitations, and SSO support. All endpoints require JWT authentication.

Organization CRUD

POST /api/v1/organizations ๐Ÿ”’
Create a new organization. The authenticated user becomes the owner.

Request Body

FieldTypeRequiredDescription
namestringYesOrganization name
slugstringYesURL-safe slug (unique)
curl -X POST https://api.privabase.com/api/v1/organizations \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Acme Corp", "slug": "acme-corp"}'

Response 201

{
  "success": true,
  "data": {
    "id": "org-uuid",
    "name": "Acme Corp",
    "slug": "acme-corp",
    "createdAt": "2026-03-13T..."
  }
}
GET /api/v1/organizations ๐Ÿ”’
List all organizations the current user belongs to.
GET /api/v1/organizations/:id ๐Ÿ”’
Get organization details.
PUT /api/v1/organizations/:id ๐Ÿ”’
Update organization name or settings. Requires owner or admin role.
DELETE /api/v1/organizations/:id ๐Ÿ”’
Delete an organization. Requires owner role.

Members

GET /api/v1/organizations/:id/members ๐Ÿ”’
List organization members with their roles.
PUT /api/v1/organizations/:id/members/:memberId ๐Ÿ”’
Update a member's role. Requires owner or admin role.

Request Body

{ "role": "admin" }

Available roles: owner, admin, member, viewer

DELETE /api/v1/organizations/:id/members/:memberId ๐Ÿ”’
Remove a member from the organization.

Invitations

POST /api/v1/organizations/:id/invitations ๐Ÿ”’
Invite a user to the organization by email.

Request Body

{ "email": "teammate@company.com", "role": "member" }
GET /api/v1/organizations/:id/invitations ๐Ÿ”’
List pending invitations for the organization.
DELETE /api/v1/organizations/:id/invitations/:inviteId ๐Ÿ”’
Revoke a pending invitation.
POST /api/v1/organizations/invitations/:token/accept
Accept an organization invitation using the invite token.

SSO

GET /api/v1/organizations/:id/sso/metadata ๐Ÿ”’
Get SAML SSO metadata for the organization. Used during SSO configuration. See the SSO Setup Guide.
POST /api/v1/organizations/:id/sso ๐Ÿ”’
Configure SAML SSO for the organization. Requires owner role.

Request Body

{
  "entityId": "https://idp.example.com/saml",
  "ssoUrl": "https://idp.example.com/saml/sso",
  "certificate": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----",
  "emailDomain": "company.com"
}
DELETE /api/v1/organizations/:id/sso ๐Ÿ”’
Disable SSO for the organization.