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

# Create Accounts From an Organization ID

> Create one account per organization ID and add its contacts as members

# Create Accounts From an Organization ID

Starts a background job that creates one account per distinct value of `propertyKey` and adds each contact seen with that value as a `member`. [Preview](/api-reference/accounts/organization-ids-preview) the result first, then check progress with [Get Organization ID Job](/api-reference/accounts/organization-ids-job).

* Accounts are named from `nameKey` when you pass one, otherwise after the work email domain most of their contacts share. That domain is also saved on the account.
* Existing accounts keep their names, domains and member roles.
* No emails are sent, no sync rules run and segment-entered sequences are not triggered.
* For `event`, events from the last 180 days are used.

The first run turns Accounts on for the workspace, with the same `409` rule as [creating an account](/api-reference/accounts/upsert). Only one run per key runs at a time. While one is queued or running, this returns it with `alreadyRunning: true` instead of starting another. That run keeps its own settings, shown in `job.settings`; start again after it finishes to use a different `source` or `nameKey`. Accounts stays on even if the job later fails. Running it again later is safe: it updates the same accounts and memberships.

Requires the `subscribers:write` scope.

## Request

<ParamField body="propertyKey" type="string" required>
  Event property or contact attribute holding your organization ID. Trimmed.
</ParamField>

<ParamField body="source" type="string" default="event">
  `event` for an event property, `attribute` for a contact attribute.
</ParamField>

<ParamField body="nameKey" type="string | null">
  Property or attribute holding the organization name.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/account-suggestions/organization-ids" \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"propertyKey": "organization_id"}'
```

## Response

Returns `202 Accepted`.

<ResponseField name="jobId" type="string">
  Pass to [Get Organization ID
  Job](/api-reference/accounts/organization-ids-job).
</ResponseField>

<ResponseField name="alreadyRunning" type="boolean">
  `true` when a run for this key was already queued or running, so no new run
  started.
</ResponseField>

<ResponseField name="job" type="object">
  The job's current status, as returned by [Get Organization ID
  Job](/api-reference/accounts/organization-ids-job).
</ResponseField>

<ResponseExample>
  ```json 202 theme={null}
  {
    "success": true,
    "jobId": "backfill-accounts:comp_123:organization_id",
    "alreadyRunning": false,
    "job": {
      "jobId": "backfill-accounts:comp_123:organization_id",
      "state": "queued",
      "settings": {
        "source": "event",
        "propertyKey": "organization_id",
        "nameKey": null
      },
      "result": null,
      "error": null
    }
  }
  ```

  ```json 400 theme={null}
  { "success": false, "error": "`propertyKey` cannot be blank." }
  ```

  ```json 401 theme={null}
  { "success": false, "error": "Unauthorized" }
  ```

  ```json 403 theme={null}
  { "success": false, "error": "No company selected" }
  ```

  ```json 409 theme={null}
  {
    "success": false,
    "error": "Contacts in this workspace already use the custom attribute `account.plan`. Accounts reserve the `account` attribute name for organization data, so turning Accounts on would stop those contact attributes from updating in segments. Rename them (for example to `company.plan`), then try again."
  }
  ```

  ```json 422 theme={null}
  { "success": false, "error": "Expected property 'propertyKey' to be string" }
  ```
</ResponseExample>
