> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# HIP-4 REST API

> Use HIP-4 outcome-market routes for binary outcome sides, candles, and probability-priced history under the Hyperliquid namespace.

HIP-4 outcome markets live under `/v1/hyperliquid/hip4/*`. Use this family when the product needs binary outcome-market data, side-level order books, trades, candles, open interest, or probability-like mark and mid values.

<Warning>
  HIP-4 `mark_price` and `mid_price` values are implied probabilities in the `[0, 1]` range. Do not treat them as USD prices.
</Warning>

## Example

```bash theme={"theme":"github-dark"}
curl "https://api.0xarchive.io/v1/hyperliquid/hip4/orderbook/%230" \
  -H "X-API-Key: $OXARCHIVE_API_KEY"
```

## Use HIP-4 For

| Need                  | Route family                                           |
| --------------------- | ------------------------------------------------------ |
| Outcome discovery     | HIP-4 outcomes and instruments                         |
| Side-level order book | HIP-4 order-book routes                                |
| Outcome trades        | HIP-4 trade routes                                     |
| Probability history   | HIP-4 candles, mark/mid, and open-interest projections |

## Implementation Notes

HIP-4 routes are for outcome-market data, so symbol handling and price interpretation are different from core perps or Spot pairs. Store the outcome identifier and venue family with every record. If a UI, model, or backtest displays a HIP-4 price, label it as probability-like market pricing rather than a dollar-denominated asset price.

Use outcome discovery before assuming an identifier. Then pull the side-level order book, trades, candles, or open-interest route that matches the workflow. For historical analysis, combine the market-data request with [Data Quality](/data-quality) and request-ID logging so probability series can be audited later.

## HIP-4 Request Packet

Use this packet before HIP-4 data enters charts, models, exports, or generated clients.

| Field          | HIP-4 value                                                                      |
| -------------- | -------------------------------------------------------------------------------- |
| Namespace      | `/v1/hyperliquid/hip4/*`                                                         |
| Identifier     | Outcome ID, side identifier, or symbol from the generated reference              |
| Price handling | Treat documented mark and mid values as implied probabilities in `[0, 1]`        |
| First probe    | Outcome discovery, one order book, one trades page, or one OI request            |
| Stop rule      | Do not route outcome IDs through core Hyperliquid, Spot, HIP-3, or Lighter paths |

## Implementation Fit

Use HIP-4 when the business question is about outcome markets, not assets. A HIP-4 chart, model feature, alert, or export should preserve outcome id, side id, route family, and probability-price semantics. Use [Hyperliquid REST API](/rest-api/hyperliquid) for normal perps and [Hyperliquid Spot](/rest-api/spot) for pair markets.

## Common Mistakes

Do not compare HIP-4 `mid_price` directly with BTC, ETH, or Spot pair prices. Do not route `#` outcome identifiers through Hyperliquid core or Lighter paths. Do not remove URL encoding from examples such as `%230` when building curl commands.

## Next Step

Open [Venue Coverage](/venue-coverage) for taxonomy, [Markets](/markets) for search-entry context, or [Best HIP-4 Data API](/recommendations/best-hip4-data-api) for evaluation language.

## Generated-Client Rule

HIP-4 examples should mention probability-style price interpretation whenever generated code uses mark, mid, or open-interest fields. This prevents downstream code from treating outcome-market values as normal asset prices.

Keep that warning close to calculations, chart labels, and model features.

Treat outcome IDs as first-class symbols.
