# Margin required, or profit at a price

URL: https://docs.fxapis.com/api-reference/trading/margin-required-or-profit-at-a-price

> Margin required, or profit at a price. Opens nothing and is safe to call freely.

`POST https://api.fxapis.com/v1/accounts/{id}/calculate`

Opens nothing and is safe to call freely. This is how you find out an order will be refused for margin *before* sending it, rather than collecting a `10019` from the broker.

The account must be online: an offline account is refused with 409 `NO_RUNTIME`. A null `value` means the broker would not answer, which is not the same as zero.

Authentication: `Authorization: Bearer <API key>`.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

#### Request body (application/json, required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | "margin" \| "profit" | yes |  |
| `symbol` | string | yes | Example: `"EURUSD"` |
| `side` | "buy" \| "sell" | yes |  |
| `volume` | string | yes | Example: `"0.10"` |
| `price` | string | yes | The price the position opens at. Example: `"1.13426"` |
| `closePrice` | string | no | Required for a profit calculation. Example: `"1.13926"` |

#### Responses

- `200`
- `400`
- `401`
- `404`
- `409`
- `503`

Failures return `{ "error": { "code", "message" } }`; every code is listed at https://docs.fxapis.com/errors.

#### 200 response fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | object | no |  |
| `data.kind` | "margin" \| "profit" | no |  |
| `data.value` | null \| string | no | In the account's currency. Null means the broker would not answer — which is not the same as zero. |