CBSA Boundaries Documentation
    • Dark
      Light
    • PDF

    CBSA Boundaries Documentation

    • Dark
      Light
    • PDF

    Article summary

    Purpose

    LightBox CBSA Boundaries API supports autocomplete, tile and BBox image creation, and spatial requests to add to your favorite map control or to retrieve CBSA objects to add to your analysis. The CBSA object contains name, cbsa id, country along with the centroid and polygon in WKT format.

    OAS 3.1 Specification

    Features

    • Autocomplete
    • Tile/BBox image creation for your common map controls
    • Return county object by ID
    • Return county object by geometry WKT

    Requirements

    The LightBox APIs are hosted in the cloud and therefore have no platform requirements. Application requirements include:
    • A network connection to the LightBox API server
    • Ability to parse JavaScript Object Notation (JSON) API responses
    • Secure HTTPS connection
    • LightBox authentication key
    • LightBox authentication key

    Connecting your account

    When your LightBox user account is created, a unique API key is also generated. The API key should be kept secret at all times and can only be used for API requests. The key is required in all API calls.

    To retrieve your unique API key:

    • Log in to the LightBox Developer Portal 
    • Select Apps from the menu bar
    • In your approved App, note your API key (under Consumer Key)

    Performing API requests

    All API requests must be made over secure HTTPS connections. Requests made over HTTP will fail.

    The base URL of the API server that all API requests will be made to is: https://api.lightboxre.com/ followed by a version number https://api.lightboxre.com/v1

    Authentication

    LightBox APIs uses a token-based authentication. All requests to the LightBox APIs must be authenticated. The token to be passed via an HTTP header with key 'x-api-key' and value <Your authentication token>

    Pass your unique API key in the authorization header of every LightBox API call.  LightBox uses this information to authenticate your identify and determine whether you have sufficient permissions to complete the operation. curl -X GET -H ‘x-api-key: (api_key)’  https://api.lightboxre.com/

    API Requests

    Query by Geometry

    Query for CBSA records based on a geometry represented as a well-known text (WKT) string.

    • POINT(-122.40317865990883 45.585729937697515)
    • LINESTRING (-122.40581795357949 45.58497908445598,-122.40325376176125 45.58627054581282)
    • POLYGON ((-122.4032877944377 45.58629457984625,-122.40264406427413 45.585697658341736,-122.40184476598769 45.58610686936547,-122.40244558080703 45.586688769812724,-122.4032877944377 45.58629457984625))

    GET /cbsas/us/geometry

    Pro Tip:
    This endpoint is best used when you have an existing latitude longitude from 3rd party geocoder, or using the value of a map click/identify from a standard map control.

    Example requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/cbsas/us/geometry?wkt=POINT%28-117.852723%2033.63799%29&bufferDistance=50&bufferUnit=m

    https://api.lightboxre.com/v1/cbsas/us/geometry?wkt=POINT%28-117.852723%2033.63799%29&bufferDistance=50&bufferUnit=m

    Parameters

    ParameterTypeDescriptionUsage
    wktqueryThe geometry of the location expressed in WKT format.required
    bufferDistancequeryBuffer distance expressed in 'bufferUnits'.optional
    bufferUnitqueryThe unit type to apply to the buffer (eg m, km, ft, mi)optional

    Response

    Media type: application/json

    Query by CBSA ID 

    Query CBSAs using the 5 digit cbsa 'ID.' (e.g. 31080)

    GET /cbsas/us/{id}

    Example Requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/cbsas/us/31080

    https://api.lightboxre.com/v1/cbsas/us/31080

    Parameters

    ParameterTypeDescriptionUsage
    idpathFive digit CBSA ID e.g. 31080required

    Response

    Media type: application/json

    Autocomplete

    Return multiple records based on a partial cbsa name.

    GET /cbsas/us/_autocomplete

    Example Requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/cbsas/_autocomplete/us?text=Fairbank

    https://api.lightboxre.com/v1/cbsas/_autocomplete/us?text=Fairbank

    Parameters

    ParameterTypeDescriptionUsage
    textrequestFull or partial cbsa namerequired

    Response

    Media type: application/json

    Tile 

    Use within common map controls to show county boundaries as a tile overlay.

    GET /cbsas/us/tile/{zoom}/{x}/{y}

    Example Requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/cbsas/us/tile/18/45050/104888

    https://api.lightboxre.com/v1/cbsas/us/tile/18/45050/104888

    Parameters

    ParameterTypeDescriptionUsage
    zoompathTile zoom level, which can be a minimum of '13' and a maximum or '21.'required
    xpathTile column.required
    ypathTile row.required

    Response

    Media type: image/png

    Tile Bounding Box 

    Use within common map controls to show county boundaries as a bounding box overlay.

    GET /cbsas/us/tile

    Example Requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/cbsas/us/tile?bbox=-83.0434660625,40.0198659375,-83.04070793749999,40.0226240625&width=600&height=600

    https://api.lightboxre.com/v1/cbsas/us/tile?bbox=-83.0434660625,40.0198659375,-83.04070793749999,40.0226240625&width=600&height=600

    Parameters

    ParameterTypeDescriptionUsage
    bboxpathA bounding box expressed in the NAD83 projected coordinate system.required
    widthpathWidth of the result imagerequired
    heightpathHeight of the result imagerequired

    Response

    Media type: image/png

    Health Check

    Health Check is an endpoint used to determine the health of this service

    GET /cbsas/health

    Example Requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/cbsas/health

    https://api.lightboxre.com/v1/cbsas/health

    Parameters

    ParameterTypeDescriptionUsage
    None
     

    Response

    Media type: application/json

    Health Check HTTP Status Codes:

    Status CodeDescription
    200 OK - Service is up and healthy
    503Service is unavailable

    API Response

    For each endpoint other then the tile requests the response will stay consistent. 

    {
      "$ref": "string",
      "$metadata": {
        "geogcs": {
          "epsg": "4326"
        },
        "recordSet": {
          "totalRecords": 99,
          "bbox": {
            "xMax": -105.250409,
            "xMin": -105.251916,
            "yMax": 40.023629,
            "yMin": 40.022576
          }
        }
      },
      "cbsas": [
        {
          "$ref": "string",
          "id": "31080",
          "location": {
            "countryCode": "US",
            "representativePoint": {
              "longitude": 0,
              "latitude": 0,
              "geometry": {
                "wkt": "string"
              }
            },
            "geometry": {
              "wkt": "string"
            }
          },
          "CBSAFP": "31080",
          "CSAFP": "348",
          "geoid": "31080",
          "name": "Los Angeles-Long Beach-Anaheim, CA",
          "nameLSAD": "string",
          "LSAD": "string",
          "MEMI": "string"
        }
      ]
    }

    Field Dictionary

    FieldTypeDescription
    CBSAFPstringCurrent metropolitan statistical area/micropolitan statistical area code.
    idstringPrimary ID for this record
    CSAFPstringCurrent combined statistical area code.
    geoidstringCounty subdivision identifier; a concatenation of current state FIPS code, county FIPS code, and county subdivision FIPS code.
    namestringCurrent county subdivision name.
    nameLSADstringCurrent name and the translated legal/statistical area description code for county subdivision.
    LASDstringCurrent legal/statistical area description code for county subdivision.
    MEMIstringCurrent metropolitan/micropolitan status indicator.
    location.countryCodestringTwo-letter country code of the country in which the CBSA is located.

    HTTP Error Codes

    HTTP Response status codes along with a brief summary of their commonly accepted usage. These status codes are returned by LightBox APIs for each request:
    200
    The request succeeded.
    201
    The object was created successfully
    202Accepted, no content
    204Successful, no content
    204
    The server has successfully fulfilled the request and that there is no additional content to send in the response payload body. Typically returned on a DELETE
    400
    One or more of the request parameters were invalid.
    401
    The client must authenticate itself to get the requested response. Note: This could also be due to your trial key has expired.
    404
    The server cannot find the requested resource. This can also mean that the endpoint is valid but the resource itself does not exist.
    429
    Too many requests were made in a short period of time, or you have exceeded your request-lot pool.
    500
    The server has encountered an error it does not know how to handle.
    503Service Unavailable.





    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.