# Place an order (limit) ## Goal Place a limit order and query its progress through the order workflow. This guide uses the *limit* order type: you submit the order with a limit price to be done at that price or better. ## Prerequisites - Your REST API app. - Integral API login with trading permission. - Your organization provisioned with at least one provider who streams ESP spot prices. ## Steps ```mermaid flowchart TD LOGIN(Step 1: Login) --> PLACEORDER(Step 2: Place order) --> QUERY(Step 3: Query order) click LOGIN "#step-1-login" click PLACEORDER "#step-2-place-order" click QUERY "#step-3-query-order" ``` ### Step 1: Login Use the [Login and get token](/openapi/integral-api-reference/rest/authentication-api/login) endpoint. See the related [Login](/developer-portal/tutorials/tutorialauth/) tutorial. Your access token is in `SSO_TOKEN` of the response header. Your token is valid for limited time. Pass the `SSO_TOKEN` cookie value with all of your subsequent API requests. ### Step 2: Place order Use the [Place order](/openapi/integral-api-reference/rest/orders/placeorder) endpoint. You must send the following with your order: * `type=Limit` * `timeInForce` * `price` To get your order status, you must query your order. After the initial success/fail response, status updates are not pushed to you. ### Step 3: Query order To get your order status, you must query your order. After the initial success/fail response, status updates are not pushed to you. Use one of the following endpoints: * [Query order (server ID)](/openapi/integral-api-reference/rest/orders/queryorderbyserverid) * [Query order (client ID or all active orders)](/openapi/integral-api-reference/rest/orders/queryorderbyclientid) The diagram shows the values returned in the `status` field in the response and their context in the order workflow. div Order status transition (at best order, success) ```mermaid stateDiagram-v2 direction LR RECEIVED: Status = RECEIVED\nHTTP code 202 NEW: Status = NEW\n(Intermediate state)\nHTTP code 200 FILLED: Status = FILLED\nHTTP code 200 EXPIRED: Status = EXPIRED\nHTTP code 200 REJECTED: Status = REJECTED\nHTTP code 200 [*] --> RECEIVED: Place order RECEIVED --> NEW: Query order RECEIVED --> REJECTED: Query order NEW --> FILLED: Query order NEW --> EXPIRED: Query order NEW --> REJECTED: Query order FILLED --> [*] EXPIRED --> [*] REJECTED --> [*] ``` div Order status transition (failure) ```mermaid stateDiagram-v2 direction LR ERROR: Error object\nHTTP code 400/5xx [*] --> ERROR: Place order ERROR --> [*] ```