# Guarded trades (Guarded execution)

> Tickwire API reference, generated from the OpenAPI document the services export. Base URL: https://api.tickwire.io. Replace YOUR_API_KEY and YOUR_ACCOUNT_ID with your own values; use a sandbox key (twsk_…) to experiment.

Source: https://tickwire.io/docs/reference/execution/

### POST /v1/execution/accounts/{account_id}/trade

**Guarded Trade** · takes `Idempotency-Key`

Auth: `X-API-Key`

Trade with an ordinary API key under the same checks agent keys get:
pre-trade hooks with `applies_to: all`, kill switches and the audit
trail. Same body and answers as the agent trade route.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | path | `string` | yes |  |
| `Idempotency-Key` | header | `string \| null` | no |  |
| `X-Reason` | header | `string \| null` | no |  |

Request body: `any`

Responses:

- `200` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `404` [`account_not_found`](https://tickwire.io/docs/errors/account_not_found/)
- `409` [`idempotency_conflict`](https://tickwire.io/docs/errors/idempotency_conflict/)
- `500, 502` [`backend_error`](https://tickwire.io/docs/errors/backend_error/)
- `403` [`kill_switch_engaged`](https://tickwire.io/docs/errors/kill_switch_engaged/)

curl:

```bash
curl -sS -X POST 'https://api.tickwire.io/v1/execution/accounts/YOUR_ACCOUNT_ID/trade' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Idempotency-Key: my-request-1' \
  -H 'X-Reason: why you are doing this' \
  -H 'Content-Type: application/json' \
  -d '{"actionType":"ORDER_TYPE_BUY","symbol":"EURUSD","volume":0.01}'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/v1/execution/accounts/YOUR_ACCOUNT_ID/trade",
        json={"actionType": "ORDER_TYPE_BUY", "symbol": "EURUSD", "volume": 0.01},
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/v1/execution/accounts/YOUR_ACCOUNT_ID/trade", {
  body: {"actionType":"ORDER_TYPE_BUY","symbol":"EURUSD","volume":0.01},
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
```
