EmailmoversMyDataHub docs
Browse the docs

Reference / REST reference

Reference

Resolve a location

POST /v1/locations/resolve. Turn free text into region, county, town, postcode or radius filters.

Generated from the contractsView as Markdown

POST /v1/locations/resolve

Turn free text into region, county, town, postcode or radius filters. Ambiguous names come back as candidates with a question, never a silent choice. A radius under 5 miles needs an account (401 account-required).

PropertyValue
EndpointPOST https://mydatahub.emailmovers.com/v1/locations/resolve
Operation idresolveLocation
CostFree (0 credits)
AccessNo account needed. An API key or OAuth token with the scope counts:read is optional and adds your organisation's own figures.
MCP toolresolve_location
TagCatalogue

Request

Parameters

NameInTypeRequiredDescription
MyDataHub-VersionheaderstringnoThe dated API version, pinned per key when left out. Non-breaking changes ship as new dates; the path major changes only for breaking changes, with a 12 month deprecation window.

Body

MemberTypeRequiredDescription
textstringyesFree text such as "20 miles of Leeds", "Yorkshire" or "SW1".
radius_milesnumber (1 to 100)no
datasetenum: uk_contacts, ie_contacts, global_contactsnoThe dataset an audience draws from. uk_contacts is live; ie_contacts and global_contacts are listed but not yet served.

Example request

curl -X POST "https://mydatahub.emailmovers.com/v1/locations/resolve" \
  -H "Content-Type: application/json" \
  --data '{
  "text": "20 miles of Leeds"
}'

Responses

200: Candidates for the place.

Headers: RateLimit, RateLimit-Policy.

MemberTypeAlways presentDescription
textstringyes
ambiguousbooleanyesTrue when more than one candidate fits; ask the person which they meant.
questionstring or nullyes
candidatesarray of LocationCandidateyes
candidates[].kindenum: region, county, town, local_authority, postcode_area, postcode_district, postcode_sector, postcode_unit, and 2 moreyes
candidates[].codestringyesThe filter code, or the ONS code for a centre.
candidates[].labelstringyes
candidates[].contactsinteger (0 or more) or under 10 or suppressedyesA whole number; "under 10" when disclosure control withholds a small cell; or "suppressed" when secondary suppression hides a cell of 10 or more in a cross-tab or breakdown, so totals cannot be differenced. Anonymous and trial callers see cells rounded to the nearest 5.
candidates[].centreobject or nullyes
candidates[].filterFilteryesA ready filter for this candidate.
disclosureDisclosureyesWhether these numbers are exact or protected: "under 10" cells, rounding to 5 and secondary suppression for anonymous and trial callers.
disclosure.levelenum: exact, roundedyesexact for authenticated paid callers; rounded for anonymous and trial callers, whose counts under 100 and every cell are rounded to the nearest 5.
disclosure.rounded_tointeger or nullyes5 when numbers are rounded; null when they are exact.
disclosure.secondary_suppressionbooleanyesTrue when cross-tab or breakdown cells of 10 or more were hidden as "suppressed" so totals cannot be differenced.
disclosure.notesarray of stringyes

Example response

{
  "text": "20 miles of Leeds",
  "ambiguous": true,
  "question": "Leeds: city centre or the metropolitan district?",
  "candidates": [
    {
      "kind": "radius",
      "code": "E08000035",
      "label": "Within 20 miles of Leeds (metropolitan district centroid)",
      "contacts": 42318,
      "centre": {
        "lat": 53.7997,
        "lon": -1.5492
      },
      "filter": {
        "field": "site.location",
        "op": "within_radius",
        "centre": {
          "place": "Leeds",
          "code": "E08000035"
        },
        "radius_miles": 20
      }
    },
    {
      "kind": "radius",
      "code": "LS1",
      "label": "Within 20 miles of Leeds city centre (LS1)",
      "contacts": 41960,
      "centre": {
        "lat": 53.7974,
        "lon": -1.5438
      },
      "filter": {
        "field": "site.location",
        "op": "within_radius",
        "centre": {
          "postcode": "LS1"
        },
        "radius_miles": 20
      }
    }
  ],
  "disclosure": {
    "level": "rounded",
    "rounded_to": 5,
    "secondary_suppression": false,
    "notes": [
      "Counts under 100 and every breakdown cell are rounded to the nearest 5 for anonymous and trial callers."
    ]
  }
}

Errors

Every error is a problem object with a code and a next_step. Every response carries the RateLimit and RateLimit-Policy headers; see Rate limits.

StatusProblem codesWhen
400invalid-request, idempotency-key-required, unsupported-versionThe request could not be read, or an Idempotency-Key is missing.
401authentication-required, account-requiredSign in (OAuth) or send an API key (authentication-required), or create a free account for what the anonymous tier does not cover (account-required).
422validation-failed, quote-required, dataset-unavailableThe request is not valid. errors lists every problem with a JSON pointer and did_you_mean.
429rate-limitedToo many requests. Wait for Retry-After.
Any other failureinternal-error, service-unavailable, tps-screen-expiredSomething failed on our side (500 internal-error) or the service is briefly unavailable (503 service-unavailable, with Retry-After). Nothing was charged; retry with the same Idempotency-Key. A count, sample, quote or order with telephone in play is also refused with 503 tps-screen-expired, with no Retry-After, while the dataset version's TPS and CTPS screen is more than 28 days old.