Sign up for email updates from SBAReceive helpful business tips and upcoming events in your area.


About SBA

U.S. City and County Web Data API

1. Summary

This geographic names data set provides a “mashup” of URLs for official city and county government web sites and city and county location data from the USGS Geographic Names Information System (GNIS). GNIS data includes incorporated places, census designated areas, unincorporated places, counties, and populated places.

The API is RESTful and output formats are available in XML and JSON. There is a DTD for the XML output available.

2. Request Methods

City and County data by state

URL templates:
For all URLs: http://api.sba.gov/geodata/city_county_links_for_state_of/STATE_ABBREVIATION.FORMAT
For primary URLs only: http://api.sba.gov/geodata/primary_city_county_links_for_state_of/STATE_ABBREVIATION.FORMAT
For all data with or without URLs: http://api.sba.gov/geodata/city_county_data_for_state_of/STATE_ABBREVIATION.FORMAT
Example URL:
http://api.sba.gov/geodata/city_county_links_for_state_of/tx.xml
Parameters:
STATE_ABBREVIATION
The two-letter postal code for the state. This is case insensitive.
FORMAT
Either xml or json, case sensitive.

All City data by state

URL templates:
For all URLs: http://api.sba.gov/geodata/city_links_for_state_of/STATE_ABBREVIATION.FORMAT
For primary URLs only: http://api.sba.gov/geodata/primary_city_links_for_state_of/STATE_ABBREVIATION.FORMAT
For all data with or without URLs: http://api.sba.gov/geodata/city_data_for_state_of/STATE_ABBREVIATION.FORMAT
Example URL:
http://api.sba.gov/geodata/city_links_for_state_of/tx.xml
Parameters:
STATE_ABBREVIATION
The two-letter postal code for the state. This is case insensitive.
FORMAT
Either xml or json, case sensitive.

All County URLs in a state

URL templates:
For all URLs: http://api.sba.gov/geodata/county_links_for_state_of/STATE_ABBREVIATION.FORMAT
For primary URLs only: http://api.sba.gov/geodata/primary_county_links_for_state_of/STATE_ABBREVIATION.FORMAT
For all data with or without URLs: http://api.sba.gov/geodata/county_data_for_state_of/STATE_ABBREVIATION.FORMAT
Example URL:
http://api.sba.gov/geodata/county_links_for_state_of/tx.xml
Parameters:
STATE_ABBREVIATION
The two-letter postal code for the state. This is case insensitive.
FORMAT
Either xml or json, case sensitive.

All data for a specific City

URL templates:
For all URLs: http://api.sba.gov/geodata/all_links_for_city_of/CITY_NAME/STATE_ABBREVIATION.FORMAT
For primary URLs only: http://api.sba.gov/geodata/primary_links_for_city_of/CITY_NAME/STATE_ABBREVIATION.FORMAT
For all data with or without URLs: http://api.sba.gov/geodata/all_data_for_city_of/CITY_NAME/STATE_ABBREVIATION.FORMAT
Example URL:
http://api.sba.gov/geodata/all_links_for_city_of/new%20orleans/la.xml
Parameters:
CITY_NAME
The name of the city, URL-encoded, case insensitive..
STATE_ABBREVIATION
The two-letter postal code for the state. This is case insensitive.
FORMAT
Either xml or json, case sensitive.

All data for a specific County

URL templates:
For all URLs: http://api.sba.gov/geodata/all_links_for_county_of/COUNTY_NAME/STATE_ABBREVIATION.FORMAT
For primary URLs only: http://api.sba.gov/geodata/primary_links_for_county_of/COUNTY_NAME/STATE_ABBREVIATION.FORMAT
For all data with or without URLs: http://api.sba.gov/geodata/all_data_for_city_of/CITY_NAME/STATE_ABBREVIATION.FORMAT
Example URL:
http://api.sba.gov/geodata/all_links_for_county_of/orange%20county/ca.xml
Parameters:
COUNTY_NAME
The full name of the county, URL-encoded, including the words “County”, “Parish”, etc., case insensitive.
STATE_ABBREVIATION
The two-letter postal code for the state. This is case insensitive.
FORMAT
Either xml or json, case sensitive.

3. Response Formats

XML Format

The XML response is well-documented in the XML DTD for this document type. The document root element's tag-name is <sites>. Each record within the document is contained within a <site> element, containing sub-elements as detailed in the JSON Format documentation below. Each of these sub-elements contains its relevant data as Parsed Character Data.

JSON Format

The JSON response consists of an array of anonymous objects, each of which represent a site. Each of these objects has the following properties:

Field Name Description Type Max.
Length
Possible Values
county_name County or county equivalent containing the geographic feature (e.g. city, town, etc.). This value is empty when the geographic feature is a county. String 255
description Contains a brief description of the website for the geographic feature, when available. String 250
feat_class The feature class as provided by the GNIS database. URLs are only associated with geographic features with feat_class equal to Civil or Populated Place. For further details, see the GNIS documentation. String 255 Populated Place
Post Office
Civil
Locale
feature_id Feature ID from the GNIS database. Integer 11
fips_class Class code from the GNIS database. For further details, see the GNIS documentation. String 2 C1
C2
C3
C4
C5
C6
C7
C8
C9
H1
H4
H5
H6
fips_county_cd INCITS 31:200x, (Formerly FIPS 6-4) Codes for the Identification of Counties and Equivalent Entities of the United States, its Possessions, and Insular Areas. String 255
full_county_name The full name of the county containing a geographic feature is located (e.g., Montgomery County). String 255
link_title Title of the hyperlink for a URL associated with the geographic feature. String 255
name The name of the geographic feature. String 255
primary_latitude The primary latitude for the geographic feature. Float
primary_longitude The primary longitude for the geographic feature. Float
state_abbreviation The standard two-letter state or territory postal abbreviation containing the geographic feature. String 2
state_name The full state or territory name (e.g. New Hampshire) containing the geographic feature. String 25
url The URL for the geographic feature. String 255