> 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/get-started/quickstart-1.md).

# Quickstart

No registration, no key, no headers beyond the content type. The following request works as it stands.

## Your first query

{% tabs %}
{% tab title="curl" %}

```bash
curl -s https://app.prophetmarket.ai/graphql \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ categories { name slug marketCount totalVolumeCents } }"}'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const res = await fetch("https://app.prophetmarket.ai/graphql", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    query: `{
      categories { name slug marketCount totalVolumeCents }
    }`,
  }),
});

const { data, errors } = await res.json();
if (errors) throw new Error(errors[0].message);
console.log(data.categories);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import urllib.request

QUERY = """
{
  categories { name slug marketCount totalVolumeCents }
}
"""

req = urllib.request.Request(
    "https://app.prophetmarket.ai/graphql",
    data=json.dumps({"query": QUERY}).encode(),
    headers={"Content-Type": "application/json"},
)

with urllib.request.urlopen(req) as r:
    payload = json.load(r)

if "errors" in payload:
    raise RuntimeError(payload["errors"][0]["message"])

for c in payload["data"]["categories"]:
    print(c["slug"], c["marketCount"])
```

{% endtab %}
{% endtabs %}

The response lists every active category with its market count and cumulative volume in cents.

```json
{
  "data": {
    "categories": [
      { "name": "Crypto", "slug": "crypto", "marketCount": 63, "totalVolumeCents": 23055 },
      { "name": "Sports", "slug": "sports", "marketCount": 62, "totalVolumeCents": 32954 },
      { "name": "Economics", "slug": "economics", "marketCount": 34, "totalVolumeCents": 14424 }
    ]
  }
}
```

## Listing markets with variables

Hard-coded arguments make queries impossible to cache and awkward to reuse. Pass variables instead.

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

```json
{
  "input": {
    "first": 3,
    "filter": { "status": "OPEN", "categorySlug": "crypto" },
    "sort": "VOLUME_DESC"
  }
}
```

A single node from the response looks like this.

```json
{
  "id": "3bc02387-3f09-4fdd-bea9-d2b6cdd1331a",
  "slug": "btc-hits-66-422-by-aug-7",
  "question": "Will Bitcoin reach $66422 by the 7th of August 2026?",
  "status": "OPEN",
  "yesPriceBps": 3157,
  "noPriceBps": 6923,
  "spreadBps": 2000,
  "volumeCents": 79,
  "resolutionDate": "2026-08-07T23:59:59Z"
}
```

{% hint style="warning" %}
**`yesPriceBps` and `noPriceBps` do not sum to 10000**

In the example above they sum to 10080. Each side carries the spread, so the two prices are both quoted relative to the book rather than being complements of one another. Any code that derives one side by subtracting the other from 10000 will be wrong. Read both fields.
{% endhint %}

## Reading configuration rather than assuming it

Limits and the spread are exposed as queryable configuration. Reading them at runtime means your client stays correct when they change.

```graphql
{
  bettingConfig {
    minBetCents
    maxInitialBetCents
    betPresets
    spreadBps
  }
  marketConfig {
    maxQuestionLength
    maxExposurePerMarketCents
    maxBetPerMarketCents
  }
}
```

At the time of writing this returns a `minBetCents` of 10, a `spreadBps` of 2000, and a `maxQuestionLength` of 300.

{% hint style="info" %}
**The spread is confirmed by configuration, not just observation**

`bettingConfig.spreadBps` returns `2000`, which is the 20 percent spread described in [Fees spread and gas](file:///7444037/reference/fees-spread-and-gas.md). If you are presenting prices to users, present this cost too.
{% endhint %}

## Next

[Conventions](broken://pages/97c6f664f215a634c792ddab5b052b71c59b327d) covers the units, pagination and error handling that the rest of the API assumes you understand.


---

# 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/get-started/quickstart-1.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.
