> For the complete documentation index, see [llms.txt](https://docs.strixlab.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.strixlab.io/developers/rest-api.md).

# REST API Reference

Base URL: `https://api.strixlab.io/api`. Endpoints marked **Public** need no auth; others require [authentication](/developers/authentication.md).

All responses share the envelope `{ "success": boolean, "data"?: ..., "message"?: string }`.

## Markets

### List events — `GET /api/events` · Public

<table><thead><tr><th width="140">Param</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>category</code></td><td>string</td><td>Filter by category slug (<code>crypto</code>, <code>politics</code>, …)</td></tr><tr><td><code>status</code></td><td>string</td><td><code>OPEN</code>, <code>CLOSED</code>, <code>RESOLVED</code></td></tr></tbody></table>

```json
{
  "success": true,
  "data": [{
    "id": "clxabc123",
    "title": "Will BTC exceed $100k in 2026?",
    "category": "crypto",
    "tickSize": 0.01,
    "status": "OPEN",
    "markets": [{
      "id": "mkt_abc",
      "status": "OPEN",
      "outcomes": [
        { "id": "out_yes", "name": "YES", "tokenId": "0x1a2b...", "lastPrice": 0.62 },
        { "id": "out_no",  "name": "NO",  "tokenId": "0x3c4d...", "lastPrice": 0.38 }
      ]
    }]
  }]
}
```

{% hint style="info" %}
`tokenId` on each outcome is the identifier used for orders, order-book queries, and WebSocket subscriptions. `tickSize` (`0.01` or `0.001`) is the price increment your order prices must be multiples of.
{% endhint %}

### Get one event — `GET /api/events/:id` · Public

## Order Book

### Snapshot — `GET /api/orderbook/:tokenId?depth=50` · Public

Max depth 200. `bids` sorted highest-first, `asks` lowest-first, `size` = shares remaining at that level.

```json
{
  "success": true,
  "data": {
    "tokenId": "0x1a2b...",
    "bids": [{ "price": 0.62, "size": 500 }, { "price": 0.61, "size": 300 }],
    "asks": [{ "price": 0.63, "size": 200 }, { "price": 0.64, "size": 450 }],
    "ts": 1716000000000
  }
}
```

For live updates use the [WebSocket order-book channel](/developers/websocket-api.md#order-book-channel).

## Orders

### Place order — `POST /api/orders` · Auth

```json
{ "tokenId": "0x1a2b...", "side": "BUY", "price": 0.62, "quantity": 100, "orderType": "GTC" }
```

<table><thead><tr><th width="130">Field</th><th>Type</th><th>Req</th><th>Notes</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>string</td><td>✓</td><td>Outcome token from <code>/api/events</code></td></tr><tr><td><code>side</code></td><td><code>BUY</code>｜<code>SELL</code></td><td>✓</td><td></td></tr><tr><td><code>price</code></td><td>number</td><td>✓</td><td>Multiple of <code>tickSize</code>; range <code>tickSize</code>–<code>(1−tickSize)</code></td></tr><tr><td><code>quantity</code></td><td>number</td><td>✓</td><td>Shares; <code>price × quantity ≥ 1.0</code></td></tr><tr><td><code>orderType</code></td><td>string</td><td>–</td><td><code>GTC</code> (default), <code>GTD</code>, <code>FOK</code>, <code>FAK</code></td></tr><tr><td><code>expiredAt</code></td><td>ISO datetime</td><td>if GTD</td><td></td></tr></tbody></table>

```json
{
  "success": true,
  "data": {
    "id": "ord_abc", "orderHash": "0xdeadbeef...", "tokenId": "0x1a2b...",
    "side": "BUY", "price": "0.62", "quantity": "100", "filledQuantity": "0",
    "status": "OPEN", "orderType": "GTC", "createdAt": "2026-05-22T10:00:00.000Z"
  }
}
```

{% hint style="info" %}
Save `orderHash` — it's the identifier for all cancel operations.
{% endhint %}

### Cancel one — `DELETE /api/orders/:orderHash` · Auth

### Bulk cancel — `DELETE /api/orders` · Auth

```
DELETE /api/orders                      → cancel everything
DELETE /api/orders?tokenId=0x1a2b...    → cancel all for one outcome
DELETE /api/orders?marketId=mkt_abc     → cancel all for a market
```

```json
{ "success": true, "data": { "cancelled": 12, "failed": 0 } }
```

{% hint style="danger" %}
This is the most important endpoint for risk management. On any connectivity or model failure, fire `DELETE /api/orders` to pull all quotes instantly.
{% endhint %}

### Open orders — `GET /api/orders` · Auth

Returns all `OPEN` and `PARTIALLY_FILLED` orders. Filter with `?marketId=mkt_abc`.

## Portfolio · Auth

```
GET /api/portfolio/summary
GET /api/portfolio/positions
GET /api/portfolio/trades
GET /api/portfolio/deposits
GET /api/portfolio/withdrawals
GET /api/portfolio/transactions
```

## Price History (Kline) · Public

```
GET /api/kline?outcomeId=0x1a2b...&interval=m5&from=2026-05-01T00:00:00Z&to=2026-05-22T00:00:00Z
```

Intervals: `m1`, `m5`, `m15`, `h1`, `h4`, `d1`.

```json
{
  "success": true,
  "data": [
    { "timestamp": "2026-05-22T10:00:00.000Z", "open": "0.60", "high": "0.64", "low": "0.59", "close": "0.62", "volume": "1200" }
  ]
}
```

## Errors

```json
{ "success": false, "message": "Insufficient USDC balance. Required: $62.00, available: $20.00" }
```

<table><thead><tr><th width="120">Status</th><th>Meaning</th></tr></thead><tbody><tr><td><code>400</code></td><td>Validation error — bad price, insufficient balance, duplicate order</td></tr><tr><td><code>401</code></td><td>Invalid or expired credentials</td></tr><tr><td><code>404</code></td><td>Order / resource not found</td></tr><tr><td><code>500</code></td><td>Server error</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.strixlab.io/developers/rest-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
