Skip to main content

INFO

Targeting Errors

Error handling for invalid targeting parameters.

The API returns standard HTTP status codes for targeting errors. Understanding these errors will help you troubleshoot and resolve issues quickly.

400 Bad Request

Returned for invalid targeting parameters:

ErrorDescription
Unknown country codeThe country code is not a valid ISO 3166-1 alpha-2 code
Unknown state codeThe state code is not recognized
Invalid state for countryThe state does not belong to the specified country
Invalid city for stateThe city was not found in the specified state/country
State specified without countryA state was provided but no country was specified
Invalid session IDSession ID is empty, too long (>25 chars), or contains invalid characters

Example Error Response

Invalid targeting: Geo targeting error: unknown country code: 'XX'

409 Conflict

Returned when a city is ambiguous (exists in multiple states within the country).

Example Error Response

Ambiguous geo target: city 'springfield' is ambiguous in country 'US', found in states: IL, MA, MO, OH

Resolution

Specify the state to disambiguate the city.

Examples

# This will return a 400 error
curl -x http://USERNAME:PASSWORD@res.beta.globalbyte.io:10000 \
  -H "country: XX" \
  https://httpbin.org/ip

Error Responses

Code: 400

Description: Invalid targeting parameters (unknown country, state, city, or session ID).

Code: 409

Description: Ambiguous city - exists in multiple states. Specify the state to disambiguate.

Invalid targeting: Geo targeting error: unknown country code: 'XX'