Skip to main content

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:

StatusCodeWhen
403identity_not_consentedThe account belongs to an identity the member did not share with your app
403environment_not_allowedThe account is live and your profile is demo-only (or the reverse)
404account_not_foundNo account with that name is linked to the member
409account_ambiguousTwo 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​

OperationScopeEffect
Supported GET routes, including operation statustv:readread
orders/place, orders/flatplace, positions/reverse, positions/reverseposition, orders/{id}/change, orders/{id}/replacetv:tradeentry (new or wider risk)
orders/{id}/cancel, orders/cancel, orders/cancelalltv:tradecancel
positions/close, positions/flattentv:tradereduce
orders/cancel-and-brackettv:tradeprotect

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 operationId and the header X-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 is 409 idempotency_conflict; a key still in flight is 409 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_unknown with operationId and statusUrl. 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 429 consumes the key: retry after Retry-After with the same key and body. 429 member_rate_limited, 429 rate_limited and 429 too_many_concurrent_requests are decided before anything is sent. If an earlier attempt with that key did go through, you get its stored answer instead.
  • 429 broker_rate_limited means 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 is 409 outcome_unknown with the detail saying so: inspect the account as above instead of retrying.
  • Placements carry a CrossTrade-generated clOrdId unless 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 no clOrdId field. Instead, the entry order's text carries your notes tag (up to 64 characters) when you send one, and the clOrdId when you don't. Correlate ATM placements through the orderStrategyId in the response, or, when the outcome is unknown, through that text: an unknown ATM record has no orderStrategyId. A unique notes value 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.

FieldTypeDescription
successbooleantrue when the record was found.
operation.idstringThe operationId.
operation.statestringpending, 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.routestringThe 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.targetobjectaccount and environment the command was authorized for (aggregate commands list identities instead).
operation.created, operation.updatedstringUTC timestamps, YYYY-MM-DDTHH:MM:SSZ.
operation.statusinteger or nullHTTP status of the recorded answer; null while pending or unknown.
operation.clOrdIdstring or nullThe client order id recorded before dispatch, on placement-capable commands.
operation.orderId, operation.orderStrategyIdinteger or nullBroker ids from the recorded answer. Always null on outcome_unknown, because no broker answer was read.
operation.brokerCorrelationstring or nullSame value as clOrdId (kept for existing integrations).
operation.stepsarray of objectsOne 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.reconciliationstringWhat to do next, in plain language.
operation.responseobjectThe original answer, for 24 hours after a completed or rejected command. Absent otherwise.
{
"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.