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

# Government and Economic Data

> Query official government and economic data — congress, FRED, Databento, traditional markets — with optional prediction-market links.

Use these endpoints when an agent needs source context separate from prediction-market objects.

## Economic query

```http theme={null}
GET /api/public/query-econ
```

```bash theme={null}
curl "https://simplefunctions.dev/api/public/query-econ?q=unemployment%20rate&limit=3"
```

Parameters:

| Parameter        | Values             | Use                                                                         |
| ---------------- | ------------------ | --------------------------------------------------------------------------- |
| `q`              | string             | Economic series or macro topic. Required.                                   |
| `mode`           | `full`, `raw`      | `full` includes answer text from the mirror; `raw` is structured retrieval. |
| `limit`          | `1` to `10`        | Max series. Default `5`.                                                    |
| `includeMarkets` | `true`, `1`, `yes` | Include related Kalshi/Polymarket markets. Default false.                   |

Response shape:

```json theme={null}
{
  "query": "unemployment rate",
  "answer": "...",
  "series": [
    {
      "id": "UNRATE",
      "title": "Unemployment Rate",
      "units": "Percent",
      "frequency": "Monthly",
      "latest": {
        "date": "2026-03-01",
        "value": "4.3",
        "numericValue": 4.3
      },
      "changes": {
        "previous": {},
        "yearAgo": {}
      },
      "observations": [],
      "source": "FRED",
      "sourceUrl": "https://fred.stlouisfed.org/series/UNRATE",
      "observationsUrl": "https://simplefunctions.dev/api/public/fred?series=UNRATE"
    }
  ],
  "markets": [],
  "meta": {
    "provider": "fred-mirror",
    "mode": "full",
    "includeMarkets": false,
    "latencyMs": 0
  },
  "nextActions": {
    "inspect": [],
    "related": []
  }
}
```

Add markets:

```bash theme={null}
curl "https://simplefunctions.dev/api/public/query-econ?q=unemployment%20rate&includeMarkets=true"
```

CLI:

```bash theme={null}
sf econ "unemployment rate" --json
sf fred UNRATE --json
```

## Government query

```http theme={null}
GET /api/public/query-gov
```

```bash theme={null}
curl "https://simplefunctions.dev/api/public/query-gov?q=save%20act&limit=3"
```

Parameters:

| Parameter | Values        | Use                                                                   |
| --------- | ------------- | --------------------------------------------------------------------- |
| `q`       | string        | Bill, nomination, member, jurisdiction, or policy question. Required. |
| `mode`    | `full`, `raw` | `full` includes synthesis. `raw` returns structured retrieval.        |
| `sources` | comma list    | `congress`, `openstates`, `kalshi`, `crs`. Default all.               |
| `limit`   | `1` to `20`   | Max results per source. Default `10`.                                 |
| `depth`   | `true`        | Fetch deeper bill/action/orderbook context where available.           |

Response shape:

```json theme={null}
{
  "query": "save act",
  "answer": "...",
  "keyFactors": [],
  "bills": [
    {
      "id": "119-hr-22",
      "congress": 119,
      "type": "hr",
      "number": 22,
      "title": "...",
      "status": "...",
      "sponsor": "...",
      "hasMarket": true,
      "market": {
        "ticker": "...",
        "title": "...",
        "venue": "kalshi"
      }
    }
  ],
  "nominations": [],
  "markets": [],
  "members": [],
  "meta": {
    "provider": "congress-mirror",
    "mode": "full",
    "latencyMs": 0
  },
  "nextActions": {
    "inspect": [],
    "related": []
  }
}
```

Examples:

```bash theme={null}
curl "https://simplefunctions.dev/api/public/query-gov?q=warsh%20fed%20chair&limit=5"
curl "https://simplefunctions.dev/api/public/query-gov?q=save%20act&sources=congress,kalshi"
curl "https://simplefunctions.dev/api/public/query-gov?q=new%20york%20energy%20bill&sources=openstates"
```

CLI:

```bash theme={null}
sf policy "save act" --json
sf bill 119-hr-22 --json
```

## Bill detail

```http theme={null}
GET /api/public/legislation/{billId}
```

```bash theme={null}
curl "https://simplefunctions.dev/api/public/legislation/119-hr-22"
```

Use bill detail after `query-gov` returns a bill id.
