> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Organizations overview

> Manage multi-tenant organizations using the Stytch API.

An Organization represents a tenant in your application - typically each of your business customers. Organizations contain members, authentication settings, and RBAC policies that are isolated from other organizations.

## Organization management

**1. Create an organization**

Create a new organization using the [Create Organization](https://stytch.com/docs/api-reference/b2b/api/organizations/create-organization.md) endpoint:

```bash theme={null}
curl --request POST \
  --url https://test.stytch.com/v1/b2b/organizations \
  --header 'Content-Type: application/json' \
  --user 'PROJECT_ID:SECRET' \
  --data '{
    "organization_name": "Acme Corporation",
    "organization_slug": "acme-corp",
    "email_allowed_domains": ["acme.com"]
  }'
```

**Response:**

```json theme={null}
{
  "status_code": 201,
  "organization": {
    "organization_id": "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
    "organization_name": "Acme Corporation",
    "organization_slug": "acme-corp",
    "email_allowed_domains": ["acme.com"],
    "email_jit_provisioning": "NOT_ALLOWED",
    "email_invites": "ALL_ALLOWED",
    "auth_methods": "ALL_ALLOWED",
    "allowed_auth_methods": [],
    "mfa_policy": "OPTIONAL"
  }
}
```

**2. Update organization settings**

Configure authentication methods, MFA policies, and other settings using the [Update Organization](https://stytch.com/docs/api-reference/b2b/api/organizations/update-organization.md) endpoint:

```bash theme={null}
curl --request PUT \
  --url https://test.stytch.com/v1/b2b/organizations/organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931 \
  --header 'Content-Type: application/json' \
  --user 'PROJECT_ID:SECRET' \
  --data '{
    "mfa_policy": "REQUIRED_FOR_ALL",
    "allowed_auth_methods": ["sso", "magic_link"],
    "email_jit_provisioning": "RESTRICTED",
    "email_allowed_domains": ["acme.com", "acmecorp.com"]
  }'
```

**Key settings:**

* `mfa_policy` - Controls MFA requirements (`OPTIONAL`, `REQUIRED_FOR_ALL`)
* `auth_methods` / `allowed_auth_methods` - Restrict which authentication methods members can use
* `email_jit_provisioning` / `email_allowed_domains` - Configure automatic member provisioning by email domain
* `sso_jit_provisioning` - Enable JIT provisioning for SSO connections

**3. Search organizations**

Find organizations by name, domain, or other criteria using the [Search Organizations](https://stytch.com/docs/api-reference/b2b/api/organizations/search-organizations.md) endpoint:

```bash theme={null}
curl --request POST \
  --url https://test.stytch.com/v1/b2b/organizations/search \
  --header 'Content-Type: application/json' \
  --user 'PROJECT_ID:SECRET' \
  --data '{
    "query": {
      "operator": "AND",
      "operands": [
        {
          "filter_name": "organization_name",
          "filter_value": ["Acme"]
        }
      ]
    }
  }'
```

## Trusted metadata

Organizations support `trusted_metadata` for storing application-specific data:

```bash theme={null}
curl --request PUT \
  --url https://test.stytch.com/v1/b2b/organizations/organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931 \
  --header 'Content-Type: application/json' \
  --user 'PROJECT_ID:SECRET' \
  --data '{
    "trusted_metadata": {
      "subscription_tier": "enterprise",
      "billing_id": "cus_123456",
      "feature_flags": {
        "advanced_analytics": true
      }
    }
  }'
```

**Metadata constraints:**

* Maximum 20 top-level keys
* Cannot exceed 4KB in size
* Backend integrations can read and write
* Frontend integrations can only read

> [!WARNING]
>
> Do not store sensitive information (credit card details, etc.) in metadata.

See [Metadata Update Behavior](https://stytch.com/docs/api-reference/b2b/api/resources/object-update-behavior.md) for how updates are merged.

## Learn more

> [card] [Organization object](https://stytch.com/docs/api-reference/b2b/api/organizations/organization-object.md)
>
> Complete organization object reference

> [card] [Configure auth methods](https://stytch.com/docs/multi-tenant-auth/enterprise-ready/org-management/configure-auth-methods.md)
>
> Set up organization authentication policies

> [card] [JIT provisioning](https://stytch.com/docs/multi-tenant-auth/enterprise-ready/org-management/jit-provision-members.md)
>
> Automatic member provisioning guide

> [card] [Organization management](https://stytch.com/docs/multi-tenant-auth/enterprise-ready/org-management/overview.md)
>
> Comprehensive organization management guide
