Policy Eagle
Developers

Quickstart

From a new key to your first bill in about five minutes.

1. Create a key

Go to Account → API keys (sign in or create a free account first) and choose Create key. Copy the key when it's shown: it starts with pe_live_ and appears only once.

2. Keep it in an environment variable

export POLICY_EAGLE_API_KEY="pe_live_…"

Keep the key on your computer or server. Don't put it in browser code, mobile apps, repositories, URLs or screenshots.

3. Make a request

List the sessions. The one with "is_current": true is the session the website shows by default.

curl -H "Authorization: Bearer $POLICY_EAGLE_API_KEY" \
  https://www.policyeagle.org/api/v1/sessions

Then search that session. This finds education bills that became law, newest action first:

curl -H "Authorization: Bearer $POLICY_EAGLE_API_KEY" \
  "https://www.policyeagle.org/api/v1/bills?session_id=27113&categories=education&stage=law&limit=5"

Each result has a session_id and bill_id. Use the pair to read the bill and its history:

curl -H "Authorization: Bearer $POLICY_EAGLE_API_KEY" \
  https://www.policyeagle.org/api/v1/bills/27113/BILL_ID/actions

From code

TypeScript (server side)

const response = await fetch("https://www.policyeagle.org/api/v1/bills?session_id=27113&text=water", {
  headers: { Authorization: `Bearer ${process.env.POLICY_EAGLE_API_KEY}` },
});
const { data, meta } = await response.json();
for (const bill of data) console.log(bill.label, bill.title);
// meta.next_cursor: pass as ?cursor= with the same filters for the next page

Python

import os, requests

response = requests.get(
    "https://www.policyeagle.org/api/v1/bills",
    params={"session_id": 27113, "text": "water"},
    headers={"Authorization": f"Bearer {os.environ['POLICY_EAGLE_API_KEY']}"},
)
response.raise_for_status()
for bill in response.json()["data"]:
    print(bill["label"], bill["title"])

4. Choose your path

Check a saved key

curl -H "Authorization: Bearer $POLICY_EAGLE_API_KEY" https://www.policyeagle.org/api/v1/me

A 401 means the key is wrong, expired or revoked. Create a replacement in your account; we can't show an existing key again.