```yaml
product: AlterLab
title: Organizations API Reference
category: api
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/docs/api/generated/organizations
```

# Organizations API Reference

Auto-generated API reference for organizations endpoints, built from the OpenAPI spec.

## GET /api/v1/organizations

List Organizations
List all organizations the current user is a member of.

Authentication: `Authorization: Bearer <session token>`

## POST /api/v1/organizations

Create Organization
Create a new organization.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `name` | body | `string` | yes | Name |
| `description` | body | `string` | no |  |

## GET /api/v1/organizations/default

Get Default Organization
Get the user's default organization.

Authentication: `Authorization: Bearer <session token>`

## POST /api/v1/organizations/default

Set Default Organization
Set the user's default organization.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `organization_id` | body | `string` | yes | Organization Id |

## GET /api/v1/organizations/invitations/{token}

Get Invitation By Token
Get invitation details by token (public endpoint).

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `token` | path | `string` | yes |  |

## POST /api/v1/organizations/invitations/{token}/accept

Accept Invitation
Accept an invitation to join an organization.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `token` | path | `string` | yes |  |

## POST /api/v1/organizations/invitations/{token}/decline

Decline Invitation
Decline an invitation.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `token` | path | `string` | yes |  |

## DELETE /api/v1/organizations/{org_id}

Delete Organization
Delete an organization. Requires owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## GET /api/v1/organizations/{org_id}

Get Organization
Get organization details.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |

## PATCH /api/v1/organizations/{org_id}

Update Organization
Update organization details. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |
| `name` | body | `string` | no |  |
| `description` | body | `string` | no |  |
| `avatar_url` | body | `string` | no |  |
| `settings` | body | `object` | no |  |
| `tenant_config` | body | `object` | no | Typed shape for Organization.tenant_config JSONB column. Used to validate updates to tenant_config and to document the expected schema for downstream B2B features. All fields are optional — omitted fields mean 'use platform default'. |

## GET /api/v1/organizations/{org_id}/audit-logs

Get Organization Audit Logs
Get organization audit logs. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `action` | query | `string` | no | Filter by action type |
| `actor_id` | query | `string` | no | Filter by actor |
| `limit` | query | `integer` | no | Number of entries to return |
| `offset` | query | `integer` | no | Number of entries to skip |
| `X-Organization-Id` | header | `string` | no |  |

## POST /api/v1/organizations/{org_id}/beta-features/{slug}/disable-all

Disable a beta feature for all org members
Bulk-disables a beta feature for all current organization members by removing their ``user_beta_features`` rows. Requires admin or owner role. Individual members can re-enable the feature themselves afterwards. GA features cannot be disabled — they are always enabled for everyone.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `slug` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## POST /api/v1/organizations/{org_id}/beta-features/{slug}/enable-all

Enable a beta feature for all org members
Bulk-enables a beta feature for all current organization members by creating ``user_beta_features`` rows for members who do not already have the feature enabled. Requires admin or owner role. Only works for features with status ``beta`` — hidden features cannot be bulk-enabled; GA features are already enabled for everyone. Members who join the organization after this call must opt in individually.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `slug` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## GET /api/v1/organizations/{org_id}/billing-identity

Get Billing Identity
Get the org's billing identity: legal name, address, tax IDs. Personal orgs resolve to the user's self-serve billing_customer; team orgs resolve to the org-keyed billing_customer. Requires org membership (any role) to view.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## PUT /api/v1/organizations/{org_id}/billing-identity

Update Billing Identity
Update the org's billing identity and write it through to Stripe. Requires admin or owner role. Stripe is updated first, and the DB write only happens after Stripe accepts the change — but the DB is *not* guaranteed untouched on failure. If the Stripe write-through raises `StripeError`, the `except` block below does a best-effort reconciliation: it re-reads whatever Stripe actually holds for every field this request touched and persists that into the DB, so a partial Stripe-side success (e.g. `Customer.modify` committed before a later tax_id call failed) doesn't leave the DB stale. This isn't atomicity — Stripe has no transaction spanning `Customer.modify` and the tax_id sub-resource — it's the DB self-healing to mirror Stripe's true state either way. `Customer.modify` handles name/address; tax_ids uses the Tax IDs sub-resource (create-only via tax_id_data on Customer.create, so updates go through Customer.create_tax_id/delete_tax_id instead).

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |
| `legal_name` | body | `string` | no |  |
| `billing_address` | body | `object` | no | Stripe Address shape. All fields optional — a partial address is valid. |
| `tax_ids` | body | `object[]` | no |  |

## GET /api/v1/organizations/{org_id}/invitations

List Invitations
List pending invitations. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## POST /api/v1/organizations/{org_id}/invitations

Create Invitation
Invite a user to the organization. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |
| `email` | body | `string` | yes | Email |
| `role` | body | `"owner" \| "admin" \| "member"` | no | Organization member roles. |

## DELETE /api/v1/organizations/{org_id}/invitations/{invitation_id}

Cancel Invitation
Cancel a pending invitation. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `invitation_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/resend

Resend Invitation
Resend an invitation email. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `invitation_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## POST /api/v1/organizations/{org_id}/leave

Leave Organization
Leave an organization.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |

## GET /api/v1/organizations/{org_id}/members

List Members
List all members of an organization.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `page` | query | `integer` | no |  |
| `page_size` | query | `integer` | no |  |

## DELETE /api/v1/organizations/{org_id}/members/{member_user_id}

Remove Member
Remove a member from the organization. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `member_user_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |

## PATCH /api/v1/organizations/{org_id}/members/{member_user_id}

Update Member Role
Update a member's role. Requires admin or owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `member_user_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |
| `role` | body | `"owner" \| "admin" \| "member"` | yes | Organization member roles. |

## POST /api/v1/organizations/{org_id}/restore-owner

Restore Owner
Promote an admin to owner of an organization that has no live owner (#34370). An organization becomes ownerless when its only owner's account is soft-deleted: the owner row keeps ``role='owner'`` (so the one-owner index 0392 blocks a second owner), role PATCH/DELETE refuse owner rows, transfer-ownership needs the owner, and the billing resolver raises 409 ``org_billing_misconfigured`` for every member key. An admin restores ownership here: stale owner rows of deleted users are demoted to member and ``new_owner_id`` (a live admin) is promoted, under the same organization row lock as transfer-ownership. Session auth only, so an ownerless org's broken billing resolution cannot block the recovery path.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `new_owner_id` | body | `string` | yes | New Owner Id |

## GET /api/v1/organizations/{org_id}/stats

Get Organization Stats
Get organization statistics.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |

## POST /api/v1/organizations/{org_id}/transfer-ownership

Transfer Ownership
Transfer organization ownership to another member. Requires owner role.

Authentication: `Authorization: Bearer <session token>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `org_id` | path | `string` | yes |  |
| `X-Organization-Id` | header | `string` | no |  |
| `new_owner_id` | body | `string` | yes | New Owner Id |
