# Sub Account Operations

Endpoints to perform actions on a sub‑account you control.

## Withdrawal Status

`GET /v2/accounts/{accountId}/offchain-withdrawals/{instructionId}`

Check the status of a withdrawal request made on a sub account

**Parameters**

| Name | In | Required | Type | Description |
|------|-----|----------|------|-------------|
| `accountId` | path | Yes | string | The account you want to call to be actioned for |
| `instructionId` | path | Yes | string | Instruction Id - This is the client specified id when requesting (e.g. `375b23de-febf-4a6e-a517-e7b5dfa9357c`) |

**Responses**

- **200**: Ok

  | Field | Type | Description |
  |-------|------|-------------|
  | `instructionId` | string | Instruction Id - This is the client specified id when requesting (e.g. `375b23de-febf-4a6e-a517-e7b5dfa9357c`) |
  | `withdrawalLocation` | string | Withdrawal location specified in your request. (e.g. `ETHEREUM`) |
  | `withdrawalLocationReference` | string | The withdrawal location reference specified in your request. (e.g. `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`) |
  | `bankReference` | string | The bank reference specified in your request. (e.g. `withdrawal-reference-1`) |
  | `asset` | string | asset (e.g. `usd`) |
  | `amount` | string | amount (e.g. `5.67`) |
  | `status` | string | status |
  | `rejectionReason` | string | rejectionReason |

- **400**: Bad request

  | Field | Type | Description |
  |-------|------|-------------|
  | `code` | string | Error code |
  | `description` | string | Error description |


**Example**

```bash
curl "https://api.demo.omniaexchange.com/api/v2/accounts/{accountId}/offchain-withdrawals/{instructionId}"
```

---

## Withdrawal Request

`POST /v2/accounts/{accountId}/offchain-withdrawals`

Create a withdrawal request for the sub account

**Parameters**

| Name | In | Required | Type | Description |
|------|-----|----------|------|-------------|
| `accountId` | path | Yes | string | The account you want to call to be actioned for |

**Request Body** _(required)_

  | Field | Type | Description |
  |-------|------|-------------|
  | `instructionId` | string | This is your client reference id for the request. This can be any string less than 64 in length and needs to be unique per request (e.g. `375b23de-febf-4a6e-a517-e7b5dfa9357c`) |
  | `withdrawalLocation` | string | Withdrawal location (e.g. `ETHEREUM`) |
  | `withdrawalLocationReference` | string | Withdrawal location reference. If withdrawal location is a blockchain - specify your wallet you want to withdraw to, this must have been already whitelisted. If withdrawal location is FIAT please specify the bank name, this must have been already whitelisted. (e.g. `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`) |
  | `bankReference` | string | Bank reference. If specified, this is the bank reference associated with the withdrawal. This can be any string up to 35 characters in length. (e.g. `withdrawal-reference-1`) |
  | `asset` | string | Asset to withdraw (e.g. `usd`) |
  | `amount` | string | Amount to withdraw. Maximum of 5 decimal places. (e.g. `5.67`) |

**Responses**

- **200**: Ok

  | Field | Type | Description |
  |-------|------|-------------|
  | `instructionId` | string | Instruction Id - This is the client specified id when requesting (e.g. `375b23de-febf-4a6e-a517-e7b5dfa9357c`) |
  | `withdrawalLocation` | string | Withdrawal location specified in your request. (e.g. `ETHEREUM`) |
  | `withdrawalLocationReference` | string | The withdrawal location reference specified in your request. (e.g. `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`) |
  | `bankReference` | string | The bank reference specified in your request. (e.g. `withdrawal-reference-1`) |
  | `asset` | string | asset (e.g. `usd`) |
  | `amount` | string | amount (e.g. `5.67`) |
  | `status` | string | status |
  | `rejectionReason` | string | rejectionReason |

- **400**: Bad request

  | Field | Type | Description |
  |-------|------|-------------|
  | `code` | string | Error code |
  | `description` | string | Error description |


**Example**

```bash
curl -X POST "https://api.demo.omniaexchange.com/api/v2/accounts/{accountId}/offchain-withdrawals" \
  -H "Content-Type: application/json" \
  -d '{"instructionId": "375b23de-febf-4a6e-a517-e7b5dfa9357c", "withdrawalLocation": "ETHEREUM", "withdrawalLocationReference": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "bankReference": "withdrawal-reference-1", "asset": "usd", "amount": "5.67"}'
```

---

