us-census-agent
US Census Bureau · Autonomous AI Microservice

Query 28,000+ demographic metrics in natural language.

Ask statistical questions across every US state, county, city, or ZIP code. No FIPS lookup tables, Census variable IDs, or manual data wrangling — just sign in for a free key and ask. Pick how you'd like to consume the service:

Consumption Pathways

Add to Your AI Agent

Paste one instruction into any AI agent (Claude Code, Cursor, LangChain, OpenWebUI, ...). The skill manifest teaches it the endpoint, authentication, and query patterns — your agent handles the rest autonomously.

Read https://censusdata.xyz/skill and follow it to answer US Census data questions.
Authenticate /query requests with the header X-API-Key: cd_YOUR_API_KEY
View skill manifest (.md) → Sign in with Google (top right) and your personal API key is embedded automatically.

Interactive Query Playground

Test the agent in real time. Ask any demographic, economic, commute, or housing question. The agent autonomously resolves geographies, handles historical variable shifts, queries live Census tables, and returns structured data.

🔑 Queries need a free API key — sign in with Google (top right) to get yours.
💡 Prompt Builder: I want to compare in for the year .
💰 Austin vs Denver Income 🎖️ Seattle Veterans Rate 👨‍👩‍👧‍👦 Utah Family Size Trends 🚗 CA Commute Leaders
Agent reasoning, resolving FIPS codes, querying live Census API...

Distilled Summary

Service Integration Guide

Consume the service programmatically inside your scripts, data workflows, or autonomous AI agents. All /query requests require an API key — sign in with Google above to get yours free. Pass it as an X-API-Key header (or api_key query parameter). The free tier includes a daily query allowance; contact the administrator for higher or unlimited quotas.

Python REST Integration

Query via Python

Send queries via standard HTTP GET requests with your API key. Returns structured JSON containing narrative summaries and underlying raw data.

import requests

url = "https://censusdata.xyz/query"
params = {"q": "What is the poverty rate in Chicago, IL?"}
headers = {"X-API-Key": "cd_YOUR_API_KEY"}

resp = requests.get(url, params=params, headers=headers)
if resp.status_code == 401:
    print("Missing/invalid API key — sign in at censusdata.xyz")
elif resp.status_code == 429:
    print("Daily quota exhausted — resets at midnight UTC")
else:
    data = resp.json()
    if data.get("success"):
        print("Summary:", data["summary"])
        print("Raw Data:", data["raw_data"])
    else:
        print("Error / Unanswerable:", data.get("error_details"))
Response Package Schema (JSON)

Structured Output Format

Every response package returns a boolean status flag alongside narrative summaries, structured records, and your remaining quota.

{
  "success": true,              // false if irrelevant/unanswerable
  "error_details": null,        // details if success is false
  "query": "user request text",
  "summary": "distilled narrative response",
  "raw_data": [ /* structured Census records */ ],
  "quota": { "used": 3, "limit": 10 }  // today's usage
}