Search Census Variables
census_search_variablesSearch Census variables by keyword across variable labels and concept groups. Returns variable codes with human-readable labels — use this to go from a concept like "median household income" to the variable code B19013_001E needed for data queries. On ACS datasets it returns both estimate (E suffix) and margin-of-error (M suffix) codes so you can request both; other dataset families publish no margins of error. Also use it to find the predicate codes a dataset filters on, such as NAICS2017 in cbp. When total_matches exceeds the limit, narrow the query to see more specific results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | No | Vintage year to search (default: latest available for the dataset). | |
| limit | No | Maximum results to return (default: 20, max: 100). Increase if total_matches greatly exceeds the limit. | |
| query | Yes | Keyword to search (e.g., "median household income", "poverty", "bachelor's degree"). Multi-word queries search for all terms. | |
| dataset | No | Dataset to search within (default: "acs/acs5"). Use census_list_datasets to discover options. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The limit that was applied. | |
| year | No | Vintage year that was searched. | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Number of variables returned after the limit. | |
| notice | No | Guidance when no variables matched, or when results were truncated — suggests broader keywords, a narrower query, or a higher limit. | |
| dataset | No | Dataset that was searched. | |
| truncated | No | True when total_matches exceeded the limit and results were cut off. | |
| variables | No | Matching variables sorted by relevance. On ACS datasets, codes ending in E are estimates and M are their margins of error; on other datasets the suffix carries no such meaning. | |
| totalMatches | No | Total variables matching the query before the limit was applied. | |
| effectiveQuery | No | Query as the server parsed it. |