---
title: "Close an order"
method: POST
path: "/v2/orders/{order_id}/close/"
tags: ["Orders"]
---

# Close an order

`POST /v2/orders/{order_id}/close/`

## Request

- Base URL: `https://magicmarkets.com` (the document declares no server; this is the origin it was published from)
- URL: `https://magicmarkets.com/v2/orders/{order_id}/close/`
- Auth: API key in header `X-Api-Key`

Close (cancel) a single open order. The order's lifecycle update is delivered on the WebSocket as an `["order", ...]` entry with `closed: true` and `close_reason: "cancelled"`. The response `data` field is always `null`.

## Path parameters

- `order_id` integer, required

## Response `200`

Order closed.

## Other responses

- `400`: The order exists but is already closed or settled (`order_closed`).
- `401`: Authentication failed - API key missing, malformed, or rejected.
- `403`: Authorization failed - the key is valid but cannot perform this action.
- `404`: The order id is unknown (`not_found`).
- `429`: Rate limit hit. Honour the `Retry-After` header.
- `500`: Unexpected internal error. Quote `data[1]` (the token) when contacting support.

---

[API](https://skmtc.dev/magicmarkets/apis/magicmarkets-api.md) · [All operations](https://skmtc.dev/magicmarkets/apis/magicmarkets-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magicmarkets/apis/magicmarkets-api/revisions/00c2a7dcce2a?raw)
