Delegated trading
Once hosted Connect gives your app a member token, call the existing Trading API at https://app.crosstrade.io/v1/api/tv. Use that member's access token as the bearer credential. The normal endpoint schemas apply, with the delegated-access rules below and operation tracking added to trading commands.
First read: a member's positions
This request needs tv:read (also implied by tv:trade). MEMBER_TOKEN is the access_token from this member's code exchange or refresh, and DEMO12345678 is an account belonging to an identity they shared:
curl -sS "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/positions" \
-H "Authorization: Bearer $MEMBER_TOKEN"
A successful response for an account with no open positions:
{
"success": true,
"data": []
}
There is no extra Partner API wrapper around this call and no member id in the request. The token selects the member. See the code guide for account discovery, Python and JavaScript examples, and the complete client.
Identities and environments
Every account you name must resolve to a Tradovate identity the member selected on the hosted page, in an environment your partner profile allows. Otherwise the request is refused before anything reaches the broker:
| Status | Code | When |
|---|---|---|
| 403 | identity_not_consented | The account belongs to an identity the member did not share with your app |
| 403 | environment_not_allowed | The account is live and your profile is demo-only (or the reverse) |
| 404 | account_not_found | No account with that name is linked to the member |
| 409 | account_ambiguous | Two accounts share that name; use the account id |
A delegated request only ever reaches the Tradovate logins the member shared with your app, in your allowed environments. CrossTrade never calls another login on its behalf, not even for a read or a contract lookup.
Aggregate reads (/accounts/snapshot, /status, /positions, /orders, /fills, /fills/history, /fills/order/{orderId}, /cashbalances and /marginsnapshots) answer for those shared logins and leave the rest out, so they work under partial consent. Without ?account=, /fills/history under partial consent returns the rows recorded with an account id on a shared login. A member with no shared login in your environments gets 403 identity_not_consented.
Aggregate commands (/orders/cancelall and /positions/flatten) work the same way: they cancel and flatten every account on the shared logins in your allowed environments, and never touch a login the member kept private. The operation status target.identities lists the logins a sweep covered, and the flatten response's verification lists each account checked. A member with no shared login in your environments gets 403 identity_not_consented.
GET /accounts is the exception that lists rather than refuses: it returns the accounts on the logins the member shared with your app, in your allowed environments, and leaves the rest out. Use it to find the accounts the per-account routes accept. The list follows the member's logins: a new or closed account shows up within about 15 minutes (usually much sooner while a member stream is open), and each change is also reported as an account.added or account.removed event.
/fills/history with ?account=<name> reads one account, so it is authorized like a per-account route: the account must belong to a shared identity in an allowed environment, and it works under partial consent. Use the account name exactly as GET /v1/api/tv/accounts returns it (a different case answers 404 account_not_found). The rows returned are those of the account that passed authorization, in its own environment; an environment parameter that names another environment answers invalid_environment. Without account, it is an aggregate read over the shared logins, as above.
For events, P&L and the Tv_ functions over one long-lived connection per member, see Member streams.
Positions, orders and fills reads are usually answered from CrossTrade's live sync of the login and cost no Tradovate requests; see Request budgets in the overview.
Reference routes (/contracts/find, /contracts/suggest, /exchanges) need tv:read but no account selection. Token, service-policy and entitlement checks still apply. The operation-status route is scoped to commands created for the same member and OAuth client.
Operation matrix
| Operation | Scope | Effect |
|---|---|---|
Supported GET routes, including operation status | tv:read | read |
orders/place, orders/flatplace, positions/reverse, positions/reverseposition, orders/{id}/change, orders/{id}/replace | tv:trade | entry (new or wider risk) |
orders/{id}/cancel, orders/cancel, orders/cancelall | tv:trade | cancel |
positions/close, positions/flatten | tv:trade | reduce |
orders/cancel-and-bracket | tv:trade | protect |
While your service is active or past due within grace, every effect is available. While it is suspended, members keep read, cancel, reduce and protect through your app, but entries answer 403 partner_suspended. A disabled partner has no delegated access. The same rule applies to orders the member's own tools send while your seat funds them: new risk is paused, exits are not.
Request bodies
The route decides the account, path-bound order id and command. Omit those redundant fields from the body. Account and path-bound order-id aliases must agree with the route if supplied. command, destination, delay and key are rejected regardless of value or casing, with 400 validation_failed. Delegated commands run immediately; schedule any delay in your application.
Idempotency
Every mutating Trading API call needs an Idempotency-Key header (1 to 200 printable ASCII characters, without spaces), unique per logical command and never recycled. The key namespace is shared by commands from the same member and OAuth client.
- CrossTrade claims at most one dispatch for a key. A recorded command response carries
operationIdand the headerX-Operation-Id; a rejection before the command is recorded may have neither. - The same key with the same body replays the stored response for 24 hours with
Idempotent-Replayed: true; the same key with a different body is409 idempotency_conflict; a key still in flight is409 idempotency_in_progress. - A positive broker rejection (
4xx) is final and replayable as rejected. A new command needs a new key. - When CrossTrade cannot tell whether the broker received the command (timeout, dropped response, or an ambiguous broker error), the answer is
409 outcome_unknownwithoperationIdandstatusUrl. Do not resend with a new key. Read the account's orders and positions and the operation status with the same member's token. Composite commands (reverse, flat-and-place, cancel-and-bracket, replace) are one recorded dispatch step, so an unknown outcome still requires inspecting the account. - No
429consumes the key: retry afterRetry-Afterwith the same key and body.429 member_rate_limited,429 rate_limitedand429 too_many_concurrent_requestsare decided before anything is sent. If an earlier attempt with that key did go through, you get its stored answer instead. 429 broker_rate_limitedmeans Tradovate refused the command's first request to the broker, or CrossTrade held it back for Tradovate's limit, so nothing executed and the same key works on the retry. When Tradovate refuses a composite command part-way (the reverse's entry after its close, for example), part of it did execute, so the answer is409 outcome_unknownwith the detail saying so: inspect the account as above instead of retrying.- Placements carry a CrossTrade-generated
clOrdIdunless you supply one; it is recorded before dispatch and visible on the order in Tradovate. Inline ATM placements (atmQtys,atmStops,atmTargets) are the exception: Tradovate's order-strategy request has noclOrdIdfield. Instead, the entry order's text carries yournotestag (up to 64 characters) when you send one, and theclOrdIdwhen you don't. Correlate ATM placements through theorderStrategyIdin the response, or, when the outcome is unknown, through that text: an unknown ATM record has noorderStrategyId. A uniquenotesvalue per placement (for example derived from your Idempotency-Key) makes the entry easy to find.
Operation status
GET /v1/api/tv/operations/{operationId} returns the record of one command created for the same member and OAuth client (tv:read; anyone else gets 404 not_found). Status reads draw on the member's budget like every other read and can answer 429 member_rate_limited: poll with backoff and honor Retry-After.
| Field | Type | Description |
|---|---|---|
success | boolean | true when the record was found. |
operation.id | string | The operationId. |
operation.state | string | pending, dispatching, completed, rejected or outcome_unknown. outcome_unknown is final: the record stays as evidence and never turns into completed. |
operation.operation, operation.method, operation.route | string | The command: route name, HTTP method and route template for REST commands; the function name, WS and /ws/stream#<function> for commands sent on a member stream. |
operation.target | object | account and environment the command was authorized for (aggregate commands list identities instead). |
operation.created, operation.updated | string | UTC timestamps, YYYY-MM-DDTHH:MM:SSZ. |
operation.status | integer or null | HTTP status of the recorded answer; null while pending or unknown. |
operation.clOrdId | string or null | The client order id recorded before dispatch, on placement-capable commands. |
operation.orderId, operation.orderStrategyId | integer or null | Broker ids from the recorded answer. Always null on outcome_unknown, because no broker answer was read. |
operation.brokerCorrelation | string or null | Same value as clOrdId (kept for existing integrations). |
operation.steps | array of objects | One dispatch step per command: stepId, state, claimedAt and evidence (broker ids, failure reason and our error text; null while unknown). A command refused before dispatch has no steps. |
operation.reconciliation | string | What to do next, in plain language. |
operation.response | object | The original answer, for 24 hours after a completed or rejected command. Absent otherwise. |
- Completed
- Rejected
- Outcome unknown
{
"success": true,
"operation": {
"id": "op_Qm3xV0b7Lk2Zt9RaW4cY1e",
"state": "completed",
"operation": "place",
"method": "POST",
"route": "/v1/api/tv/accounts/{account}/orders/place",
"target": {"account": "DEMO12345678", "environment": "demo"},
"created": "2026-10-29T14:03:12Z",
"updated": "2026-10-29T14:03:12Z",
"status": 200,
"brokerCorrelation": "xtop-Qm3xV0b7Lk2Zt9RaW4cY1e",
"clOrdId": "xtop-Qm3xV0b7Lk2Zt9RaW4cY1e",
"orderId": 123456789,
"orderStrategyId": null,
"steps": [
{"stepId": "dispatch", "state": "completed", "claimedAt": "2026-10-29T14:03:12.104332+00:00",
"evidence": {"orderId": 123456789}}
],
"reconciliation": "The broker accepted this command. Confirm fills from the order and position reads.",
"response": {
"success": true, "destination": "tradovate", "api": "place_order",
"account": "DEMO12345678", "instrument": "MESZ6",
"response": {"orderId": 123456789}, "durationMs": 214,
"operationId": "op_Qm3xV0b7Lk2Zt9RaW4cY1e"
}
}
}
An inline ATM entry records "orderStrategyId": 5551 (and "orderId": null) instead.
{
"success": true,
"operation": {
"id": "op_Tz8pK1nD4qWs6Hy2Ub0Mfe",
"state": "rejected",
"operation": "place",
"method": "POST",
"route": "/v1/api/tv/accounts/{account}/orders/place",
"target": {"account": "DEMO12345678", "environment": "demo"},
"created": "2026-10-29T21:59:58Z",
"updated": "2026-10-29T21:59:58Z",
"status": 400,
"brokerCorrelation": "xtop-Tz8pK1nD4qWs6Hy2Ub0Mfe",
"clOrdId": "xtop-Tz8pK1nD4qWs6Hy2Ub0Mfe",
"orderId": null,
"orderStrategyId": null,
"steps": [
{"stepId": "dispatch", "state": "rejected", "claimedAt": "2026-10-29T21:59:58.211904+00:00",
"evidence": {"failureReason": "SessionClosed",
"error": "Tradovate rejected this command because the market session is closed for this contract."}}
],
"reconciliation": "The command was not accepted. A new command needs a new Idempotency-Key.",
"response": {
"success": false,
"error": "Tradovate rejected this command because the market session is closed for this contract.",
"destination": "tradovate", "api": "place_order",
"account": "DEMO12345678", "instrument": "MESZ6",
"response": {"failureReason": "SessionClosed"}, "durationMs": 182,
"operationId": "op_Tz8pK1nD4qWs6Hy2Ub0Mfe"
}
}
}
A refusal by CrossTrade's own checks (a position gate, an Account Manager lock) is also rejected, with evidence holding only the error text.
{
"success": true,
"operation": {
"id": "op_Ry5cJ7aL0vXe3Nb9Kd2Wqt",
"state": "outcome_unknown",
"operation": "place",
"method": "POST",
"route": "/v1/api/tv/accounts/{account}/orders/place",
"target": {"account": "DEMO12345678", "environment": "demo"},
"created": "2026-10-29T14:31:40Z",
"updated": "2026-10-29T14:31:52Z",
"status": null,
"brokerCorrelation": "xtop-Ry5cJ7aL0vXe3Nb9Kd2Wqt",
"clOrdId": "xtop-Ry5cJ7aL0vXe3Nb9Kd2Wqt",
"orderId": null,
"orderStrategyId": null,
"steps": [
{"stepId": "dispatch", "state": "dispatching", "claimedAt": "2026-10-29T14:31:40.517120+00:00", "evidence": null}
],
"reconciliation": "CrossTrade could not confirm whether the broker received this command. Check the account's working orders and positions before sending anything else, and never reuse this key."
}
}
Look for the clOrdId on the account's orders (for an inline ATM entry, the entry order's text) before sending anything else.