Flood Zone API Get a free key

Error codes and what to do about each

Every error is JSON with a stable error code and a readable message, plus field, reason or upstream where they help. Branch on error, not on message, which may be reworded.

HTTPerrorWhenCounts against quotaWhat to do
401invalid_keyThe key is missing, wrong, revoked, or its plan has ended. The answer is the same in every case, so keys cannot be probed.No (not metered)Check the Authorization header is Bearer fza_.... Create a new key on the account page if needed.
422invalid_requestNo input, both inputs, a latitude or longitude out of range or not a number, or an address shorter than 5 or longer than 300 characters. field names the parameter.No (refunded)Fix the parameter named in field. Do not retry unchanged.
404address_not_foundNo geocoder matched the address (reason: "no_match"), or only a street or place matched, which is not precise enough for a flood zone (reason: "not_address_level").YesInclude the house number, city and state, or geocode it yourself and send lat and lon.
429quota_exceededThe key's plan has used its calls for this calendar month (UTC).Not applicableUpgrade on the account page, or wait for the first of next month (UTC).
429rate_limitedMore than 5 requests in one second on one key.No (not metered)Wait one second and retry. Spread batch jobs out, or run them at a steady rate.
503upstream_unavailableFEMA's map service (upstream: "fema_nfhl") or the address geocoder (upstream: "geocoder") failed or timed out. Sent with a Retry-After header.No (refunded)Retry after the number of seconds in Retry-After (30), with backoff if it repeats.
500internal_errorSomething failed on our side.No (refunded)Retry later; if it repeats, email [email protected] with the time and the query.

Retrying well

Example bodies

401 invalid_key
{
  "error": "invalid_key",
  "message": "Missing or invalid API key."
}
422 invalid_request
{
  "error": "invalid_request",
  "message": "lat must be a number between -90 and 90 (WGS84 decimal degrees).",
  "field": "lat"
}
404 address_not_found
{
  "error": "address_not_found",
  "message": "We could only match a street or place, not a specific address, and a street or town center is not a flood zone point. Include the house number, city and state, or send lat and lon.",
  "reason": "not_address_level"
}
429 quota_exceeded
{
  "error": "quota_exceeded",
  "message": "This key's plan allows 100 calls per calendar month (UTC). Upgrade or wait for the next month."
}
429 rate_limited
{
  "error": "rate_limited",
  "message": "More than 5 requests per second on this key. Wait a second and retry; this call was not counted."
}
503 upstream_unavailable
{
  "error": "upstream_unavailable",
  "message": "FEMA's flood map service did not answer. This call was not counted against your quota; retry shortly.",
  "upstream": "fema_nfhl",
  "retry_after": 30
}
500 internal_error
{
  "error": "internal_error",
  "message": "Something went wrong on our side. This call was not counted against your quota."
}