API reference / Guarded execution
Guarded trades
Guarded execution. Generated from the OpenAPI document the services export (/openapi.json).
Samples use the placeholders YOUR_API_KEY and YOUR_ACCOUNT_ID.
Paste a sandbox key (twsk_…) to fill them in and to use Try it.
It stays in this browser tab and is only sent to the sandbox, never to the live API.
Try it is off in this build: No sandbox URL is configured for this build of the docs.
POST /v1/execution/accounts/{account_id}/trade
Guarded Trade 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 | Description |
|---|---|---|---|
account_id required | path | string | |
Idempotency-Key | header | string | null | |
X-Reason | header | string | null |
Request body any
Responses
200Successful Response422Validation Error ·HTTPValidationError
Errors (common for this kind of call; every error uses one envelope)
401unauthorized429rate_limited400, 422validation_error404account_not_found409idempotency_conflict500, 502backend_error403kill_switch_engaged
curl
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
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
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(); Try it in the sandbox
Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.