> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.immix.xyz/api-reference/rest-api/orders/submit/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.immix.xyz/_mcp/server. # Submit an order POST /orders Content-Type: application/json Submits an order (`orders:trade`): the `Idempotency-Key` is its `clientOrderId`, the instrument is named by `instrumentId` or by symbol (`instrument`), and the owner judges `price` and `qty` against it. Answers the queued row, or the refusal the owner's validation chain reached — [the guide](https://docs.immix.xyz/guides/rest-api-guide#orders). Reference: https://docs.immix.xyz/api-reference/rest-api/orders/submit ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Headers - `Idempotency-Key` (string, required) — On `POST /orders` the key is the order's `clientOrderId`: 1 to 36 characters from `[A-Za-z0-9._~-]`, scoped to you at the gateway and to the organisation at the owner. A retry replays or attaches; a key that reaches the owner afresh restates the same order, never a second one. A body `clientOrderId` may restate it, never contradict it (400). ### Body (application/json) This endpoint expects an object. - `side` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `BUY`, `SELL` - `orderType` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `LIMIT`, `MARKET` - `timeInForce` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `GTC`, `IOC`, `FOK`, `GTD` - `qty` (string, required) — money (a Decimal on the wire): a decimal string on input, encoded at its own scale — the fractional digits sent, trailing zeros dropped, at most 18. The edge consults no reference data: a value finer than its record is the platform's to judge, not the edge's to refuse - `accountId` (integer, optional) - `instrumentId` (string, optional) — int64 as a decimal JSON string - `bookId` (string, optional, nullable) — int64 as a decimal JSON string - `isPostOnly` (boolean, optional) — a boolean; absent reads false - `isReduceOnly` (boolean, optional) — Refused INVALID_FIELD in v1; ships for 119/120 and derivatives. a boolean; absent reads false - `price` (string, optional, nullable) — 0 = none (MARKET only); LIMIT requires price > 0 — zero and negative refuse INVALID_FIELD (arm 10: the sentinel is never a legal limit price). money (a Decimal on the wire): a decimal string on input, encoded at its own scale — the fractional digits sent, trailing zeros dropped, at most 18. The edge consults no reference data: a value finer than its record is the platform's to judge, not the edge's to refuse; absent, null or "0" = unset (the 0 sentinel) - `clientOrderId` (string, optional) — The client's idempotency key for the order, 1 to 36 US-ASCII characters (a canonical hyphenated UUID fits; the owner refuses empty or longer as INVALID_FIELD — an empty key is no identity). It deduplicates at the platform's edge only, never at the venue: orderId is what the venue sees. - `account` (string, optional) — The account's display name within your organization. An alias for accountId: name the account either way, at least one of the two; both stated must agree, else 400 MALFORMED_REQUEST. The edge resolves the name against the accounts this member holds and puts the id on the wire, because a name is the org's to change and a command carrying one would name a different account after a rename. A name no live account of your org holds refuses 422 ACCOUNT_NOT_ACTIVE. An account still being classified has no bound name and is addressable by id alone. - `instrument` (string, optional) — The instrument's platform symbol — refdata's natural key, VENUE@BASE/QUOTE with the product suffix where the venue has one ("OKX@BTC/USDT", "OKX@BTC/USDT:SWAP"). An alias for instrumentId: name the instrument either way, at least one of the two; both stated must agree, else 400 MALFORMED_REQUEST. The edge resolves the symbol against the instruments this member holds and puts the id on the wire; a symbol no instrument here holds refuses 422 INSTRUMENT_NOT_LIVE at the door, the code the orders owner answers to an unheld id. The id is the stable address, the symbol the convenience. ## Response ### 200 The order as the platform now holds it: on a submit the queued row (or your existing order under the same `clientOrderId`), on a cancel the row with `cancelRequestedAtNs` set and the status unchanged — with the answering change's position, the order's `ETag` and, on a replayed key, `Idempotent-Replay`. - `acceptedAtNs` (string, required) — The accept's consensus time, stamped by the owner — the anchor instructFreshnessNs measures from; carried on the record so a restored snapshot keeps the window. int64 as a decimal JSON string - `accountId` (integer, required) - `clientOrderId` (string, required) — The edge key echoed; never the venue key. - `credentialId` (integer, required) — The oe credential the owner RESOLVED at submit — the org's live canTrade credential for the account's venue, not the account's own read-only credential. The connector's fold filter is credentialId ∈ mine. - `cumQty` (string, required) — Derived from the deduplicated execution set — never from the venue's cumulative; rounded by the owner. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw - `externalRef` (string, required) — The venue order id once bound (ACKNOWLEDGED or first evidence carrying it); empty until then. - `globalSequence` (string, required) — The position as a decimal string — the last change this member had applied, orders and balance readings included. - `instrumentId` (string, required) — int64 as a decimal JSON string - `leavesQty` (string, required) — qty - cumQty at a live status; 0 at any terminal. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw - `orderId` (string, required) — int64 as a decimal JSON string - `orderType` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `LIMIT`, `MARKET` - `orgId` (integer, required) — Owner-stamped. - `provenance` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `OWNER`, `CONNECTOR`, `ACK`, `PUSH`, `QUERY`, `SWEEP` - `qty` (string, required) — money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw - `reason` (enum, required) — The transition's cause when one applies (UNKNOWN otherwise); the raw venue leg rides venueCode/venueText. UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `USER_REQUESTED`, `VENUE_INITIATED`, `POST_ONLY_WOULD_CROSS`, `MMP`, `SELF_TRADE_PREVENTED`, `IOC_REMAINDER`, `FOK_UNFILLED`, `UNSUPPORTED_AT_VENUE`, `VENUE_REJECTED`, `INSTRUCTION_FRESHNESS_EXPIRED`, `RECONCILE_PROOF`, `OWNER_TIMEOUT`, `VENUE_REFERENCE_MISSING` - `side` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `BUY`, `SELL` - `status` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `QUEUED`, `INSTRUCTED`, `OPEN`, `PARTIALLY_FILLED`, `FILLED`, `CANCELED`, `REJECTED`, `EXPIRED`, `INSTRUCTION_EXPIRED`, `EXPIRED_UNCONFIRMED`, `NOT_FOUND_AT_VENUE` - `timeInForce` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `GTC`, `IOC`, `FOK`, `GTD` - `tradingPolicyId` (integer, required) — Which trading policy row — the organisation-wide default or a per-instrument one — the validation ran against. - `tradingPolicyVersion` (string, required) — The attribution pin's version half. int64 as a decimal JSON string - `transition` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict - Allowed values: `UNKNOWN`, `SUBMITTED`, `INSTRUCTED`, `ACKNOWLEDGED`, `OPENED`, `TRADE`, `CANCEL_REQUESTED`, `CANCEL_REJECTED`, `CANCELED`, `REJECTED`, `EXPIRED`, `INSTRUCTION_EXPIRED`, `EXPIRED_UNCONFIRMED`, `NOT_FOUND_AT_VENUE`, `RECONCILE_REQUESTED`, `RESTATED`, `SNAPSHOT` - `userId` (integer, required) — The submitting user; actors of later commands ride those commands and the envelope's causation, never restamped here. - `venueText` (string, required) — The last reason triple's text leg; empty when none. - `version` (string, required) — Per-order, monotonic, bumped on every row; a restored snapshot restates the last version. int64 as a decimal JSON string - `avgPx` (string, optional, nullable) — Derived from the deduplicated execution set (half-even rounding); 0 = no fills. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw; null when the 0 sentinel means unset - `bookId` (string, optional, nullable) — int64 as a decimal JSON string - `cancelRequestedAtNs` (string, optional, nullable) — The venue-async cancel window's base: set by CANCEL_REQUESTED, cleared (0) by CANCEL_REJECTED, mooted by terminals; feeds the pending-cancel backstop timer. Consumers answer 'is a cancel in flight' as live status AND nonzero here — there is no PENDING_CANCEL status to watch for. int64 as a decimal JSON string - `instructedAtNs` (string, optional, nullable) — First INSTRUCTED evidence time; 0 until instructed. int64 as a decimal JSON string - `isExecutionsComplete` (boolean, optional) — Accounting closure: true if and only if the deduplicated execution set reconciles against the lifecycle (FILLED: the set equals qty; other terminals: the set equals venueCumQty where reported). False keeps the reconcile lane chasing fills — a venue's terminal status stands while this is false. a boolean; absent reads false - `isPostOnly` (boolean, optional) — a boolean; absent reads false - `isReduceOnly` (boolean, optional) — a boolean; absent reads false - `lastFillPx` (string, optional, nullable) — money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw; null when the 0 sentinel means unset - `lastFillQty` (string, optional, nullable) — The most recent leg reported for this order, for a merged FIX-style rendering (LastQty/LastPx); 0 = none. On a bust or correction it describes the referenced trade, not the surviving fill, and a report about no leg carries the previous value forward — read cumQty/avgPx, never this pair, for what the set currently stands behind. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw; null when the 0 sentinel means unset - `price` (string, optional, nullable) — money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw; null when the 0 sentinel means unset - `reconcileRequestedAtNs` (string, optional, nullable) — The base of the venue-side reconcile window, the sibling of cancelRequestedAtNs: set by RECONCILE_REQUESTED, cleared (0) by the venue evidence that answers it. Stored rather than derived from the transition, because a restored snapshot restates every row as SNAPSHOT and a derived window would differ on a warm-started member. Consumers answer 'is a reconcile outstanding' as non-zero here — never by watching for a transition. int64 as a decimal JSON string - `venueCode` (integer, optional, nullable) - `venueCumQty` (string, optional, nullable) — The venue's claimed cumulative — the cross-check watermark behind isExecutionsComplete; -1 = never reported. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw; null when the -1 sentinel means unset - `venueTsNs` (string, optional, nullable) — The per-order venue-time watermark; 0 = no venue evidence yet. int64 as a decimal JSON string - `unscaled` (boolean, optional, deprecated) — Never present since 0.3.3: every money value on this API states its own scale on the wire — a policy amount or cap since 0.3.3, an order's and an execution's since 0.3.2, a balance's since 0.3.1 — so a row is never served raw, whether or not this member holds the asset or instrument it references. Kept, deprecated, so a client generated from 0.3.2 still compiles; it goes at the next major. ## Errors ### 400 Submit Orders Request Bad Request Error Refused at the door — nothing reached the platform and the key was not journaled: a missing or malformed `Idempotency-Key` or `If-Match`, malformed JSON, a body `userId`, a body restating the path or `If-Match` differently, a money string off its `pattern` (an exponent, a plus sign, a bare point, surrounding whitespace) or past its `maxLength`, or one no value here can state (over 18 fractional digits, or past a 64-bit integer at its own scale), or any other value outside the schema. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 401 Submit Orders Request Unauthorized Error No bearer token, or one that does not verify. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 403 Submit Orders Request Forbidden Error Authenticated, but not admitted. `FORBIDDEN_PRINCIPAL`: a token with no `org_id`, a non-ASCII `org_id` or `sub`, a disabled user, or a local binding with no user. `AWAITING_ADMISSION`: your user is not yet admitted — every route but `GET /me` answers this until an administrator admits you. `ORG_NOT_ACTIVE`: your organisation is suspended, pending activation, retired or unregistered. The record owners' 403s (`CAPABILITY_DENIED`, `SELF_APPROVAL`, `NOT_PROPOSER`, …) are refusals on the platform's stream: they carry the position header, and a retried key replays them with `Idempotent-Replay`. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 409 Submit Orders Request Conflict Error The record owner's refusal, by class: 409 for a state or uniqueness refusal, 422 for a field or reference refusal — a fact on the platform's stream, so it carries the position header and a retried key replays it. The same statuses also carry two door refusals that are never journaled: 409 `IDEMPOTENCY_KEY_REUSED` and, on `POST /orders`, 422 `INSTRUMENT_NOT_LIVE` for a symbol this member holds no instrument under and 422 `ACCOUNT_NOT_ACTIVE` for a display name no live account of your org holds (the owner answers both codes, as facts, to an id it will not trade) — a retry takes fresh. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 413 Submit Orders Request Content Too Large Error The platform refused the command's size (`TOO_LARGE`); nothing was submitted, a retry takes fresh. Not expected for any route here. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 422 Submit Orders Request Unprocessable Entity Error The record owner's refusal, by class: 409 for a state or uniqueness refusal, 422 for a field or reference refusal — a fact on the platform's stream, so it carries the position header and a retried key replays it. The same statuses also carry two door refusals that are never journaled: 409 `IDEMPOTENCY_KEY_REUSED` and, on `POST /orders`, 422 `INSTRUMENT_NOT_LIVE` for a symbol this member holds no instrument under and 422 `ACCOUNT_NOT_ACTIVE` for a display name no live account of your org holds (the owner answers both codes, as facts, to an id it will not trade) — a retry takes fresh. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 429 Submit Orders Request Too Many Requests Error Shed at once: `INBOX_FULL` or `IN_FLIGHT_FULL` (this member's bounds; nothing queued, the key not journaled), the intake's `RATE_LIMITED`, or the orders owner's `RATE_CEILING` (the organisation's per-minute ceiling — a refusal on the stream, replayed like any). `Retry-After` says when. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 500 Submit Orders Request Internal Server Error The gateway failed to serve (`INTERRUPTED`, `INTERNAL_ERROR`, `PROJECTION_MISS`); the operation record, if one exists, is still readable. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ### 503 Submit Orders Request Service Unavailable Error This member cannot carry the write now: `NOT_PRIMED` (still catching up), `NOT_SERVING` (a read-only or not-ready member), `OWNER_ABSENT` (the record owner has no active member), `INTAKE_UNAVAILABLE` (no credential store here), or the platform's own outcome for a command lost in transit. Nothing was journaled; retry against a serving member. - `error` (ErrorError, required) - `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry. ## Types ### ErrorError - `code` (string, required) — The code to branch on — stable and append-only: treat one you do not know by its HTTP status. The gateway's own: - 400: `MALFORMED_REQUEST`, `MISSING_IDEMPOTENCY_KEY`, `INVALID_IDEMPOTENCY_KEY`, `INVALID_IF_MATCH` - 401: `UNAUTHENTICATED` - 403: `FORBIDDEN_PRINCIPAL`, `AWAITING_ADMISSION`, `ORG_NOT_ACTIVE`, `CAPABILITY_DENIED` (the credential intake) - 404: `NOT_FOUND`, `UNKNOWN_OPERATION` - 409: `IDEMPOTENCY_KEY_REUSED`, `INTAKE_KEY_REUSED` - 413: `TOO_LARGE`, `PAYLOAD_TOO_LARGE` - 422: `INSTRUMENT_NOT_LIVE` and `ACCOUNT_NOT_ACTIVE` (`POST /orders`: a symbol or an account name nothing here holds — the orders owner answers the same codes to an unheld id), `VENUE_UNSUPPORTED`; `SCALE_UNKNOWN` (retired: only a member below `0.3.4` answers it) - 429: `INBOX_FULL`, `IN_FLIGHT_FULL`, `RATE_LIMITED` - 500: `INTERRUPTED`, `INTERNAL_ERROR`, `PROJECTION_MISS` - 503: `NOT_PRIMED`, `NOT_SERVING`, `OWNER_ABSENT`, `INTAKE_UNAVAILABLE`, `BALANCES_UNAVAILABLE`, `LOST`, `REJECTED_NOT_REGISTERED`, `REJECTED_NOT_ACTIVE` The record owners' refusals ride verbatim — `OrgRegisterRejected.reason` and `OrderRejected.reason` list them, and the guide's Errors section maps each to its status. - `message` (string, optional) — Free text for humans; may change without notice — never parse it. ## Examples **Request** ```json { "side": "UNKNOWN", "orderType": "UNKNOWN", "timeInForce": "UNKNOWN", "qty": "qty" } ``` **Response** ```json { "acceptedAtNs": "acceptedAtNs", "accountId": 1, "clientOrderId": "clientOrderId", "credentialId": 1, "cumQty": "cumQty", "externalRef": "externalRef", "globalSequence": "globalSequence", "instrumentId": "instrumentId", "leavesQty": "leavesQty", "orderId": "orderId", "orderType": "UNKNOWN", "orgId": 1, "provenance": "UNKNOWN", "qty": "qty", "reason": "UNKNOWN", "side": "UNKNOWN", "status": "UNKNOWN", "timeInForce": "UNKNOWN", "tradingPolicyId": 1, "tradingPolicyVersion": "tradingPolicyVersion", "transition": "UNKNOWN", "userId": 1, "venueText": "venueText", "version": "version", "avgPx": "avgPx", "bookId": "bookId", "cancelRequestedAtNs": "cancelRequestedAtNs", "instructedAtNs": "instructedAtNs", "isExecutionsComplete": true, "isPostOnly": true, "isReduceOnly": true, "lastFillPx": "lastFillPx", "lastFillQty": "lastFillQty", "price": "price", "reconcileRequestedAtNs": "reconcileRequestedAtNs", "venueCode": 1, "venueCumQty": "venueCumQty", "venueTsNs": "venueTsNs" } ``` **SDK Code** ```python import requests url = "https://api.example.com/orders" payload = { "side": "UNKNOWN", "orderType": "UNKNOWN", "timeInForce": "UNKNOWN", "qty": "qty" } headers = { "Idempotency-Key": "Idempotency-Key", "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.example.com/orders'; const options = { method: 'POST', headers: { 'Idempotency-Key': 'Idempotency-Key', Authorization: 'Bearer ', 'Content-Type': 'application/json' }, body: '{"side":"UNKNOWN","orderType":"UNKNOWN","timeInForce":"UNKNOWN","qty":"qty"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.example.com/orders" payload := strings.NewReader("{\n \"side\": \"UNKNOWN\",\n \"orderType\": \"UNKNOWN\",\n \"timeInForce\": \"UNKNOWN\",\n \"qty\": \"qty\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Idempotency-Key", "Idempotency-Key") req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.example.com/orders") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Idempotency-Key"] = 'Idempotency-Key' request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"side\": \"UNKNOWN\",\n \"orderType\": \"UNKNOWN\",\n \"timeInForce\": \"UNKNOWN\",\n \"qty\": \"qty\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.example.com/orders") .header("Idempotency-Key", "Idempotency-Key") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"side\": \"UNKNOWN\",\n \"orderType\": \"UNKNOWN\",\n \"timeInForce\": \"UNKNOWN\",\n \"qty\": \"qty\"\n}") .asString(); ``` ```php request('POST', 'https://api.example.com/orders', [ 'body' => '{ "side": "UNKNOWN", "orderType": "UNKNOWN", "timeInForce": "UNKNOWN", "qty": "qty" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', 'Idempotency-Key' => 'Idempotency-Key', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.example.com/orders"); var request = new RestRequest(Method.POST); request.AddHeader("Idempotency-Key", "Idempotency-Key"); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"side\": \"UNKNOWN\",\n \"orderType\": \"UNKNOWN\",\n \"timeInForce\": \"UNKNOWN\",\n \"qty\": \"qty\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Idempotency-Key": "Idempotency-Key", "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "side": "UNKNOWN", "orderType": "UNKNOWN", "timeInForce": "UNKNOWN", "qty": "qty" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/orders")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```