# Get or Cancel Limit Order

Retrieve a limit order by ID or cancel it. Only the authenticated owner can access or cancel.

**Auth:** Required (`Authorization: Bearer YOUR_API_KEY`)

***

## Get limit order by id

**Endpoint:** `GET /api/v1/limit-orders/limit/{limitOrderId}`

### Path parameters

| Parameter      | Type   | Required | Description    | Example      |
| -------------- | ------ | -------- | -------------- | ------------ |
| `limitOrderId` | string | Yes      | Limit order ID | `lim_abc123` |

### Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET 'https://api.gateway.zert.com/api/v1/limit-orders/limit/e896c19b-fccd-466c-9b6d-eca6d7a6cd5a' \
  -H 'Authorization: Bearer YOUR_API_KEY'
```

{% endtab %}

{% tab title="Example Response" %}

```json
{
  "data": {
    "limitOrderId": "lim_abc123",
    "status": "open",
    "timeInForce": "GTC",
    "createdAtMs": 1745396400000,
    "updatedAtMs": 1745396400000,
    "expiresAtMs": 1745403600000,
    "minAmountOut": "1"
  },
  "meta": { "requestId": "...", "timestamp": "..." }
}
```

{% endtab %}
{% endtabs %}

***

## Cancel limit order by id

**Endpoint:** `DELETE /api/v1/limit-orders/limit/{limitOrderId}`

### Headers

| Header            | Type   | Required | Description                                                                                                                   |
| ----------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `Idempotency-Key` | string | Yes      | Required opaque dedupe token. Use UUIDv4 or ULID. Allowed characters: `A-Z`, `a-z`, `0-9`, `.`, `_`, `:`, `-`. Max 200 chars. |

### Path parameters

| Parameter      | Type   | Required | Description    | Example      |
| -------------- | ------ | -------- | -------------- | ------------ |
| `limitOrderId` | string | Yes      | Limit order ID | `lim_abc123` |

### Request body (optional)

| Field    | Type   | Description            | Example        |
| -------- | ------ | ---------------------- | -------------- |
| `reason` | string | Optional cancel reason | `user_request` |

### Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X DELETE 'https://api.gateway.zert.com/api/v1/limit-orders/limit/e896c19b-fccd-466c-9b6d-eca6d7a6cd5a' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Idempotency-Key: limit-cancel-001' \
  -H 'Content-Type: application/json' \
  -d '{"reason": "user_request"}'
```

{% endtab %}

{% tab title="Example Response" %}

```json
{
  "data": {
    "limitOrderId": "lim_abc123",
    "status": "canceled"
  },
  "meta": { "requestId": "...", "timestamp": "..." }
}
```

{% endtab %}
{% endtabs %}

## Responses

| Code | Description                               |
| ---- | ----------------------------------------- |
| 200  | OK                                        |
| 401  | Unauthorized (missing or invalid API key) |
| 403  | Forbidden (not owner)                     |
| 404  | Not found                                 |
| 503  | PG unavailable                            |

{% embed url="<https://api.gateway.zert.com/docs>" %}
Zert API — Limit Order Get/Cancel
{% endembed %}


---

# 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.zert.com/api-reference/limit-orders/limit-order-get-cancel.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.
