# GET /orders/{id} — Get an order

Order status, and the key once the order is completed.

Returns only your own orders: someone else's order and a missing one both give `404`.

The key (`key`) comes only here and in the `POST /purchase` response — never in a webhook.

Authorization: header `X-Entity-Key`.

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | integer | yes | Order ID, a positive integer. Example: `12`. |

**Responses**

- `200 OK` — Completed

```json
{
  "status": "success",
  "order": {
    "id": 1842,
    "productId": 12,
    "quantity": 1,
    "price": 1490,
    "currency": "RUB",
    "status": "completed",
    "failureReason": null,
    "idempotencyKey": "order-7731",
    "webhookStatus": "delivered",
    "createdAt": "2026-11-13T12:36:53.000Z",
    "updatedAt": "2026-11-13T12:37:10.000Z",
    "key": [
      {
        "serial": "ABCDE-FGHIJ-KLMNO",
        "type": "text",
        "name": "Dead by Daylight"
      }
    ]
  }
}
```

- `200 OK` — Pending

```json
{
  "status": "success",
  "order": {
    "id": 1842,
    "productId": 12,
    "quantity": 1,
    "price": 1490,
    "currency": "RUB",
    "status": "pending",
    "failureReason": null,
    "idempotencyKey": "order-7731",
    "webhookStatus": null,
    "createdAt": "2026-11-13T12:36:53.000Z",
    "updatedAt": "2026-11-13T12:37:10.000Z"
  }
}
```

- `200 OK` — Failed

```json
{
  "status": "success",
  "order": {
    "id": 1842,
    "productId": 12,
    "quantity": 1,
    "price": 1490,
    "currency": "RUB",
    "status": "failed",
    "failureReason": "product_unavailable",
    "idempotencyKey": "order-7731",
    "webhookStatus": "delivered",
    "createdAt": "2026-11-13T12:36:53.000Z",
    "updatedAt": "2026-11-13T12:37:10.000Z"
  }
}
```

- `400 Bad Request` — Invalid ID

```json
{
  "status": "error",
  "message": "Invalid order id"
}
```

- `404 Not Found` — Not found

```json
{
  "status": "error",
  "message": "Order not found"
}
```

- `500 Internal Server Error` — Key temporarily unavailable

```json
{
  "status": "error",
  "code": "key_unavailable",
  "message": "The order is paid but its key can't be retrieved right now; contact support",
  "order": {
    "id": 1842,
    "productId": 12,
    "quantity": 1,
    "price": 1490,
    "currency": "RUB",
    "status": "completed",
    "failureReason": null,
    "idempotencyKey": "order-7731",
    "webhookStatus": "delivered",
    "createdAt": "2026-11-13T12:36:53.000Z",
    "updatedAt": "2026-11-13T12:37:10.000Z"
  }
}
```

- `401 Unauthorized` — No key

```json
{
  "status": "error",
  "message": "Missing X-Entity-Key header"
}
```

- `403 Forbidden` — Invalid key

```json
{
  "status": "error",
  "message": "Invalid entity key"
}
```

- `429 Too Many Requests` — Rate limited

```json
{
  "status": "error",
  "message": "Too many requests, try again later"
}
```

Web version: https://docs.merchant.dbdlobby.com/en/reference/get-order
