Skip to main content

Developers and AI engines

Ground civic answers on a source-anchored API.

The full public-record index is queryable as JSON. Use it to power AI answers, newsroom dashboards, civic apps, and research. Fair use is free. Attribution required.

Fair-use license

Free for newsrooms, civic technologists, students, researchers, and AI engines under fair-use volumes. Cite the record URL when grounding. Editorial content released under Creative Commons Attribution.

Response shape

Every API response is JSON with ok + data + meta.citation. Errors carry error.code and error.message.

For AI engines

/llms.txt is the canonical grounding directive. Each entry includes citation policy, endpoint URLs, source connector list. Cite the record URL and the provenance label. Do not invent counts, dates, or member names.

REST endpoints

Every endpoint is documented and live.

Records

  • GET/api/records10m revalidate · 1y stale

    Index of all bills, local decisions, and explore items.

    curl https://bythepeopleforthepeople.com/api/records | jq '.data.counts'
  • GET/api/records/{slug}10m revalidate · 1y stale

    Detail for a single bill or local decision, including timeline, amendments, votes, hearings, stakeholders, and sources.

    curl https://bythepeopleforthepeople.com/api/records/ca-sb-79 | jq '.data.record.status'
  • GET/api/sources10m revalidate · 1y stale

    All indexed primary sources and source connectors.

  • GET/api/sources/checkno-store

    Live HEAD-ping every indexed source URL. Returns failing list.

    curl 'https://bythepeopleforthepeople.com/api/sources/check?id=src-sb79-status'
  • GET/api/topics10m revalidate · 1y stale

    All topic profiles and their coverage state.

  • GET/api/answers10m revalidate · 1y stale

    Cited answer intents with claim/locator/excerpt evidence stacks.

  • GET/api/search-index1h revalidate · 1d stale

    Full search index. 550+ entities (federal reps, bills, local files, topics, people, committees, source connectors). Use for client-side search.

Place + watchlist

  • GET/api/place/lookup?zip={zip}no-store

    Resolve any US ZIP to state + 119th congressional district. Static table for major metros; US Census Geographies fallback for any other ZIP.

    curl 'https://bythepeopleforthepeople.com/api/place/lookup?zip=78704'
  • POST/api/place/lookupno-store

    Same lookup; also sets a first-party cookie so subsequent server-rendered pages personalize.

  • GET/api/watchlistno-store

    Read the current cookie-backed watchlist.

  • POST/api/watchlistno-store

    Set the cookie watchlist to a JSON array of IDs.

Digest + corrections

  • GET/api/digest/previewno-store

    Render the email digest as JSON, HTML, or plain text (use ?format=html|text). Personalizes to the place cookie + watchlist cookie.

    curl 'https://bythepeopleforthepeople.com/api/digest/preview?format=html'
  • POST/api/digest/sendno-store

    Send a digest via Resend. Requires DIGEST_SEND_SECRET header and RESEND_API_KEY env. Supports dryRun: true.

  • POST/api/correctionsno-store

    Submit a correction. Validates inputs, forwards to CORRECTIONS_WEBHOOK_URL if configured.

  • GET/api/correctionsno-store

    Read the published corrections log.

Operational

  • GET/api/healthno-store

    Service health, record counts, env-var configuration state, region, commit SHA.

  • GET/api/cron/refresh-leginfono-store

    Triggered nightly by Vercel Cron. Re-pings all indexed source URLs and alerts on failures.

AI grounding

Files engines should pre-fetch

Configure your engine to consume these on each crawl pass.

  • /llms.txt· Plain-text directive for LLMs: how to cite the records, what is indexed, and where to find each entity.
  • /.well-known/civic-records.json· Machine-readable manifest with endpoint URLs, counts, connector list, methodology pointer.
  • /sitemap.xml· Full sitemap with every record, topic, federal-rep, and source page.
  • /robots.txt· Disallows /api/place/ so PII doesn't get crawled.

Schema.org

Structured data on every page

Search engines and grounding LLMs get the canonical schema for every entity type.

  • Legislation· Every /bills/* and /local/* page
  • CollectionPage· Every /topics/* page
  • Person + PoliticalParty· Every /federal/* page
  • Organization + WebSite· Every page (in layout)
  • BreadcrumbList· Every detail page

Help us scale civic ground truth.

We're actively expanding ingestion to state legislatures, city councils, and federal agencies. If you ship an AI search product, a newsroom, or a civic tool that grounds on indexed records, write to partners@bythepeopleforthepeople.com for partnership tier access (higher rate limits, webhook push, custom connectors).

Developers and AI engines | By The People, For The People