> 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/api/quickstart.md).

# Quickstart

No registration or keys are required to query public market data.

## 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 active categories:

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

## Using Variables

Pass variables instead of hard-coding arguments.

```graphql
query Markets($input: MarketsInput) {
  markets(input: $input) {
    edges {
      node {
        id
        slug
        question
        status
        yesPriceBps
        noPriceBps
      }
    }
  }
}
```

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

## Global Configuration

Read limits and spreads from the API rather than hard-coding them.

```graphql
{
  bettingConfig {
    minBetCents
    spreadBps
  }
  marketConfig {
    maxQuestionLength
  }
}
```

The `spreadBps` confirms the global spread (e.g., `2000` for 20%). Present this cost to users if you are displaying prices.


---

# 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/api/quickstart.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.
