# Following the orders

#### **Tracking the Status of a Gasless Order**

To monitor the status of a gasless order and provide updates to the user, use the following endpoint:

**Endpoint:**

`/v1/gasless/status/{orderId}`

***

#### **Description**

This endpoint allows you to query the status of an order created via the gasless trading flow. It provides real-time information about the order's current state, enabling you to keep the user informed.

***

#### **How to Use**

1. **Call the Endpoint**:\
   Replace `{orderId}` with the unique identifier of the order you want to track:

   ```bash
   GET /v1/gasless/status/12345
   ```
2. **Response**:\
   The endpoint returns the current status of the order. Example response:

   ```json

   {
       "response": {
           "id": "561e1e2f-c32b-48c7-bb85-b9bc599d4d91",
           "address": "0x2472d3EF4bF71af00c3dE490a5a53A99CbAC0791",
           "chainFrom": 42161,
           "tokenFrom": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
           "chainTo": 0,
           "tokenTo": "0x0000000000000000000000000000000000000000",
           "amount": "6623429",
           "fee": "19898",
           "amountOutMin": "1972679740777741",
           "swapCall": "{\"order\":{\"user\":\"0x2472d3...6bacb2526197387b9e41c\"}",
           "status": "completed", // Possible values: "pending", "processing", "completed", "cancelled", "faile
           "createdAt": "2024-12-23T13:51:34.188129Z",
           "deadLineAt": "2024-12-23T14:21:30Z",
           "canceledAt": null,
           "completedAt": "2024-12-23T13:51:38.019587Z",
           "failedAt": null,
           "signatureCreated": "0x2728c5bd1d666623533d899f6f60d4a49a0d597d4ba1fc7e24079e1cea8d9db26f8b9b63f927f9614060fcafaef60f0ca769a7a77f2af6bacb2526197387b9e41c",
           "signatureCancel": null,
           "failureMsg": null,
           "txCompleted": "0x49fdec98eac1fd27...9361b375", // tx hash when the order is created 
           "apiKey": 17,
           "amountDeducted": "19898",
           "gasPrice": "20000000",
           "estimatedGas": "1304999",
           "gasUsed": "1117733",
           "nativeUsdPrice": "3312.41"
       }
   }
   ```

***

#### **Possible Status Values**

| Status       | Description                                              |
| ------------ | -------------------------------------------------------- |
| `pending`    | The order has been created and is awaiting processing.   |
| `processing` | The order is currently being executed by the system.     |
| `completed`  | The order has been successfully processed and finalized. |
| `cancelled`  | The order was cancelled before it could be executed.     |
| `failed`     | The order could not be processed due to an error.        |

***

#### **Key Notes**

* **Real-Time Updates**: Poll this endpoint to get real-time updates about the order status.
* **Order Information**: Use the `orderId` provided when the order was created to query its status.
* **User Feedback**: Use the returned status and message to display appropriate feedback to the user.

This endpoint ensures transparency and allows you to keep users informed about the progress of their gasless trades. 🚀
