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

# Update membership

> Toggle domain auto-join for an account

`PATCH /api/v2/accounts/{customerId}/membership`

Updates the membership access settings for an account. Requires the `ADMIN` role and a registered `customerDomain` to enable domain auto-join. Top-level organizations default to enabled and child accounts default to disabled; this operation explicitly overrides that default.

## Request

```bash curl theme={null}
curl -X PATCH https://api.apostra.com/api/v2/accounts/200/membership \
  -H "Authorization: Bearer $SCOPE3_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "allowDomainAutoJoin": true
  }'
```

## Parameters

| Field | Type | Required | Notes |
| - | - | - | - |
| `customerId` | string | Yes | Path parameter. ID of the account to update |
| `allowDomainAutoJoin` | boolean | Yes | When true, users with a verified matching-domain email join as members without admin approval. Requires `customerDomain` to be set |

## Response

```json theme={null}
{
  "customerId": 200,
  "allowDomainAutoJoin": true
}
```

| Field | Type | Notes |
| - | - | - |
| `customerId` | integer | Account ID |
| `allowDomainAutoJoin` | boolean | The setting now in effect |

## Errors

* `400 VALIDATION_ERROR` — enabling auto-join without a registered `customerDomain`.
* `401 UNAUTHORIZED` — caller is not an `ADMIN`.

See [Errors](/v2/reference/errors) for the full error contract.

## Related

<CardGroup cols={2}>
  <Card title="Account tasks" href="/v2/storefront/account/tasks" icon="list-check">
    All account operations
  </Card>

  <Card title="Get membership" href="/v2/storefront/account/tasks/get-membership" icon="users">
    Read the current setting
  </Card>

  <Card title="Update account domain" href="/v2/storefront/account/tasks/update-customer-domain" icon="globe">
    Register a domain first
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.