# allFills - Global Fill History

Use `allFills` when you need a recent global sample of indexed Hyperliquid executions across users and markets. Every row includes `user`.

## Endpoints

REST-style Info API:

```text
POST https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/info
```

JSON-RPC:

```text
POST https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/jsonrpc
```

## Billing

`allFills` responses are billed by the number of fill objects returned, not as one response per HTTP request.
A response with `2,000` fills counts as `2,000` responses/API credits.

Requests that return an empty array are billed as `0` responses/API credits and do not count against usage. Error responses are not charged.

## Request Parameters

- `type` (`string, required`): Must be allFills for /info REST requests. Omit this field for JSON-RPC.
- `coin` (`string, optional`): Exact Hyperliquid market symbol, for example BTC. When supplied, only rows for that market are returned.
- `limit` (`number, optional`): Maximum rows to return, capped at 2000.

## Request Example

```bash
curl -X POST "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/info" \
  -H "content-type: application/json" \
  -d '{
  "type": "allFills",
  "coin": "BTC",
  "limit": 100
}'
```

## Response Fields

- `fills` (`array, required`): Array of fill objects. /info returns this array directly; JSON-RPC returns it under result. Empty matches return an empty array and are billed as 0 responses/API credits. Billing counts one response/API credit per fill object returned.
- `coin` (`string, required`): Hyperliquid market symbol.
- `px` (`string, required`): Execution price as a decimal string.
- `sz` (`string, required`): Fill size as a decimal string.
- `side` (`string, required`): B for bid/buy side, A for ask/sell side.
- `time` (`number, required`): Fill timestamp in Unix milliseconds.
- `startPosition` (`string, optional`): User position before the fill, when available.
- `dir` (`string, optional`): Position direction.
- `closedPnl` (`string, optional`): Realized PnL as a decimal string.
- `hash` (`string, optional`): Hyperliquid transaction hash.
- `oid` (`number, optional`): Hyperliquid order ID.
- `crossed` (`boolean, required`): Whether the order crossed the spread.
- `fee` (`string, optional`): User fee amount.
- `tid` (`number, optional`): Trade ID, when available.
- `feeToken` (`string, optional`): Token used to pay fees.
- `builder` (`string, optional`): Builder address, when present.
- `builderFee` (`string, optional`): Builder fee amount, when present.
- `user` (`string, optional`): User address; present on global, builder, and liquidation methods.
- `twapId` (`number, optional`): TWAP order ID, when present.
- `cloid` (`string, optional`): Client order ID, when present.
- `txIndex` (`number, optional`): Block-local fill event index from node_fills_by_block.

## Successful Response

```json
[
  {
    "coin": "BTC",
    "px": "118136",
    "sz": "0.00009",
    "side": "B",
    "time": 1753606210273,
    "startPosition": "-1.41864",
    "dir": "Close Short",
    "closedPnl": "-0.003753",
    "hash": "0xe7822040155eaa2e737e042854342401120052bbf063906ce8c8f3babe853a79",
    "oid": 121670079265,
    "crossed": true,
    "fee": "0.005316",
    "tid": 707098367501071,
    "feeToken": "USDC",
    "builder": "0x2222222222222222222222222222222222222222",
    "builderFee": "0.000531",
    "user": "0x1111111111111111111111111111111111111111",
    "txIndex": 1
  }
]
```

## Error Responses

### Error

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "invalid request"
  }
}
```

## REST-style Example

```bash
curl -X POST "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/info" \
  -H "content-type: application/json" \
  -d '{
  "type": "allFills",
  "coin": "BTC",
  "limit": 100
}'
```

## JSON-RPC Example

```bash
curl -X POST "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/jsonrpc" \
  -H "content-type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "allFills",
  "params": {
    "coin": "BTC",
    "limit": 100
  }
}'
```

## Response

REST `/info` responses return an array directly. JSON-RPC responses return the same array under `result`. Empty matches return `[]`; they are not errors.
