---
title: "Close a routed position across both legs of a market link"
method: POST
path: "/orders/route-close"
tags: ["Routing"]
---

# Close a routed position across both legs of a market link

`POST /orders/route-close`

## Request

- Base URL: `https://execution.kairos.trade`
- URL: `https://execution.kairos.trade/orders/route-close`
- Auth: API key in header `X-Client-Id` and API key in header `X-Api-Key` and API key in header `X-Api-Secret`

Sells the holdings on each leg of an approved market link, at a per-leg floor price derived from that leg's best bid minus `slippage_cents` (never below `0.01`). Holdings are rounded down to the venue's share precision, and a leg with less than `0.01` sellable is skipped.
**`leg_caps` is fail-closed:** if you send it, a leg with no matching entry is excluded from the close entirely rather than closed in full.
Like `route-buy`, this is a `200` with `status: submitting` and per-leg `error` strings; it is gated by `ROUTED_EXECUTION_ENABLED`.
**Auth & scope.** Requires the mutation gate; per-leg `trade:execute` and provider checks happen on each child order.

## Request body

- OrderRouteCloseRequest: Body for `POST /orders/route-close`.
  - `provider` string, required
  - `market_id` string, required
  - `side` 'yes' | 'no', nullable
  - `outcome` string, nullable
  - `slippage_cents` integer, nullable: Defaults to `5`. Must be in `[1, 99]` if provided.
  - `leg_caps` object[], nullable: Per-venue size caps. FAIL-CLOSED: when `leg_caps` is present, any leg with no matching entry is EXCLUDED from the close entirely rather than closed in full.
    - `provider` string, required
    - `quantity` string, required

## Response `200`

Close dispatched. Inspect `legs[].error`.

- OrderRouteCloseResponse: Response for `POST /orders/route-close`.
  - `route_order_id` string, uuid, required
  - `status` 'submitting', required
  - `closing` string, required
  - `legs` object[], required
    - `provider` string, required
    - `order_id` string, uuid, nullable
    - `holdings` string, required
    - `floor_price` string, nullable
    - `error` string, nullable: Per-leg failure at HTTP 200, e.g. `no bid available for floor — leg not sold` or `no floor computed`.
  - `notes` string[], required

## Other responses

- `400`: `slippage_cents` outside `[1, 99]`, an unresolvable `side`/`outcome`, or a malformed authenticated user id. Empty body (status code only).
- `401`: No valid credential presented — missing/invalid API-key headers or an invalid/expired session token.
- `403`: Routed execution is disabled on this deployment. Empty body (status code only).
- `422`: No approved market link, or nothing sellable after rounding and `leg_caps` filtering. Empty body (status code only).
- `500`: The position read or the parent route insert failed. Empty body (status code only).

---

[API](https://skmtc.dev/kairos/apis/kairos-order-execution-api.md) - [All operations](https://skmtc.dev/kairos/apis/kairos-order-execution-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kairos/apis/kairos-order-execution-api/revisions/9ba7d463d505?raw)
