Docs

Parse an address

Split one line of free text into USPS Publication 28 components and standardized delivery lines.

POST https://api.fieldgeist.com/v1/verify/parse

Sends one free-text US address to US-LEX-1, the Verify model. The response gives the address type, its components in USPS Publication 28 form, the standardized delivery lines, a confidence score and warnings for anything missing, unusual or out of scope.

The parser standardizes what you send (Avenue becomes AVE, apt becomes APT); it doesn't correct spelling or check that the address exists. To match the result to a parcel, send it to Look up a parcel.

Authentication

Authorization: Bearer <key>. See Authentication.

Request body

FieldTypeRequiredDescription
linestringYesThe address as one line of text, up to 256 characters. Commas and line breaks are optional.

Request example

curl https://api.fieldgeist.com/v1/verify/parse \
  -H "Authorization: Bearer $FIELDGEIST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"line": "350 5th ave apt 21b new york ny 10118"}'

Response

200 OK

{
  "input": "350 5th ave apt 21b new york ny 10118",
  "type": "street",
  "components": {
    "city": "NEW YORK",
    "addressNumber": "350",
    "streetSuffix": "AVE",
    "streetName": "5TH",
    "occupancyType": "APT",
    "occupancyId": "21B",
    "state": "NY",
    "zip5": "10118"
  },
  "lines": ["350 5TH AVE APT 21B", "NEW YORK NY  10118"],
  "warnings": [],
  "confidence": 0.9999020747368791,
  "model": { "name": "us-lex-1", "version": "0.1.0", "backend": "model" }
}
FieldTypeDescription
inputstringThe line you sent, unchanged.
typestringAddress type: street, po_box, rural_route, military, general_delivery, dual (a street address and a PO box in one line) or ambiguous (the type couldn't be determined). Only street addresses can be looked up.
componentsobjectThe address components found, in Publication 28 form. Components that weren't found are left out. See Components.
linesstring[]The standardized address as delivery lines: the delivery line(s) first, then CITY ST ZIP (two spaces before the ZIP, as Publication 28 prefers).
warningsobject[]Anything missing, unusual or out of scope. Empty when the parse is clean. See Warnings.
confidencenumber0 to 1. How sure the model is of the labels it assigned. See Confidence and warnings.
modelobjectWhich model read the line: name (us-lex-1), version, and backend: model, or heuristic when the rule-based fallback (us-lex-rules) answered instead. Store version with results you keep. See Versions.

Components

All values are uppercase strings.

ComponentExampleDescription
addressNumber350Primary house number.
addressNumberSuffix1/2Suffix after the house number, such as a fraction.
predirectionalWDirection before the street name.
streetName5THStreet name.
streetSuffixAVEStreet type, abbreviated per Publication 28 (ST, AVE, BLVD).
postdirectionalNWDirection after the street name.
occupancyTypeAPTSecondary unit designator (APT, STE, UNIT, #).
occupancyId21BSecondary unit number.
secondaryUnits[{"type":"BLDG","id":"A"},{"type":"APT","id":"4"}]Present only when the address has two or more units, in input order. occupancyType and occupancyId then hold the last one.
poBoxType, poBoxIdPO BOX, 1234PO box designator and number.
ruralRouteType, ruralRouteIdRR, 2 BOX 15Rural route designator, and the route and box number.
firmA business or recipient name in the line.
urbanizationPuerto Rico urbanization name.
cityNEW YORKCity.
stateNYTwo-letter state or territory code.
zip5101185-digit ZIP Code.
zip40003ZIP+4 add-on.
otherTokens the model couldn't place. Kept for inspection, never rendered into lines.

Warnings

Each warning has a code and a message. Warnings about one part of the input also carry start and end, character offsets into input. Branch on code; the message wording may change.

codeMeaning
missing_address_numberA street name was found without a house number.
missing_street_nameNo street name was found (for example, a suffix with no street name before it).
missing_cityNo city.
missing_stateNo state.
missing_zipNo ZIP Code.
invalid_zipThe ZIP Code doesn't have 5 digits, or the ZIP+4 add-on doesn't have 4.
invalid_stateThe state isn't a Publication 28 state or possession abbreviation.
unit_without_idA unit designator (APT) with no unit number.
unit_id_without_typeA unit number with no designator. occupancyType is set to #.
unknown_suffixThe street suffix isn't a Publication 28 suffix.
unknown_unit_designatorThe unit designator isn't a Publication 28 designator; it's kept as typed.
unknown_tokensSome words couldn't be placed in any component. They're listed in components.other.
discontiguous_componentOne component appeared in separate parts of the line; the parts were joined with a space.
leading_zero_removedLeading zeros were removed from a PO box number.
line_overflowA line in lines is longer than 40 characters, the Publication 28 maximum.
dual_addressThe line has both a street address and a PO box or rural route.
ambiguous_typeThe address type couldn't be determined, or a word read as the street suffix isn't a Publication 28 suffix, so the street/city boundary is a guess.
ambiguous_city_streetA word could belong to the street name or the city; the boundary between them is a guess.
unsupported_intersectionThe line looks like a street intersection, not a delivery address.
possibly_foreignThe line looks like a non-US address.
low_confidenceconfidence is below 0.6.
empty_inputline was empty or only whitespace.
model_unavailableThe model couldn't run, so the rule-based fallback answered.
model_output_invalidThe model's labels were inconsistent, so the rule-based fallback's parse was used.

A parse with warnings

An intersection parses, but the answer says it isn't a delivery address:

{
  "input": "Main St and 5th Ave, Springfield IL",
  "type": "ambiguous",
  "components": {
    "firm": "MAIN ST AND",
    "city": "SPRINGFIELD",
    "streetSuffix": "AVE",
    "streetName": "5TH",
    "state": "IL"
  },
  "lines": ["MAIN ST AND", "5TH AVE", "SPRINGFIELD IL"],
  "warnings": [
    {
      "code": "unsupported_intersection",
      "message": "\"Main St and 5th Ave\" looks like a street intersection, not a delivery address",
      "start": 0,
      "end": 19
    },
    { "code": "ambiguous_type", "message": "address type could not be determined: the input looks like a street intersection" },
    { "code": "missing_address_number", "message": "street name found without a primary address number" },
    { "code": "missing_zip", "message": "no ZIP Code" },
    { "code": "low_confidence", "message": "confidence 0.50 < 0.6" }
  ],
  "confidence": 0.5,
  "model": { "name": "us-lex-1", "version": "0.1.0", "backend": "model" }
}

An empty line is answered with 200, type: "ambiguous" and an empty_input warning, not an error. It is billed.

Errors

StatuserrorCause
400invalid_jsonThe body isn't valid JSON.
400line_requiredThe body has no line string.
413line_too_longline is longer than 256 characters. The response includes "max": 256.
401, 402, 403, 429, 5xxSee Errors.
{ "error": "line_too_long", "max": 256 }

On this page