# Gasless orders

These endpoints facilitate you the creation of gasless orders, to be conducted on our system.&#x20;

### List of endpoints

#### **1. Create Gasless Order**

**Endpoint**: `POST /v1/gasless/create`

**Description**: Initiates a new gasless order by submitting the necessary trade details along with the user's signature.

**Request Body**:

```json
{
  "signature": "string",        // User's digital signature
  "tokenFrom": "string",        // Address of the source token
  "tokenTo": "string",          // Address of the destination token
  "amount": "string",           // Amount to be traded (in smallest units)
  "chainFrom": "integer",       // Source blockchain chain ID
  "chainTo": "integer",         // Destination blockchain chain ID
  "bestDex": "string"           // Preferred decentralized exchange
}
```

**Response**:

```json
{
  "success": true,
  "orderId": "string"           // Unique identifier for the created order
}
```

***

#### **2. Retrieve Typed Data for Signing**

**Endpoint**: `POST /v1/gasless/typed-data`

**Description**: Generates the structured data that the user needs to sign, ensuring the integrity and authorization of the gasless transaction.

**Request Body**:

```json
{
  "tokenFrom": "string",        // Address of the source token
  "tokenTo": "string",          // Address of the destination token
  "amount": "string",           // Amount to be traded (in smallest units)
  "chainFrom": "integer",       // Source blockchain chain ID
  "chainTo": "integer",         // Destination blockchain chain ID
  "bestDex": "string"           // Preferred decentralized exchange
}
```

**Response**:

```json
{
  "success": true,
  "typedData": {
    // Structured data object for user signature
  }
}
```

***

#### **3. Cancel Gasless Order**

**Endpoint**: `POST /v1/gasless/cancel`

**Description**: Allows the user to cancel a previously created gasless order, provided it hasn't been processed yet.

**Request Body**:

```json
{
  "orderId": "string"           // Unique identifier of the order to be cancelled
}
```

**Response**:

```json
{
  "success": true,
  "message": "Order cancelled successfully"
}
```

***

#### **4. Check Gasless Order Status**

**Endpoint**: `GET /v1/gasless/status/{orderId}`

**Description**: Retrieves the current status of a specific gasless order, enabling users to monitor its progress.

**Path Parameter**:

* `orderId`: Unique identifier of the order whose status is being queried.

**Response**:

```json
{
  "success": true,
  "orderId": "string",
  "status": "string",           // Current status (e.g., pending, processing, completed, cancelled, failed)
  "message": "string"           // Additional information about the order status
}
```

***

#### **5. Estimate Gas for Gasless Transaction**

**Endpoint**: `POST /v1/gasless/estimate`

**Description**: Provides an estimation of the gas costs associated with a proposed gasless transaction, aiding in understanding potential fees.

**Request Body**:

```json
{
  "tokenFrom": "string",        // Address of the source token
  "tokenTo": "string",          // Address of the destination token
  "amount": "string",           // Amount to be traded (in smallest units)
  "chainFrom": "integer",       // Source blockchain chain ID
  "chainTo": "integer",         // Destination blockchain chain ID
  "bestDex": "string"           // Preferred decentralized exchange
}
```

**Response**:

```json
{
  "success": true,
  "gasEstimation": "string",    // Estimated gas units required
  "feeEquivalent": "string"     // Equivalent fee in the specified token (if applicable)
}
```

***

These endpoints facilitate the creation, management, and monitoring of gasless orders, streamlining the trading process by covering gas fees on behalf of the user.

For detailed information and additional parameters, please refer to the official API documentation at <https://api.zcx.com/trade/docs#/Gasless%20Orders>.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.unizen.io/api-get-started/gasless-orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
