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

# Portfolio

> User position, portfolio value and account activity endpoint reference

## Get User Positions

```text theme={null}
GET /api/v1/markets/user-positions
```

**Authentication:** `API key HMAC`

Query parameters:

| Query     | Type        | Required | Description                                                   |
| --------- | ----------- | -------- | ------------------------------------------------------------- |
| `status`  | enum string | No       | Market status: `DRAFT`, `ACTIVE` or `RESOLVED`.               |
| `id`      | UUID string | No       | Market UUID.                                                  |
| `eventId` | UUID string | No       | Event UUID.                                                   |
| `title`   | string      | No       | Case-insensitive title filter.                                |
| `page`    | integer     | No       | Page number. Default `1`.                                     |
| `limit`   | integer     | No       | Results per page. Default `10`.                               |
| `sortBy`  | enum string | No       | `latest`, `current`, `initial` or `return`. Default `latest`. |
| `order`   | enum string | No       | `ASC` or `DESC`. Default `DESC`.                              |

Response type: `UserPositionsResponse`.

| Field   | Type             | Required | Description                                            |
| ------- | ---------------- | -------- | ------------------------------------------------------ |
| `first` | integer          | Yes      | One-based index of the first item on the current page. |
| `last`  | integer          | Yes      | One-based index of the last item on the current page.  |
| `limit` | integer          | Yes      | Results per page.                                      |
| `total` | integer          | Yes      | Total matching positions.                              |
| `data`  | `UserPosition[]` | Yes      | User positions.                                        |

## Get Position Value

```text theme={null}
GET /api/v1/markets/value
```

**Authentication:** `API key HMAC`

Query parameters:

| Query     | Type                          | Required | Description                                                                |
| --------- | ----------------------------- | -------- | -------------------------------------------------------------------------- |
| `user`    | address string                | No       | Proxy wallet address. Defaults to the authenticated user.                  |
| `markets` | UUID string or UUID string\[] | No       | Market IDs to filter positions. Send once or as repeated query parameters. |

Response type: `UserPositionValue`.

| Field   | Type           | Required | Description                                    |
| ------- | -------------- | -------- | ---------------------------------------------- |
| `user`  | address string | Yes      | Proxy wallet address used for the calculation. |
| `value` | number         | Yes      | Total position value in USD.                   |

## Get User Activity

```text theme={null}
GET /api/v1/markets/user-activity
```

**Authentication:** `API key HMAC`

Query parameters:

| Query           | Type                          | Required | Description                                        |
| --------------- | ----------------------------- | -------- | -------------------------------------------------- |
| `term`          | string                        | No       | Search term. Max 50 characters.                    |
| `name`          | string                        | No       | Case-insensitive partial name filter.              |
| `market`        | UUID string                   | No       | Market UUID.                                       |
| `types`         | enum string or enum string\[] | No       | `BUY`, `SELL`, `SPLIT`, `MERGE` or `REDEEM`.       |
| `fromTimestamp` | integer                       | No       | Unix timestamp in seconds.                         |
| `toTimestamp`   | integer                       | No       | Unix timestamp in seconds.                         |
| `page`          | integer                       | No       | Page number. Default `1`.                          |
| `limit`         | integer                       | No       | Results per page. Default `10`.                    |
| `total`         | boolean                       | No       | Include total count. Default `true`.               |
| `sortBy`        | string                        | No       | Sort field. Default `usersactivityview.timestamp`. |
| `order`         | enum string                   | No       | `ASC` or `DESC`. Default `DESC`.                   |

Response type: `Pagination<Activity>`.

## Get Markets Traded Count

```text theme={null}
GET /api/v1/markets/traded-count
```

**Authentication:** `API key HMAC`

Response type: `number`.

## Get Redeemable Positions

```text theme={null}
GET /api/v1/markets/redeemable-positions
```

**Authentication:** `API key HMAC`

Returns resolved markets where you currently have a redeemable indexed position.

Response type: `RedeemablePosition[]`.

| Field             | Type        | Required | Description                                                    |
| ----------------- | ----------- | -------- | -------------------------------------------------------------- |
| `marketId`        | UUID string | Yes      | Market UUID to pass to `POST /markets/redeem-positions/batch`. |
| `onchainMarketId` | string      | Yes      | On-chain market ID.                                            |
| `conditionId`     | string      | Yes      | Conditional Tokens condition ID used for redemption.           |
| `tokenId1`        | string      | Yes      | Outcome 1 token ID.                                            |
| `tokenId2`        | string      | Yes      | Outcome 2 token ID.                                            |
| `slug`            | string      | Yes      | Event slug.                                                    |
| `name`            | string      | Yes      | Market name.                                                   |

## Redeem Positions

```text theme={null}
POST /api/v1/markets/redeem-positions/batch
```

**Authentication:** `API key HMAC`

Redeems one or more resolved market positions in a single transaction. For a one-market redeem, send one market ID in `marketIds`.

Request body:

| Field       | Type           | Required | Description                                                                           |
| ----------- | -------------- | -------- | ------------------------------------------------------------------------------------- |
| `marketIds` | UUID string\[] | Yes      | Unique market UUIDs to redeem. Minimum `1`. Default maximum `50`; hard maximum `200`. |

Response type: `BatchRedeemResponse`.

| Field      | Type                     | Required | Description                                  |
| ---------- | ------------------------ | -------- | -------------------------------------------- |
| `txHash`   | string                   | Yes      | Transaction hash for the redeem transaction. |
| `included` | UUID string\[]           | Yes      | Market UUIDs included in the transaction.    |
| `excluded` | `ExcludedRedeemMarket[]` | Yes      | Requested markets that were not redeemed.    |

`ExcludedRedeemMarket`:

| Field      | Type        | Required | Description                                               |
| ---------- | ----------- | -------- | --------------------------------------------------------- |
| `marketId` | UUID string | Yes      | Excluded market UUID.                                     |
| `reason`   | enum string | Yes      | `not-redeemable`, `zero-onchain-balance` or `not-binary`. |

## Get Mergeable Positions

```text theme={null}
GET /api/v1/markets/mergeable-positions
```

**Authentication:** `API key HMAC`

Returns active markets where you currently hold both outcome legs and can merge complete sets back into collateral.

Response type: `MergeablePosition[]`.

| Field             | Type        | Required | Description                                                   |
| ----------------- | ----------- | -------- | ------------------------------------------------------------- |
| `marketId`        | UUID string | Yes      | Market UUID to pass to `POST /markets/merge-positions/batch`. |
| `onchainMarketId` | string      | Yes      | On-chain market ID.                                           |
| `conditionId`     | string      | Yes      | Conditional Tokens condition ID used for merging.             |
| `tokenId1`        | string      | Yes      | Outcome 1 token ID.                                           |
| `tokenId2`        | string      | Yes      | Outcome 2 token ID.                                           |
| `slug`            | string      | Yes      | Event slug.                                                   |
| `name`            | string      | Yes      | Market name.                                                  |

## Merge Positions

```text theme={null}
POST /api/v1/markets/merge-positions/batch
```

**Authentication:** `API key HMAC`

Merges complete Yes/No sets for one or more active markets in a single transaction. For a one-market merge, send one market ID in `marketIds`. You do not provide an amount; Hit computes the merge amount from your live on-chain balances.

Request body:

| Field       | Type           | Required | Description                                                                          |
| ----------- | -------------- | -------- | ------------------------------------------------------------------------------------ |
| `marketIds` | UUID string\[] | Yes      | Unique market UUIDs to merge. Minimum `1`. Default maximum `50`; hard maximum `200`. |

Response type: `BatchMergeResponse`.

| Field      | Type                    | Required | Description                                 |
| ---------- | ----------------------- | -------- | ------------------------------------------- |
| `txHash`   | string                  | Yes      | Transaction hash for the merge transaction. |
| `included` | UUID string\[]          | Yes      | Market UUIDs included in the transaction.   |
| `excluded` | `ExcludedMergeMarket[]` | Yes      | Requested markets that were not merged.     |

`ExcludedMergeMarket`:

| Field      | Type        | Required | Description                                       |
| ---------- | ----------- | -------- | ------------------------------------------------- |
| `marketId` | UUID string | Yes      | Excluded market UUID.                             |
| `reason`   | enum string | Yes      | `not-mergeable`, `only-one-side` or `not-binary`. |

## UserPosition

| Field                    | Type             | Required | Description                                                                 |
| ------------------------ | ---------------- | -------- | --------------------------------------------------------------------------- |
| `market_uuid`            | UUID string      | Yes      | Market UUID.                                                                |
| `tokenId`                | string           | Yes      | Held outcome token ID.                                                      |
| `acquisitionPrice`       | string           | Yes      | Average acquisition price.                                                  |
| `amount`                 | string           | Yes      | Token amount held.                                                          |
| `latest`                 | string           | Yes      | Latest token price.                                                         |
| `current`                | string           | Yes      | Current position value.                                                     |
| `initial`                | string           | Yes      | Initial position value.                                                     |
| `return`                 | string           | Yes      | Position return.                                                            |
| `icon`                   | string           | No       | Market icon URL.                                                            |
| `slug`                   | string           | No       | Market slug.                                                                |
| `title`                  | string           | No       | Market title.                                                               |
| `displayName`            | string or null   | Yes      | Optional market presentation label. Use `title` when this is `null`.        |
| `eventId`                | UUID string      | No       | Parent event UUID.                                                          |
| `eventName`              | string           | No       | Parent event name.                                                          |
| `eventIcon`              | string           | No       | Parent event icon URL.                                                      |
| `isMultiMarket`          | boolean          | No       | Whether the position belongs to a multi-market event.                       |
| `isSeriesLayout`         | boolean          | No       | Whether the parent event uses the daily-series layout.                      |
| `status`                 | enum string      | No       | `DRAFT`, `ACTIVE` or `RESOLVED`.                                            |
| `conditionId`            | string           | No       | Conditional Tokens condition ID.                                            |
| `resolvedTo`             | string or number | No       | Resolution outcome.                                                         |
| `outcome`                | string           | No       | Outcome label.                                                              |
| `outcomeIndex`           | integer          | No       | Outcome index: `0` or `1`.                                                  |
| `orderFeeRateBps`        | integer          | No       | Market fee rate in basis points.                                            |
| `passiveOrderFeeRateBps` | integer          | No       | Passive-order fee rate in basis points.                                     |
| `proposedResolvedTo`     | string           | No       | Proposed winning outcome: `YES`, `NO` or `TIE`.                             |
| `proposedAt`             | integer          | No       | Current proposal time in Unix seconds.                                      |
| `liveness`               | integer          | No       | Dispute-window duration in seconds.                                         |
| `isDisputed`             | boolean          | No       | Whether the current proposal is disputed.                                   |
| `isSettled`              | boolean          | No       | Whether the oracle has settled the market before final platform resolution. |

`proposedResolvedTo` and `proposedAt` describe the current proposal and can remain present after final resolution. Use `status !== "RESOLVED"` when deciding whether to show a pending-resolution state.

## Activity

| Field                  | Type                | Required | Description                                                         |
| ---------------------- | ------------------- | -------- | ------------------------------------------------------------------- |
| `id`                   | UUID string         | Yes      | Activity row UUID.                                                  |
| `name`                 | string              | Yes      | Market or event name.                                               |
| `displayName`          | string or null      | Yes      | Optional market presentation label. Use `name` when this is `null`. |
| `slug`                 | string              | Yes      | Event slug.                                                         |
| `description`          | string              | Yes      | Event description.                                                  |
| `createdAt`            | string (date-time)  | Yes      | Event creation timestamp.                                           |
| `createdBy`            | UUID string         | Yes      | Event creator user ID.                                              |
| `updatedAt`            | string (date-time)  | Yes      | Event update timestamp.                                             |
| `startDate`            | string (date-time)  | Yes      | Event start timestamp.                                              |
| `endDate`              | string (date-time)  | Yes      | Event end timestamp.                                                |
| `protected`            | boolean             | Yes      | Whether the event is protected.                                     |
| `icon`                 | string              | Yes      | Icon URL.                                                           |
| `tokenId1`             | string              | Yes      | Outcome 1 token ID.                                                 |
| `tokenId2`             | string              | Yes      | Outcome 2 token ID.                                                 |
| `conditionId`          | string              | Yes      | Conditional Tokens condition ID.                                    |
| `proxy_address`        | address string      | Yes      | User proxy wallet address.                                          |
| `outcome1`             | string              | Yes      | Outcome 1 label.                                                    |
| `outcome2`             | string              | Yes      | Outcome 2 label.                                                    |
| `type`                 | enum string         | Yes      | `BUY`, `SELL`, `SPLIT`, `MERGE` or `REDEEM`.                        |
| `timestamp`            | integer             | Yes      | Activity timestamp in seconds.                                      |
| `hash`                 | string              | Yes      | Transaction hash.                                                   |
| `amount`               | number              | Yes      | Activity amount.                                                    |
| `parent_collection_id` | string              | Yes      | Conditional Tokens parent collection ID.                            |
| `partition`            | integer\[]          | Yes      | Conditional Tokens partition.                                       |
| `isResolved`           | boolean             | Yes      | Whether the market is resolved.                                     |
| `price`                | string              | Yes      | Activity price.                                                     |
| `eventId`              | UUID string or null | No       | Parent event UUID.                                                  |
| `eventName`            | string or null      | No       | Parent event name.                                                  |
| `isMultiMarket`        | boolean             | Yes      | Whether the activity belongs to a multi-market event.               |
| `fee`                  | number              | Yes      | Fee amount.                                                         |
