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

# Create brokerage account

> Use POST /apex/accounts to open an Apex-backed brokerage account. Covers request body fields, sync and async responses, and error handling.

## Request body

<ParamField body="request_id" type="string" required>
  A client-generated UUID that uniquely identifies this account creation request. Use the same value when polling for status.
</ParamField>

<ParamField body="description" type="string | null">
  An optional label for the brokerage account (for example, `"Long-term investments"`).
</ParamField>

## Response

This endpoint returns one of two responses depending on whether the account was created synchronously or is being processed asynchronously.

### 200 - Account created

Returned when the brokerage account is created immediately.

<ResponseField name="status" type="string">
  Always `"ready"`.
</ResponseField>

<ResponseField name="request_id" type="string">
  The `request_id` you provided in the request.
</ResponseField>

<ResponseField name="account" type="object">
  The canonical account record.

  <Expandable title="account properties">
    <ResponseField name="id" type="string">Unique account identifier.</ResponseField>
    <ResponseField name="name" type="string">Display name of the account.</ResponseField>
    <ResponseField name="type" type="string">Account type (for example, `"investment"`).</ResponseField>
    <ResponseField name="subtype" type="string">Account subtype (for example, `"brokerage"`).</ResponseField>
    <ResponseField name="status" type="string">Current account status.</ResponseField>
    <ResponseField name="external_id" type="string">External identifier from the brokerage provider.</ResponseField>
    <ResponseField name="external_source" type="string">Source of the external identifier.</ResponseField>
    <ResponseField name="apex_account_number" type="string | null">The Apex brokerage account number.</ResponseField>
    <ResponseField name="as_of" type="string">Timestamp of the last data update.</ResponseField>
    <ResponseField name="created_at" type="string">When the account was created.</ResponseField>
    <ResponseField name="updated_at" type="string">When the account was last updated.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="staging_account" type="object">
  The staging record for the Apex account.

  <Expandable title="staging_account properties">
    <ResponseField name="id" type="string">Staging account identifier.</ResponseField>
    <ResponseField name="account_number" type="string | null">The Apex account number.</ResponseField>
    <ResponseField name="apex_person_id" type="string">Identifier of the associated Apex person.</ResponseField>
    <ResponseField name="apex_state" type="string">Current Apex account state.</ResponseField>
    <ResponseField name="description" type="string | null">Account description.</ResponseField>
    <ResponseField name="owner_user_id" type="string">The user who owns this account.</ResponseField>
    <ResponseField name="as_of" type="string">Timestamp of the last data update.</ResponseField>
    <ResponseField name="created_at" type="string">When the staging record was created.</ResponseField>
    <ResponseField name="updated_at" type="string">When the staging record was last updated.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="staging_person" type="object">
  The staging record for the associated Apex person.

  <Expandable title="staging_person properties">
    <ResponseField name="id" type="string">Staging person identifier.</ResponseField>
    <ResponseField name="owner_user_id" type="string">The user who owns this person record.</ResponseField>
    <ResponseField name="status" type="string">Current person status.</ResponseField>
    <ResponseField name="created_at" type="string">When the person record was created.</ResponseField>
    <ResponseField name="updated_at" type="string">When the person record was last updated.</ResponseField>
  </Expandable>
</ResponseField>

### 202 - Account creation pending

Returned when account creation cannot complete immediately and is continuing in the background.

<ResponseField name="code" type="string">
  Always `"apex_account_pending"`.
</ResponseField>

<ResponseField name="request_id" type="string">
  The `request_id` you provided in the request.
</ResponseField>

<ResponseField name="poll_path" type="string">
  The path to poll for the account creation status (for example, `"/apex/accounts/by-request/{request_id}"`).
</ResponseField>

### Error responses

| Status | Description                                                                       |
| ------ | --------------------------------------------------------------------------------- |
| 403    | The brokerage account feature is not enabled for your account.                    |
| 409    | Required identity data is missing or the local account record cannot be resolved. |
| 423    | Identity verification must be completed before creating a brokerage account.      |
| 428    | A passkey or recent passkey verification is required.                             |
| 500    | The brokerage service is not configured or the request failed.                    |

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.yoshi.ai/apex/accounts \
    -H "Authorization: Bearer yoshi_3xK9mP..." \
    -H "Content-Type: application/json" \
    -d '{
      "request_id": "550e8400-e29b-41d4-a716-446655440000",
      "description": "Long-term investments"
    }'
  ```

  ```python Python theme={null}
  import httpx

  response = httpx.post(
      "https://api.yoshi.ai/apex/accounts",
      headers={"Authorization": "Bearer yoshi_3xK9mP..."},
      json={
          "request_id": "550e8400-e29b-41d4-a716-446655440000",
          "description": "Long-term investments",
      },
  )

  data = response.json()
  if data.get("status") == "ready":
      print(f"Account created: {data['account']['id']}")
  else:
      print(f"Pending — poll at: {data['poll_path']}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.yoshi.ai/apex/accounts", {
    method: "POST",
    headers: {
      Authorization: "Bearer yoshi_3xK9mP...",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      request_id: "550e8400-e29b-41d4-a716-446655440000",
      description: "Long-term investments",
    }),
  });

  const data = await response.json();
  if (data.status === "ready") {
    console.log(`Account created: ${data.account.id}`);
  } else {
    console.log(`Pending — poll at: ${data.poll_path}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Ready theme={null}
  {
    "status": "ready",
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "account": {
      "id": "acc_brok_abc123",
      "name": "Brokerage Account",
      "type": "investment",
      "subtype": "brokerage",
      "status": "active",
      "external_id": "ext_apex_456",
      "external_source": "apex",
      "apex_account_number": "8AA000001",
      "as_of": "2026-04-15T12:00:00.000Z",
      "created_at": "2026-04-15T12:00:00.000Z",
      "updated_at": "2026-04-15T12:00:00.000Z"
    },
    "staging_account": {
      "id": "stg_abc123",
      "account_number": "8AA000001",
      "apex_person_id": "apx_person_789",
      "apex_state": "COMPLETE",
      "description": "Long-term investments",
      "owner_user_id": "usr_xyz",
      "as_of": "2026-04-15T12:00:00.000Z",
      "created_at": "2026-04-15T12:00:00.000Z",
      "updated_at": "2026-04-15T12:00:00.000Z"
    },
    "staging_person": {
      "id": "stg_person_789",
      "owner_user_id": "usr_xyz",
      "status": "COMPLETE",
      "created_at": "2026-04-15T12:00:00.000Z",
      "updated_at": "2026-04-15T12:00:00.000Z"
    }
  }
  ```

  ```json 202 - Pending theme={null}
  {
    "code": "apex_account_pending",
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "poll_path": "/apex/accounts/by-request/550e8400-e29b-41d4-a716-446655440000"
  }
  ```
</ResponseExample>
