United States Census Bureau · API Governance Rules

United States Census Bureau API Rules

Spectral linting rules defining API design standards and conventions for United States Census Bureau.

8 Rules error 2 warn 4 info 2
View Rules File View on GitHub

Rule Categories

census

Rules

warn
census-year-parameter-documented
Year path parameters should document available year ranges
$.paths..parameters[?(@.name == "year")].description
error
census-get-parameter-required
The get query parameter is the primary Census API parameter and should be marked required
$.paths..parameters[?(@.name == "get")]
warn
census-for-geography-documented
The for geography parameter should document FIPS code syntax
$.paths..parameters[?(@.name == "for")].description
info
census-key-parameter-documented
API key parameters should explain usage limits
$.paths..parameters[?(@.name == "key")].description
error
census-operation-ids-present
All operations must have operationIds
$.paths[*][*]
warn
census-tags-present
All operations should have tags for dataset grouping
$.paths[*][*]
warn
census-response-schema-defined
All 200 responses should define response schema
$.paths..responses.200.content.application/json
info
census-2d-array-response-described
The 2D array response format should be documented
$.paths..[?(@.tags && @.tags.includes('American Community Survey'))].description

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas

rules:
  census-year-parameter-documented:
    description: Year path parameters should document available year ranges
    message: "Year path parameters should document the range of available data years"
    severity: warn
    given: $.paths..parameters[?(@.name == "year")].description
    then:
      function: truthy

  census-get-parameter-required:
    description: The get query parameter is the primary Census API parameter and should be marked required
    message: "The 'get' query parameter should be required for Census Data API endpoints"
    severity: error
    given: $.paths..parameters[?(@.name == "get")]
    then:
      field: required
      function: truthy

  census-for-geography-documented:
    description: The for geography parameter should document FIPS code syntax
    message: "The 'for' parameter should document geography FIPS filter syntax"
    severity: warn
    given: $.paths..parameters[?(@.name == "for")].description
    then:
      function: truthy

  census-key-parameter-documented:
    description: API key parameters should explain usage limits
    message: "The 'key' parameter should describe the usage limits benefit (500+ requests/day)"
    severity: info
    given: $.paths..parameters[?(@.name == "key")].description
    then:
      function: pattern
      functionOptions:
        match: "(requests|limit|key)"

  census-operation-ids-present:
    description: All operations must have operationIds
    message: "Operation must have an operationId"
    severity: error
    given: $.paths[*][*]
    then:
      field: operationId
      function: truthy

  census-tags-present:
    description: All operations should have tags for dataset grouping
    message: "Operation should be tagged with its dataset category"
    severity: warn
    given: $.paths[*][*]
    then:
      field: tags
      function: truthy

  census-response-schema-defined:
    description: All 200 responses should define response schema
    message: "200 response should define the DataAPIResponse or GeocodeResponse schema"
    severity: warn
    given: $.paths..responses.200.content.application/json
    then:
      field: schema
      function: truthy

  census-2d-array-response-described:
    description: The 2D array response format should be documented
    message: "Census 2D array response format should be described in the operation description"
    severity: info
    given: $.paths..[?(@.tags && @.tags.includes('American Community Survey'))].description
    then:
      function: truthy

Work with this as data

Every ruleset here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This ruleset
curl "https://apis.io/api/v1/rules/census-data-api-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.