# API reference

> 200 operations, generated from the OpenAPI document the services export (version 0.1.0). Base URL: https://api.tickwire.io.

OpenAPI: https://tickwire.io/openapi.json. Postman collection: https://tickwire.io/docs/reference/tickwire.postman_collection.json.

Authenticate with `auth-token` (on `/users/current/…`), `X-API-Key` (everywhere else) or `Authorization: Bearer`; the agent API takes `X-Tickwire-Agent-Key`.

## Account REST API (/users/current)

The `/users/current/…` REST API: provisioning, account state, market data, history and trading. Code already written for this API style needs only a new base URL and key. Works for MT4 and MT5.

### [Accounts and provisioning](https://tickwire.io/docs/reference/provisioning.md)

- `GET /users/current/accounts`: List Accounts
- `POST /users/current/accounts`: Create Account
- `GET /users/current/accounts/{account_id}`: Get Account
- `PUT /users/current/accounts/{account_id}`: Update Account
- `DELETE /users/current/accounts/{account_id}`: Delete Account
- `PUT /users/current/accounts/{account_id}/credentials`: Set Credentials
- `POST /users/current/accounts/{account_id}/deploy`: Deploy
- `POST /users/current/accounts/{account_id}/enable-account-features`: Enable Account Features
- `POST /users/current/accounts/{account_id}/enable-copy-factory-api`: Enable the copy trading API
- `POST /users/current/accounts/{account_id}/enable-metastats-api`: Enable the trading statistics API
- `POST /users/current/accounts/{account_id}/enable-risk-management-api`: Enable Risk Management
- `POST /users/current/accounts/{account_id}/increase-reliability`: Increase Reliability
- `POST /users/current/accounts/{account_id}/redeploy`: Redeploy
- `POST /users/current/accounts/{account_id}/undeploy`: Undeploy
- `GET /users/current/provisioning-profiles`: List Profiles
- `POST /users/current/provisioning-profiles`: Create Profile
- `GET /users/current/provisioning-profiles/{profile_id}`: Get Profile
- `PUT /users/current/provisioning-profiles/{profile_id}`: Update Profile
- `DELETE /users/current/provisioning-profiles/{profile_id}`: Delete Profile
- `PUT /users/current/provisioning-profiles/{profile_id}/{file_name}`: Upload File

### [Account state](https://tickwire.io/docs/reference/account-state.md)

- `GET /users/current/accounts/{account_id}/account-information`: Account Information
- `GET /users/current/accounts/{account_id}/capabilities`: Capabilities
- `GET /users/current/accounts/{account_id}/orders`: Orders
- `GET /users/current/accounts/{account_id}/orders/{order_id}`: Order
- `GET /users/current/accounts/{account_id}/positions`: Positions
- `GET /users/current/accounts/{account_id}/positions/{position_id}`: Position
- `GET /users/current/accounts/{account_id}/server-time`: Server Time

### [Market data](https://tickwire.io/docs/reference/market-data.md)

- `GET /users/current/accounts/{account_id}/historical-market-data/symbols/{symbol}/ticks`: Historical Ticks
- `GET /users/current/accounts/{account_id}/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles`: Historical Candles
- `GET /users/current/accounts/{account_id}/symbols`: Symbols
- `GET /users/current/accounts/{account_id}/symbols/{symbol}/current-book`: Current Book
- `GET /users/current/accounts/{account_id}/symbols/{symbol}/current-candles/{timeframe}`: Current Candle
- `GET /users/current/accounts/{account_id}/symbols/{symbol}/current-price`: Current Price
- `GET /users/current/accounts/{account_id}/symbols/{symbol}/current-tick`: Current Tick
- `GET /users/current/accounts/{account_id}/symbols/{symbol}/specification`: Specification
- `POST /users/current/accounts/{account_id}/symbols/{symbol}/unsubscribe`: Unsubscribe

### [History](https://tickwire.io/docs/reference/history.md)

- `GET /users/current/accounts/{account_id}/history-deals/position/{position_id}`: History Deals By Position
- `GET /users/current/accounts/{account_id}/history-deals/ticket/{ticket}`: History Deals By Ticket
- `GET /users/current/accounts/{account_id}/history-deals/time/{start_time}/{end_time}`: History Deals By Time
- `GET /users/current/accounts/{account_id}/history-orders/position/{position_id}`: History Orders By Position
- `GET /users/current/accounts/{account_id}/history-orders/ticket/{ticket}`: History Orders By Ticket
- `GET /users/current/accounts/{account_id}/history-orders/time/{start_time}/{end_time}`: History Orders By Time

### [Trading](https://tickwire.io/docs/reference/trading.md)

- `POST /users/current/accounts/{account_id}/calculate-margin`: Calculate Margin
- `POST /users/current/accounts/{account_id}/trade`: Trade
- `POST /users/current/accounts/{account_id}/trade/check`: Trade Check
- `GET /users/current/accounts/{account_id}/trailing-stop-losses`: List Trailing
- `DELETE /users/current/accounts/{account_id}/trailing-stop-losses/{position_id}`: Delete Trailing

### [Health, snapshot and audit trail](https://tickwire.io/docs/reference/account-health-audit.md)

- `GET /users/current/accounts/{account_id}/audit`: Account Audit
- `GET /users/current/accounts/{account_id}/health`: Account Health
- `GET /users/current/accounts/{account_id}/snapshot`: Account Snapshot

### [Tokens and discovery](https://tickwire.io/docs/reference/tokens-discovery.md)

- `POST /users/current/narrow-down-auth-token`: Narrow Down
- `GET /users/current/regions`: Regions
- `GET /users/current/servers/mt-client-api`: Client Api Domain
- `GET /users/current/tokens`: List Tokens
- `POST /users/current/tokens`: Create Token
- `GET /users/current/tokens/{token_id}`: Get Token
- `PATCH /users/current/tokens/{token_id}`: Patch Token
- `DELETE /users/current/tokens/{token_id}`: Revoke Token
- `GET /v1/access-rule-manifest`: Access Rule Manifest
- `GET /v1/known-mt-servers/{version}/search`: Search Servers

## Terminal routes and batch orders

Per-account terminal routes on `/mt4/{id}/…` and `/mt5/{id}/…`, and batch orders on `/v1/orders`.

### [MT5 terminal](https://tickwire.io/docs/reference/mt5-terminal.md)

- `GET /mt5/{account_id}/AccountInfo`: GET /mt5/{account_id}/AccountInfo
- `GET /mt5/{account_id}/AccountSummary`: GET /mt5/{account_id}/AccountSummary
- `POST /mt5/{account_id}/CloseAll`: POST /mt5/{account_id}/CloseAll
- `GET /mt5/{account_id}/OpenedOrders`: GET /mt5/{account_id}/OpenedOrders
- `GET /mt5/{account_id}/OrderCalcMargin`: GET /mt5/{account_id}/OrderCalcMargin
- `GET /mt5/{account_id}/OrderCalcProfit`: GET /mt5/{account_id}/OrderCalcProfit
- `POST /mt5/{account_id}/OrderClose`: POST /mt5/{account_id}/OrderClose
- `GET /mt5/{account_id}/OrderHistory`: GET /mt5/{account_id}/OrderHistory
- `POST /mt5/{account_id}/OrderModify`: POST /mt5/{account_id}/OrderModify
- `POST /mt5/{account_id}/OrderSend`: POST /mt5/{account_id}/OrderSend
- `GET /mt5/{account_id}/PositionHistory`: GET /mt5/{account_id}/PositionHistory
- `GET /mt5/{account_id}/PriceHistory`: GET /mt5/{account_id}/PriceHistory
- `GET /mt5/{account_id}/ServerTimezone`: GET /mt5/{account_id}/ServerTimezone
- `GET /mt5/{account_id}/SymbolInfo`: GET /mt5/{account_id}/SymbolInfo
- `GET /mt5/{account_id}/getQuote`: GET /mt5/{account_id}/getQuote
- `GET /mt5/{account_id}/healthz`: GET /mt5/{account_id}/healthz
- `GET /mt5/{account_id}/livez`: GET /mt5/{account_id}/livez
- `GET /mt5/{account_id}/status`: GET /mt5/{account_id}/status
- `GET /mt5/{account_id}/symbols`: GET /mt5/{account_id}/symbols

### [MT4 terminal](https://tickwire.io/docs/reference/mt4-terminal.md)

- `GET /mt4/{account_id}/AccountInfo`: GET /mt4/{account_id}/AccountInfo
- `GET /mt4/{account_id}/AccountSummary`: GET /mt4/{account_id}/AccountSummary
- `POST /mt4/{account_id}/CloseAll`: POST /mt4/{account_id}/CloseAll
- `GET /mt4/{account_id}/OpenedOrders`: GET /mt4/{account_id}/OpenedOrders
- `GET /mt4/{account_id}/OrderCalcMargin`: GET /mt4/{account_id}/OrderCalcMargin
- `GET /mt4/{account_id}/OrderCalcProfit`: GET /mt4/{account_id}/OrderCalcProfit
- `POST /mt4/{account_id}/OrderClose`: POST /mt4/{account_id}/OrderClose
- `GET /mt4/{account_id}/OrderHistory`: GET /mt4/{account_id}/OrderHistory
- `POST /mt4/{account_id}/OrderModify`: POST /mt4/{account_id}/OrderModify
- `POST /mt4/{account_id}/OrderSend`: POST /mt4/{account_id}/OrderSend
- `GET /mt4/{account_id}/PositionHistory`: GET /mt4/{account_id}/PositionHistory
- `GET /mt4/{account_id}/PriceHistory`: GET /mt4/{account_id}/PriceHistory
- `GET /mt4/{account_id}/ServerTimezone`: GET /mt4/{account_id}/ServerTimezone
- `GET /mt4/{account_id}/SymbolInfo`: GET /mt4/{account_id}/SymbolInfo
- `GET /mt4/{account_id}/getQuote`: GET /mt4/{account_id}/getQuote
- `GET /mt4/{account_id}/healthz`: GET /mt4/{account_id}/healthz
- `GET /mt4/{account_id}/livez`: GET /mt4/{account_id}/livez
- `GET /mt4/{account_id}/status`: GET /mt4/{account_id}/status
- `GET /mt4/{account_id}/symbols`: GET /mt4/{account_id}/symbols

### [Batch orders](https://tickwire.io/docs/reference/batch-orders.md)

- `POST /v1/orders`: Batch orders
- `POST /v1/orders/close`: Batch close

## Native /v1

Tickwire's own API: accounts, webhooks, keys, private servers, dedicated IPs and billing.

### [Sandbox](https://tickwire.io/docs/reference/sandbox.md)

- `GET /v1/sandbox`: Sandbox Info
- `POST /v1/sandbox/keys`: Create Key
- `POST /v1/sandbox/signup`: Signup

### [Accounts](https://tickwire.io/docs/reference/accounts.md)

- `GET /v1/accounts`: List Accounts
- `POST /v1/accounts`: Link Account
- `GET /v1/accounts/{account_id}`: Get Account
- `PATCH /v1/accounts/{account_id}`: Patch Account
- `DELETE /v1/accounts/{account_id}`: Unlink Account

### [Webhooks and events](https://tickwire.io/docs/reference/webhooks.md)

- `POST /v1/events/{event_id}/resend`: Resend Event
- `GET /v1/webhook-event-types`: Event Types
- `POST /v1/webhook-events/trigger`: Trigger
- `POST /v1/webhook-listeners`: Create Listener
- `GET /v1/webhook-listeners/{listener_id}/events`: Listener Events
- `GET /v1/webhooks`: List Webhooks
- `POST /v1/webhooks`: Create Webhook
- `GET /v1/webhooks/{webhook_id}`: Get Webhook
- `PATCH /v1/webhooks/{webhook_id}`: Patch Endpoint
- `DELETE /v1/webhooks/{webhook_id}`: Delete Webhook
- `GET /v1/webhooks/{webhook_id}/deliveries`: List Deliveries
- `GET /v1/webhooks/{webhook_id}/deliveries/{delivery_id}`: Get Delivery
- `POST /v1/webhooks/{webhook_id}/deliveries/{delivery_id}/resend`: Resend Delivery
- `POST /v1/webhooks/{webhook_id}/disable`: Disable Endpoint
- `POST /v1/webhooks/{webhook_id}/enable`: Enable Endpoint
- `POST /v1/webhooks/{webhook_id}/reveal-secret`: Reveal Secret
- `POST /v1/webhooks/{webhook_id}/rotate-secret`: Rotate Secret
- `GET /v1/webhooks/{webhook_id}/settings`: Endpoint Settings

### [Read-only keys](https://tickwire.io/docs/reference/keys.md)

- `GET /v1/readonly-keys`: List Ro Keys
- `POST /v1/readonly-keys`: Create Ro Key
- `GET /v1/readonly-keys/{key_id}`: Get Ro Key
- `PATCH /v1/readonly-keys/{key_id}`: Patch Ro Key
- `DELETE /v1/readonly-keys/{key_id}`: Delete Ro Key
- `POST /v1/readonly-keys/{key_id}/rotate`: Rotate Ro Key

### [Private servers](https://tickwire.io/docs/reference/private-servers.md)

- `GET /v1/private-servers`: List Servers
- `POST /v1/private-servers`: Buy Server
- `GET /v1/private-servers/regions`: Regions
- `GET /v1/private-servers/{server_id}`: Get Server
- `PATCH /v1/private-servers/{server_id}`: Resize Server
- `DELETE /v1/private-servers/{server_id}`: Cancel Server
- `POST /v1/private-servers/{server_id}/accounts`: Add Server Account
- `DELETE /v1/private-servers/{server_id}/accounts/{account_id}`: Remove Server Account

### [Dedicated IPs and billing](https://tickwire.io/docs/reference/billing.md)

- `GET /v1/billing`: Billing
- `POST /v1/billing/upgrade`: Upgrade
- `GET /v1/billing/upgrade/quote`: Upgrade Quote
- `GET /v1/dedicated-ips`: My Dedicated Ips
- `POST /v1/dedicated-ips/move-accounts`: My Move Accounts
- `GET /v1/subscription`: Subscription
- `GET /v1/wallet`: Wallet
- `GET /v1/wallet/assets`: Wallet Assets
- `POST /v1/wallet/topup`: Create Topup
- `GET /v1/wallet/topup/{topup_id}`: Get Topup
- `POST /v1/wallet/topup/{topup_id}/confirm`: Confirm Topup
- `GET /v1/wallet/topups`: List Topups

### [Identity and other routes](https://tickwire.io/docs/reference/native-other.md)

- `GET /v1/api-version`: Get Api Version
- `POST /v1/api-version`: Set Api Version
- `GET /v1/meta/whoami`: Whoami
- `GET /v1/request-logs`: List Request Logs
- `GET /v1/request-logs/summary`: Request Log Summary
- `GET /v1/request-logs/{log_id}`: Get Request Log

## AI agents

Scoped agent keys, kill switches, pre-trade hooks and holds, and the agent API itself.

### [Agent API](https://tickwire.io/docs/reference/agent-api.md)

- `GET /v1/agent/accounts`: Agent Accounts
- `GET /v1/agent/accounts/{account_id}/account-information`: Agent Account Info
- `GET /v1/agent/accounts/{account_id}/health`: Agent Health
- `GET /v1/agent/accounts/{account_id}/history-deals`: Agent Deals
- `GET /v1/agent/accounts/{account_id}/orders`: Agent Orders
- `GET /v1/agent/accounts/{account_id}/positions`: Agent Positions
- `GET /v1/agent/accounts/{account_id}/snapshot`: Agent Snapshot
- `GET /v1/agent/accounts/{account_id}/symbols/{symbol}/current-price`: Agent Price
- `GET /v1/agent/accounts/{account_id}/symbols/{symbol}/specification`: Agent Spec
- `POST /v1/agent/accounts/{account_id}/trade`: Agent Trade
- `GET /v1/agent/audit`: Agent Own Audit
- `GET /v1/agent/me`: Agent Me
- `GET /v1/agent/requests/{idempotency_key}`: Agent Request Status

### [Agent keys and kill switches](https://tickwire.io/docs/reference/agent-admin.md)

- `GET /v1/agent-audit`: Agent Audit
- `GET /v1/agent-keys`: List Agent Keys
- `POST /v1/agent-keys`: Create Agent Key
- `GET /v1/agent-keys/{key_id}`: Get Agent Key
- `PATCH /v1/agent-keys/{key_id}`: Patch Agent Key
- `DELETE /v1/agent-keys/{key_id}`: Revoke Agent Key
- `PUT /v1/agent-keys/{key_id}/kill-switch`: Set Key Kill Switch
- `GET /v1/agent-kill-switches`: List Kill Switches
- `PUT /v1/agent-kill-switches/accounts/{account_id}`: Set Account Kill Switch

### [Pre-trade hooks and holds](https://tickwire.io/docs/reference/pretrade.md)

- `GET /v1/pretrade-holds`: List Holds
- `GET /v1/pretrade-holds/{hold_id}`: Get Hold
- `POST /v1/pretrade-holds/{hold_id}/cancel`: Cancel Hold
- `POST /v1/pretrade-holds/{hold_id}/release`: Release Hold
- `GET /v1/pretrade-hooks`: List Hooks
- `POST /v1/pretrade-hooks`: Create Hook
- `GET /v1/pretrade-hooks/{hook_id}`: Get Hook
- `PATCH /v1/pretrade-hooks/{hook_id}`: Patch Hook
- `DELETE /v1/pretrade-hooks/{hook_id}`: Delete Hook
- `POST /v1/pretrade-hooks/{hook_id}/rotate-secret`: Rotate Hook Secret

### [Sign in with Tickwire (OAuth) and connected apps](https://tickwire.io/docs/reference/oauth.md)

- `GET /.well-known/oauth-authorization-server`: As Metadata
- `GET /oauth/authorize`: Authorize
- `POST /oauth/consent/decide`: Consent Decide
- `POST /oauth/consent/view`: Consent View
- `POST /oauth/register`: Register
- `POST /oauth/revoke`: Revoke
- `POST /oauth/token`: Token
- `GET /v1/connected-apps`: List Apps
- `DELETE /v1/connected-apps/{grant_id}`: Disconnect App

## Guarded execution

Trades placed with an API key through the same guarded pipeline agents use.

### [Guarded trades](https://tickwire.io/docs/reference/execution.md)

- `POST /v1/execution/accounts/{account_id}/trade`: Guarded Trade
