# History

Use these endpoints to inspect completed trading activity and account metrics.

Need live events instead of polling.

Use [Order Feed](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/order-feed), [Activity Feed](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/activity-feed), and [Last Trades Feed](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/last-trades-feed) for live updates.

### Authentication

* Use API key authentication for orders, trades, activity, and profile stats.
* Use JWT Bearer authentication for transactions.

### Order History

```
GET /api/history/orders
```

#### Query parameters

<table><thead><tr><th width="156.609375">Parameter</th><th>Type</th><th>Required</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>page</td><td>integer</td><td>No</td><td>0</td><td>Page number</td></tr><tr><td>size</td><td>integer</td><td>No</td><td>20</td><td>Items per page</td></tr><tr><td>eventOutcomeId</td><td>string</td><td>No</td><td>—</td><td>Filter by outcome or market ID</td></tr><tr><td>sort</td><td>string</td><td>No</td><td>desc</td><td>Sort direction: <code>asc</code> or <code>desc</code></td></tr></tbody></table>

#### Response `200 OK`

```json
{
  "i": [
    {
      "i": "order-id",
      "u": "user-id",
      "e": "event-id",
      "o": "outcome-id",
      "a": "asset-id",
      "oq": 100,
      "si": "BUY",
      "t": "LIMIT",
      "p": 0.42,
      "m": 1710000000000,
      "ex": null,
      "st": "FILLED",
      "q": 100
    }
  ],
  "p": 0,
  "s": 20,
  "tp": 8
}
```

| Field | Type   | Description         |
| ----- | ------ | ------------------- |
| i     | string | Order ID            |
| u     | string | User ID             |
| e     | string | Event ID            |
| o     | string | Outcome ID          |
| a     | string | Asset ID            |
| oq    | number | Original quantity   |
| si    | string | Side                |
| t     | string | Order type          |
| p     | number | Price               |
| m     | number | Placement time      |
| ex    | string | Expire at or `null` |
| st    | string | Status              |
| q     | number | Filled quantity     |

### Trade History

```
GET /api/history/trades
```

#### Query parameters

| Parameter      | Type    | Required | Default | Description                    |
| -------------- | ------- | -------- | ------- | ------------------------------ |
| page           | integer | No       | 0       | Page number                    |
| size           | integer | No       | 20      | Items per page                 |
| eventOutcomeId | string  | No       | —       | Filter by outcome or market ID |

#### Response `200 OK`

```json
{
  "i": [
    {
      "i": "trade-record-id",
      "t": "trade-id",
      "u": "user-id",
      "or": "order-id",
      "s": "BUY",
      "e": "event-id",
      "o": "outcome-id",
      "a": "asset-id",
      "q": 100,
      "p": 0.5,
      "f": 0.25,
      "m": "2026-01-15T10:30:00Z"
    }
  ],
  "p": 0,
  "s": 20,
  "tp": 8
}
```

| Field | Type   | Description     |
| ----- | ------ | --------------- |
| i     | string | Trade record ID |
| t     | string | Trade ID        |
| u     | string | User ID         |
| or    | string | Order ID        |
| s     | string | Side            |
| e     | string | Event ID        |
| o     | string | Outcome ID      |
| a     | string | Asset ID        |
| q     | number | Quantity        |
| p     | number | Price           |
| f     | number | Fee             |
| m     | string | Execution time  |

### Transaction History

```
GET /api/transactions
```

#### Headers

| Header        | Value            |
| ------------- | ---------------- |
| Authorization | `Bearer <token>` |

#### Query parameters

| Parameter | Type    | Required | Default | Description    |
| --------- | ------- | -------- | ------- | -------------- |
| page      | integer | No       | 0       | Page number    |
| size      | integer | No       | 20      | Items per page |

#### Example request

Use the wallet service host for transaction history.

{% code title="get\_transactions.sh" %}

```bash
curl "https://wallet-mutator-view.outpoll.com/api/transactions?page=0&size=20" \
  -H "Authorization: Bearer <token>"
```

{% endcode %}

#### Response `200 OK`

```json
{
  "i": [
    {
      "i": "tx-id",
      "u": "user-id",
      "a": "asset-id",
      "eq": "Will BTC reach $100k?",
      "ei": "https://example.com/icon.png",
      "es": "btc-100k-2026",
      "on": "Yes",
      "tn": "YES-BTC-100K",
      "ip": true,
      "t": "BUY",
      "am": 50,
      "s": "COMPLETED",
      "cat": "2026-01-15T10:30:00Z",
      "e": null,
      "f": 0.25,
      "ta": null,
      "bu": null,
      "bn": null
    }
  ],
  "p": 0,
  "s": 20,
  "tp": 5
}
```

| Field | Type    | Description                |
| ----- | ------- | -------------------------- |
| i     | string  | Transaction ID             |
| u     | string  | User ID                    |
| a     | string  | Asset ID                   |
| eq    | string  | Event question             |
| ei    | string  | Event icon URL             |
| es    | string  | Event slug                 |
| on    | string  | Outcome name               |
| tn    | string  | Token name                 |
| ip    | boolean | Primary outcome flag       |
| t     | string  | Transaction type           |
| am    | number  | Amount                     |
| s     | string  | Status                     |
| cat   | string  | Created at                 |
| e     | string  | External transaction ID    |
| f     | number  | Fee                        |
| ta    | string  | Withdrawal address         |
| bu    | string  | Blockchain transaction URL |
| bn    | string  | Blockchain name            |

### Activity Feed

```
GET /api/history/activity
```

#### Query parameters

| Parameter | Type    | Required | Default | Description    |
| --------- | ------- | -------- | ------- | -------------- |
| page      | integer | No       | 0       | Page number    |
| size      | integer | No       | 20      | Items per page |

#### Response `200 OK`

```json
{
  "i": [
    {
      "u": "user-id",
      "tra": "trade-record-id",
      "n": "trader_name",
      "oi": "outcome-id",
      "on": "Yes",
      "p": "Yes",
      "si": "BUY",
      "q": 14.9,
      "x": "2026-01-15T10:30:00.000000",
      "eq": "Will BTC reach $100k?",
      "ei": "https://example.com/icon.png",
      "es": "btc-100k-2026",
      "tn": "Yes",
      "ip": true,
      "pr": 0.47,
      "ev": 0,
      "uv": null
    }
  ],
  "p": 0,
  "s": 20,
  "t": 1500
}
```

| Field | Type    | Description           |
| ----- | ------- | --------------------- |
| u     | string  | User ID               |
| tra   | string  | Trade record ID       |
| n     | string  | Username              |
| oi    | string  | Outcome ID            |
| on    | string  | Outcome name          |
| p     | string  | Position direction    |
| si    | string  | Side                  |
| q     | number  | Quantity              |
| x     | string  | Execution time        |
| eq    | string  | Event question        |
| ei    | string  | Event icon URL        |
| es    | string  | Event slug            |
| tn    | string  | Token name            |
| ip    | boolean | Primary outcome flag  |
| pr    | number  | Price                 |
| ev    | number  | Event volume          |
| uv    | number  | User volume or `null` |

{% hint style="info" %}
This endpoint returns `t` for total items instead of `tp`.
{% endhint %}

### Profile Stats

```
GET /api/history/stats/profile/{userId}
```

#### Path parameters

| Parameter | Type   | Description |
| --------- | ------ | ----------- |
| userId    | string | User ID     |

#### Response `200 OK`

```json
{
  "profile": {
    "userId": "user-id",
    "username": "trader_name",
    "joinedAt": "2025-06-01T00:00:00Z",
    "me": true
  },
  "cards": {
    "positionValue": 5000,
    "volumeTraded": 125000,
    "marketsTraded": 42
  }
}
```

| Field               | Type    | Description        |
| ------------------- | ------- | ------------------ |
| profile.userId      | string  | User ID            |
| profile.username    | string  | Username           |
| profile.joinedAt    | string  | Join date          |
| profile.me          | boolean | Authenticated user |
| cards.positionValue | number  | Position value     |
| cards.volumeTraded  | number  | Volume traded      |
| cards.marketsTraded | number  | Markets traded     |

### Position Stats

```
GET /api/history/stats/profile/{userId}/positions
```

#### Path parameters

| Parameter | Type   | Description |
| --------- | ------ | ----------- |
| userId    | string | User ID     |

#### Response `200 OK`

```json
{
  "tab": null,
  "openPositions": {
    "i": [
      {
        "ei": "event-id",
        "eoi": "outcome-id",
        "ai": "asset-id",
        "et": "Will BTC reach $100k?",
        "eic": "/icons/btc.svg",
        "es": "btc-100k-2026",
        "on": "Yes",
        "tn": "Yes",
        "sc": 100,
        "sp": 50,
        "si": "BUY",
        "c": 50,
        "v": 55,
        "pv": 5,
        "pp": 10
      }
    ],
    "p": 0,
    "s": 20,
    "tp": 1,
    "ti": 5
  },
  "positionHistory": {
    "i": [
      {
        "ei": "event-id",
        "eoi": "outcome-id",
        "ai": "asset-id",
        "et": "Will BTC reach $100k?",
        "eic": "/icons/btc.svg",
        "es": "btc-100k-2026",
        "on": "Yes",
        "tn": "Yes",
        "sc": 100,
        "sp": 50,
        "si": "BUY",
        "c": 50,
        "v": 100,
        "pv": 50,
        "pp": 100,
        "od": "2026-01-15T10:30:00Z",
        "cd": "2026-02-01T12:00:00Z"
      }
    ],
    "p": 0,
    "s": 10,
    "tp": 1,
    "ti": 10
  }
}
```

| Field | Type   | Description |
| ----- | ------ | ----------- |
| tab   | string | Active tab  |
| ti    | number | Total items |
| od    | string | Open date   |
| cd    | string | Close date  |
