> ## Documentation Index
> Fetch the complete documentation index at: https://digraphsas-docs-pricing.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Limit order API integration

> Place a gasless, MEV-protected limit order over the REST API. A limit order is a Delta order with a target-price constraint: build with limitAmount, submit with type=LIMIT, end-to-end.

A **limit order** on Velora is a [Delta order](/integrate/api/delta-swap) with a target-price constraint: the user signs once, the [Portikus Network](/solver-network/portikus) fills it at or better than the limit price when the market allows, and the user pays no gas. This page walks the whole integration over the REST API. It's the Delta swap flow with two additions: you set `limitAmount` at build, and submit with `type: "LIMIT"`. Every example targets `https://api.velora.xyz`.

For the conceptual model (maker, expiry, how a limit order differs from a swap or OTC), see [Product stack → Limit orders](/overview/product-stack/limit-orders). For a typed wrapper, see [SDK → Limit orders](/sdk/products/limit-orders).

## The flow

<Steps>
  <Step title="Quote a reference price">
    `GET /v2/quote?mode=DELTA` gives the current route and the `spender` to approve. The market quote is your reference point for setting the limit. See [`GET /v2/quote`](/api-reference/delta/quote).
  </Step>

  <Step title="Approve the spender">
    Approve the Delta contract `spender` on-chain for the source token. Limit orders use approval, not a permit; see [Approvals and permit](/resources/approvals). Native source skips this; see [Native ETH (dETH)](/delta/native-eth).
  </Step>

  <Step title="Build with a limit price">
    `POST /v2/delta/orders/build` with the `route` verbatim, `owner`, a `deadline`, and `limitAmount` (your target output for SELL, or max input for BUY). See [`POST /v2/delta/orders/build`](/api-reference/delta/orders-build).
  </Step>

  <Step title="Sign and submit as LIMIT">
    The user signs `toSign`; `POST /v2/delta/orders` with `type: "LIMIT"`. See [`POST /v2/delta/orders`](/api-reference/delta/orders-submit).
  </Step>

  <Step title="Poll, or drive your UI from the order list">
    A limit order rests `ACTIVE` until a solver can meet the price, so poll on a relaxed interval or list the user's open orders.
  </Step>
</Steps>

## 1. Quote and approve

Quote exactly as for a [Delta swap](/integrate/api/delta-swap#1-quote) (`mode=DELTA`), then approve the returned `spender` for the source token. Use the quote's expected output as the baseline for the limit price you'll pin in the next step. Approve on-chain rather than with a permit, which a resting order can't rely on (see [Approvals and permit](/resources/approvals)). Selling native ETH skips the approval; see [Native ETH (dETH)](/delta/native-eth).

## 2. Build with a limit price

Pass the `delta.route` verbatim and add `limitAmount`. For a SELL order it's the minimum destination amount you'll accept (your limit price). Every Delta order requires a `deadline` (unix seconds); past it the order is unfillable.

```bash theme={null}
curl -X POST 'https://api.velora.xyz/v2/delta/orders/build' \
  -H 'Content-Type: application/json' \
  -d '{
    "route": { "...": "the delta.route from the quote, unchanged" },
    "owner": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "limitAmount": "3000000000000000000",
    "deadline": 1893456000,
    "partner": "my-app-name"
  }'
```

Setting `limitAmount` above the quoted output is what makes this a limit order rather than a market fill: the solver network only fills once it can deliver at least that much. The response is the same `{ toSign, orderHash }` as a market order.

## 3. Submit as LIMIT

The user signs `toSign` (ERC-2098 compact signature). Submit with `type: "LIMIT"`. That field is what marks the order as a resting limit order instead of an immediate fill:

```bash theme={null}
curl -X POST 'https://api.velora.xyz/v2/delta/orders' \
  -H 'Content-Type: application/json' \
  -d '{
    "chainId": 1,
    "order": { "...": "toSign.value, sent verbatim" },
    "signature": "0x...",
    "type": "LIMIT",
    "partner": "my-app-name"
  }'
```

## 4. List and cancel

List a user's open limit orders by filtering on `type`:

```bash theme={null}
curl -G 'https://api.velora.xyz/v2/delta/orders' \
  --data-urlencode 'userAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' \
  --data-urlencode 'chainId=1' \
  --data-urlencode 'type=LIMIT' \
  --data-urlencode 'page=1' \
  --data-urlencode 'limit=100'
```

To check one order, `GET /v2/delta/orders/{orderId}`, or open it in the Velora explorer at `https://explorer.velora.xyz/order/{orderId}` for a human-readable status view. That's useful for a resting limit order that may sit `ACTIVE` for a while.

Cancelling is gasless. Build the cancellation payload, have the user sign the returned `toSign` object, then post the same order IDs with the signature. It only succeeds while the order is still open or executing.

```bash theme={null}
curl -X POST 'https://api.velora.xyz/v2/delta/orders/build/cancellation' \
  -H 'Content-Type: application/json' \
  -d '{ "orderIds": ["..."] }'
```

```bash theme={null}
curl -X POST 'https://api.velora.xyz/v2/delta/orders/cancel' \
  -H 'Content-Type: application/json' \
  -d '{ "orderIds": ["..."], "signature": "0x..." }'
```

See [`GET /v2/delta/orders`](/api-reference/delta/orders-list), [`POST /v2/delta/orders/build/cancellation`](/api-reference/delta/orders-build-cancellation), and [`POST /v2/delta/orders/cancel`](/api-reference/delta/orders-cancel).

## Partner fee

Pass `partner` on the quote, build, and submit calls (plus optional `partnerAddress`, `partnerFeeBps`, `partnerTakesSurplus`), exactly as for a Delta swap. See [Monetize](/sdk/monetize).

## Related pages

* [Delta swap](/integrate/api/delta-swap): the base flow a limit order extends.
* [TWAP](/integrate/api/twap), the other scheduled Delta order type.
* [Native ETH (dETH)](/delta/native-eth): selling native ETH as a Delta source.
* [Product stack → Limit orders](/overview/product-stack/limit-orders) for the conceptual model.
* [Delta API reference](/api-reference/delta/overview) lists full parameters and response schemas.
* [SDK → Limit orders](/sdk/products/limit-orders), a typed wrapper over this flow.
