GeoResponse

interface GeoResponse extends GeoResult { ip: string | null; country: Named | null; state: { code: string | null; name: string } | null; city: string | null; postcode: string | null; timezone: string | null; latitude: number | null; longitude: number | null; language: string | null; currency: string | null; region: RegionName | null; source: 'default' | 'cf'; rules?: CountryResponse; }

The response of GET /v1/geo: where the visitor is, and with ?include=rules the rules of the country a form should open on, so a cold checkout needs one request that depends on the visitor.

Hierarchy


Properties

ip: string | null

Inherited from ip

The visitor's IP address. It identifies a person rather than a place, which is why GET /v1/geo is never cached.

country: Named | null

Inherited from country

The country the visitor is in, named in ?lang=.

state: { code: string | null; name: string } | null

Inherited from state

The region within the country, named as the edge names it, in English. code is the ISO 3166-2 suffix, when the edge sent one.

city: string | null

Inherited from city

The city, as the edge names it.

postcode: string | null

Inherited from postcode

The postcode of the visitor's area, as the edge resolved it.

timezone: string | null

Inherited from timezone

An IANA time zone: America/Los_Angeles.

latitude: number | null

Inherited from latitude

Approximate latitude, in degrees.

longitude: number | null

Inherited from longitude

Approximate longitude, in degrees.

language: string | null

Inherited from language

The browser's most preferred language, as a BCP 47 tag: what the browser is set to, not what is spoken where it is. A browser in Miami set to Spanish reports es-US, and one set to English in the same city en-US.

currency: string | null

Inherited from currency

The ISO 4217 currency in circulation where the visitor is. A reading of their location, not what to charge them: pricing stays the storefront's decision.

region: RegionName | null

Inherited from region

The country's UN M49 region and subregion, named in ?lang=.

source: 'default' | 'cf'

Inherited from source

cf when the edge resolved a country. default when it could not (a local request, or a Tor exit): country, currency and region are then null.

rules: CountryResponse

With ?include=rules: the rules of ?country= when it is given; else of the detected country, when ?countries= is absent or lists it; else of the first country in ?countries=; else of the US.