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

# Market Data

All of the queries on this page are public. None of them require a token.

## Listing markets

`markets(input: MarketsInput)` returns a paginated connection. The input carries pagination arguments alongside an optional filter and sort.

```graphql
query Markets($input: MarketsInput) {
  markets(input: $input) {
    totalCount
    pageInfo { hasNextPage endCursor }
    edges {
      node {
        id slug question status
        yesPriceBps noPriceBps spreadBps
        volumeCents resolutionDate
        category { name slug }
      }
    }
  }
}
```

### Filtering

`MarketFilter` accepts seven optional fields, combined conjunctively.

| Field             | Type           | Purpose                              |
| ----------------- | -------------- | ------------------------------------ |
| `status`          | `MarketStatus` | Restrict to one lifecycle state      |
| `categorySlug`    | `String`       | Restrict to one category             |
| `topicSlug`       | `String`       | Restrict to one topic                |
| `creatorId`       | `ID`           | Markets created by one account       |
| `search`          | `String`       | Free-text match against the question |
| `resolvingBefore` | `Time`         | Resolution date earlier than this    |
| `resolvingAfter`  | `Time`         | Resolution date later than this      |

The two date bounds combine into a window, which is the practical way to find markets resolving inside a period you care about.

```json
{
  "input": {
    "first": 50,
    "filter": {
      "status": "OPEN",
      "categorySlug": "crypto",
      "resolvingAfter": "2026-08-07T00:00:00Z",
      "resolvingBefore": "2026-09-01T00:00:00Z"
    },
    "sort": "VOLUME_DESC"
  }
}
```

{% hint style="info" %}
**Sort by volume to find liquidity, not by recency**

`CREATED_AT_DESC` surfaces the newest markets, which on a platform where anyone can create a market in thirty seconds are frequently the thinnest. If your interface is meant to show markets a user could actually trade, `VOLUME_DESC` is the more honest default.
{% endhint %}

## Fetching a single market

Two queries, depending on which identifier you hold. Both return null rather than an error when nothing matches.

```graphql
query One($id: ID!) {
  market(id: $id) { question status yesPriceBps }
}
```

```graphql
query BySlug($slug: String!) {
  marketBySlug(slug: $slug) {
    question status
    yesPriceBps noPriceBps spreadBps
    resolutionDate resolutionRules
    category { name }
    creator { id username }
  }
}
```

Passing a malformed UUID to `market` produces a validation error rather than null, as described in [Conventions](broken://pages/97c6f664f215a634c792ddab5b052b71c59b327d).

## The Market type

| Field                        | Type            | Notes                         |
| ---------------------------- | --------------- | ----------------------------- |
| `id`                         | `ID!`           | UUID                          |
| `slug`                       | `String!`       | URL-safe identifier           |
| `question`                   | `String!`       | The question as asked         |
| `title`                      | `String!`       | Display title                 |
| `resolutionDate`             | `Time!`         | When the question is settled  |
| `resolutionRules`            | `String`        | The criterion, in full prose  |
| `status`                     | `MarketStatus!` | One of nine states            |
| `yesPriceBps`                | `Int!`          | Basis points                  |
| `noPriceBps`                 | `Int!`          | Basis points                  |
| `spreadBps`                  | `Int!`          | Basis points                  |
| `volumeCents`                | `Int!`          | Cumulative volume             |
| `creator`                    | `PublicUser!`   | `id` and `username` only      |
| `category`                   | `Category`      | Nullable                      |
| `topics`                     | `[Topic!]!`     | May be empty                  |
| `conditionId`                | `String`        | On-chain condition identifier |
| `yesPositionId`              | `String`        | On-chain position identifier  |
| `noPositionId`               | `String`        | On-chain position identifier  |
| `similarMarkets(limit: Int)` | `[Market!]!`    | Related markets               |

Cancellation and resolution metadata is present on the same type: `cancellationReason`, `cancelledAt`, `cancelledBy`, `resolutionReason`, `resolvedAt` and `resolvedBy`. These are null while a market is open.

`resolutionRules` is the field worth surfacing prominently in any interface. It contains the actual settlement criterion, and it is specific.

> YES wins if Bitcoin (BTC) closes above $66,422 on 2026-08-07T23:59:59Z UTC, according to CoinGecko or CoinMarketCap.

{% hint style="warning" %}
**`creator` deliberately exposes almost nothing**

`PublicUser` carries only `id` and `username`, and `username` is nullable. There is no way to retrieve a creator's holdings, history or contact details through this field, and you should not present creator identity as a signal of market quality.
{% endhint %}

## Categories and topics

`categories` returns every active category with counts, ordered by `displayOrder`.

```graphql
{
  categories { id name slug displayOrder marketCount totalVolumeCents topicCount }
}
```

Twelve categories were active at the time of writing, the largest by market count being Crypto and Sports.

`categoryBySlug(slug: String!)` fetches one. `topicsByCategory(categorySlug: String)` lists topics within a category, or across all markets when the argument is null. `topicBySlug(slug: String!)` fetches a single topic. A `Topic` carries `id`, `name`, `slug`, `marketCount` and `totalVolumeCents`.

## Bet limits

`marketBetLimits(marketId: ID!)` reports, per outcome, the maximum bet the book can currently absorb and the best available price.

```graphql
query Limits($id: ID!) {
  marketBetLimits(marketId: $id) {
    yes { maxBetCents currentOddsBps }
    no  { maxBetCents currentOddsBps }
  }
}
```

`maxBetCents` is derived from order book liquidity, and `currentOddsBps` is the best available ask, returning null when there is no liquidity on that side.

{% hint style="danger" %}
**Limit configuration is not currently self-consistent**

`marketConfig.maxBetPerMarketCents` returns 100, which is one dollar, while `bettingConfig.maxInitialBetCents` returns 100000, which is one thousand dollars. These describe different things but the naming does not make the distinction clear. Query `marketBetLimits` for the figure that actually governs a specific market, and do not hard-code either value.
{% endhint %}

## Next

[Prices and Order Book](broken://pages/b59a706769d611e97e96b892ffc1c958fe6a47c2) covers depth, trades and history.


---

# 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.prophetmarket.ai/api/market-data.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.
