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

# Quickstart

> Make your first request to the Monetary Public API

## 1) Set your environment

```bash theme={null}
export MONETARY_API_BASE_URL="https://api.monetary.dev"
export MONETARY_API_TOKEN="<your_api_token>"
```

## 2) Verify connectivity

`/health` is public and does not require auth.

```bash theme={null}
curl -sS "$MONETARY_API_BASE_URL/health"
```

Expected shape:

```json theme={null}
{
  "result": [{ "ok": 1 }],
  "status": "ok",
  "uptime": 1234.56
}
```

## 3) Make an authenticated request

```bash theme={null}
curl -sS "$MONETARY_API_BASE_URL/v1/companies?query=nvidia&limit=5" \
  -H "Authorization: Bearer $MONETARY_API_TOKEN" \
  -H "Accept: application/json"
```

## 4) Try prediction market endpoints

```bash theme={null}
curl -sS "$MONETARY_API_BASE_URL/v1/prediction_markets/events?provider=kalshi&status=open&limit=10" \
  -H "Authorization: Bearer $MONETARY_API_TOKEN" \
  -H "Accept: application/json"
```

## JavaScript example

```js theme={null}
const baseUrl = process.env.MONETARY_API_BASE_URL;
const token = process.env.MONETARY_API_TOKEN;

const response = await fetch(
  `${baseUrl}/v1/prediction_markets/markets?provider=polymarket&limit=20`,
  {
    headers: {
      Accept: "application/json",
      Authorization: `Bearer ${token}`,
    },
  },
);

if (!response.ok) {
  const err = await response.json();
  throw new Error(err.message ?? "Request failed");
}

const payload = await response.json();
console.log(payload.data.length);
```

## 5) Optional: subscribe to realtime updates

```js theme={null}
const ws = new WebSocket("ws://127.0.0.1:3001/ws");

ws.addEventListener("open", () => {
  ws.send(JSON.stringify({
    action: "subscribe",
    channels: ["events", "markets", "trades"],
  }));
});
```

Next: read [Authentication & Errors](/docs/development), browse [endpoint docs](/docs/api-reference/introduction), and see [Realtime Stream](/docs/api-reference/endpoint/realtime-stream) for websocket payloads.
