# HTTP — `GET /v1/userFills`

Recorded, confirmed fills for a user over an inclusive time range. Public
endpoint.

```http
GET /v1/userFills?user=0x0000000000000000000000000000000000000001&startTime=1780000000000&endTime=1780003600000
```

A parameter that breaks its rule fails the request with HTTP `400` and `invalid_request`.
The table names the `detail` of each case.

| Param | Required | Meaning |
| --- | --- | --- |
| `user` | yes | EVM address. A missing or malformed value fails with the detail `invalid_query`. |
| `startTime` | yes | Inclusive start, Unix milliseconds. Missing fails with the detail `invalid_query`. |
| `endTime` | no | Inclusive end, Unix milliseconds; defaults to now. `startTime > endTime` fails with the detail `invalid_time_range`. |
| `cursor` | no | Opaque `nextCursor` from a prior response with the same `order`. An unparseable value, or a cursor from the other order, fails with the detail `invalid_cursor`. |
| `order` | no | `asc` (default) returns fills in the order Mosaiq recorded them. `desc` returns the newest fills first. Other values fail with the detail `invalid_query`. |
| `limit` | no | Fills per page, clamped to `1` to `500`, default `500`. A value that is not an integer from `0` to `65535` fails with the detail `invalid_query`. |

The endpoint reads the database on every request. When all the read slots are
busy, it returns HTTP `503` with `temporarily_unavailable` and the detail
`public_reads_busy`, as [Busy server](/api/http-public#busy-server) describes.

```jsonc
{
  "status": "ok",
  "data": {
    "user": "0x0000000000000000000000000000000000000001",
    "userFills": [
      {
        "fillId": "123456",
        "orderId": "2a4d4983-9057-4da9-bcd7-0aa0e4185bb0",
        "cloid": "0x00000000000000000000000000000001",
        "a": "BTC",
        "venue": "lighter",
        "b": "buy",
        "size": "0.01",
        "price": "65000",
        "liquidityRole": "maker",
        "fees": { "exchange": "0.0234", "mosaiq": "0" },
        "createdAtMs": 1780000100000
      },
      {
        "fillId": "1060790150924597",
        "orderId": "0192a3b4-7c1e-7e10-9d52-2f4b0a0c9a01",
        "cloid": "0x0000000000000000000000000000a001",
        "a": "HYPE/USDC",
        "venue": "hyperliquid",
        "b": "buy",
        "size": "0.28",
        "price": "36.89",
        "liquidityRole": "taker",
        "fees": { "exchange": "0.000196", "feeToken": "HYPE", "exchangeRefund": "0.005681", "mosaiq": "0.001032" },
        "createdAtMs": 1780000200000
      },
      {
        "fillId": "1060790150925001",
        "orderId": "0192a3b4-7c1e-7e10-9d52-2f4b0a0c9a02",
        "cloid": "0x0000000000000000000000000000a002",
        "a": "BTC",
        "venue": "hyperliquid",
        "b": "sell",
        "size": "1.5",
        "price": "64890",
        "liquidityRole": "taker",
        "fees": { "exchange": "43.80075", "mosaiq": "9.7335" },
        "createdAtMs": 1780000300000,
        "liquidation": {
          "liquidatedUser": "0x0000000000000000000000000000000000000001",
          "oraclePx": "64950.5",
          "method": "market"
        }
      }
    ],
    "nextCursor": "uf1_42",
    "hasMore": false
  },
  "server_time_ms": 1780003600100
}
```

## Fields

| Field | Meaning |
| --- | --- |
| `fillId` | The fill ID, opaque. `(venue, fillId)` identifies a fill, because ID spaces differ per venue. A few prefixes name fills that no venue printed: `xc:`, `lt:`, and `ls:` (below). |
| `orderId`, `cloid` | The Mosaiq order and its client order ID. |
| `a`, `venue`, `b` | The asset, the venue code, and the side (`buy` or `sell`). |
| `size`, `price` | The filled size and the fill price. |
| `liquidityRole` | `maker` or `taker`. |
| `fees` | The fees of the fill (below). Absent on old fills that Mosaiq recorded without their fees. |
| `createdAtMs` | When Mosaiq recorded the fill, in Unix milliseconds. With `order=asc`, rows follow the recording order, not the execution time, so `createdAtMs` can decrease between rows. |
| `liquidation` | Present on a fill of a liquidation of the account (below). Absent on every other fill. |
| `settlement` | Present on the close of a position on a market that its venue settled (below). Absent on every other fill. |

On Lighter, a match between two Mosaiq traders has a `fillId` of the form
`xc:{taker order}:{maker order}:{m|t}`. It matches no Lighter trade.

### Fees

| Field | Meaning |
| --- | --- |
| `fees.exchange` | The venue fee. In USDC on a perp fill. On a spot fill, the fee that Hyperliquid took, in `fees.feeToken`. |
| `fees.feeToken` | The token of `fees.exchange` on a spot fill. Absent on a perp fill. |
| `fees.exchangeRefund` | The USDC that Mosaiq paid back to the account's cash because the spot venue fee was above the best published spot rate ([Fees](/concepts/fees#spot-venue-fee)). Absent on a perp fill, and when Mosaiq paid nothing back. |
| `fees.mosaiq` | The Mosaiq fee, in USDC. |
| `fees.priority` | The Hyperliquid priority fee of the fill, in USDC, for an `Ioc` or market order sent with `priorityFeeBps`. Absent when the fill paid none. An `Alo` order pays its priority fee once, at placement, so its fills show none. |

On a spot fill, the venue fee in USDC is `fees.exchange × price - fees.exchangeRefund`,
within rounding. In the example, Hyperliquid took 0.000196 HYPE from a buy of
0.28 HYPE, so the account received 0.279804 HYPE. The venue fee is
0.000196 × 36.89 - 0.005681 = 0.00154944 USDC, the 1.5 bps rate.

### Liquidation fills

`liquidation` is present on a fill of an order that Mosaiq sent to liquidate
the account, and on a House takeover (see [Liquidation](/concepts/liquidation)).
It is absent on the fill of the other side of a trade with a liquidated
account.

| Field | Meaning |
| --- | --- |
| `liquidation.liquidatedUser` | The address of the liquidated account, the `user` of the request. |
| `liquidation.oraclePx` | The oracle price at which Mosaiq sized the liquidation order: the Hyperliquid `oraclePx` or the Lighter index price. Mosaiq has no mark price, so there is no `markPx`. Absent on fills of liquidation orders sent before Mosaiq recorded that price. |
| `liquidation.method` | `market` for the fill of a liquidation order, `backstop` for a House takeover. Treat an unknown value as a liquidation. |
| `liquidation.penaltyUsdc` | The liquidation penalty that the fill paid to Mosaiq, in USDC: half the maintenance margin rate times the notional of the fill. Absent when the fill paid none, and on fills recorded before Mosaiq showed it. |

In the example, Mosaiq sized the order at 64950.5 and the order sold at 64890.

A venue refuses an order below its minimum size, for example 10 USD on
Hyperliquid. When a liquidation has only positions that small left, the Mosaiq
House takes over each of them, whole, at the oracle price, so that the
liquidation can end. No venue sees a takeover. The account sees each takeover
as a fill:

* `liquidation.method` is `backstop`.
* `price` and `liquidation.oraclePx` are that oracle price.
* `liquidityRole` is `taker`, and `fees` are the venue and Mosaiq taker fees of
  the account.
* No order exists. `fillId` is `lt:` followed by the takeover ID, `orderId` is
  the takeover ID, and `cloid` is the takeover ID in cloid form.

### Settlement closes

When a venue delists a market and settles its positions in cash, Mosaiq closes
your position at the venue's settlement price. The close is a fill with a
`settlement` object:

| Field | Meaning |
| --- | --- |
| `settlement.kind` | `delisting`. Treat an unknown value as a settlement. |
| `settlement.listing` | The listing that the venue settled. |
| `settlement.settledAtMs` | When the venue settled it, in Unix milliseconds. |
| `settlement.realizedPnlUsdc` | The profit or loss of the close, in USDC. |

`price` is the settlement price and `liquidityRole` is `taker`. `fees` holds
the venue's settlement fee, if the venue charges one, and no Mosaiq fee. No
order exists. `fillId` is `ls:` followed by the close ID, `orderId` is the
close ID, and `cloid` is the close ID in cloid form.

## Backfill in recording order

`order=asc` is the default. A page holds at most `limit` fills. Set an explicit
`endTime` for a backfill. While `hasMore` is `true`, pass `nextCursor` as
`cursor` and keep `user`, `startTime`, and `endTime` unchanged. When `hasMore`
is `false`, `nextCursor` covers every fill recorded when the response started.
Reuse it to poll for fills recorded later in the same time window, including
fills with an older `createdAtMs`.

Start without a cursor when changing the user or time window. Reusing a cursor
with a wider window can skip fills that were previously outside the range.

## Read the newest fills first

`order=desc` serves history views that show the newest fills first and load
older fills on demand. The first page holds the newest fills at or before
`endTime`:

```http
GET /v1/userFills?user=0x0000000000000000000000000000000000000001&startTime=0&order=desc&limit=20
```

```jsonc
{
  "status": "ok",
  "data": {
    "user": "0x0000000000000000000000000000000000000001",
    "userFills": [
      // Up to 20 fills, newest createdAtMs first, with the fields shown above.
    ],
    "nextCursor": "ufd1_1780000100_123456000_6f1c2a3e-9b1d-4c8e-a5f2-0d3b7c9e1a24",
    "hasMore": true
  },
  "server_time_ms": 1780003600100
}
```

To read the next older page, pass `nextCursor` as `cursor` and keep `user`,
`startTime`, `endTime`, and `order` unchanged. `limit` can change between pages.
Each page starts strictly after the previous one. When `hasMore` is `false`,
the response has no `nextCursor`.

Rows sort by `createdAtMs`, newest first, then by an internal fill key. For fills
recorded before 2026-08-25, the order can differ from `createdAtMs` by up to 27
hours.

A walk returns each fill at most once, and pages never overlap. New fills sort
at the top, so a walk that already started does not show them. Start again
without a cursor to see fills recorded since the first page. A page can hold
fewer than `limit` fills while `hasMore` is `true` only when the time window
starts or ends before 2026-08-25.

`order=desc` does not replace the `asc` cursor for synchronization. Use
`order=asc` to backfill after a WebSocket gap.

## WebSocket recovery

The `userFills` topic does not replay a gap. After a disconnect, subscribe
again and buffer live fills, query this endpoint with a conservative inclusive
`startTime`, follow `nextCursor` until `hasMore` is `false`, merge, and
deduplicate by `(venue, fillId)`.
