Format address info for country

POST /countries/{countryCode}/format-address

Takes structured address data and returns a string perfect for printing on envelopes, shipping labels and more.

Path parameters

  • countryCode string Required

    ISO-3166 Alpha2 or Alpha3 code for country

Query parameters

  • strict boolean

    If true, will throw an exception if missing one or more required address fields. For example if 'street' is missing in US, it will throw an error. Default: false

  • If true, it will append country name to the end of the string on a new line. Default: false

application/json

Body Required

We recommend sending all the properties, but leave those empty that does not apply.

Responses

  • 200 application/json

    Formatted result

    Hide response attributes Show response attributes object
  • Country not found

  • 422 application/json

    Some data sent was invalid

  • API key is missing or invalid

  • [FREE PLANS ONLY] Request Quota Exceeded

POST /countries/{countryCode}/format-address
curl \
 -X POST https://api.tellusdb.com/v1/countries/US/format-address?token=api_token_value \
 -H "Content-Type: application/json" \
 -d '{"street":"Test Street 123","city":"London","district":"District name","name":"John Doe","company_name":"Apple Inc.","state":"California","sorting_code":"123","zip":"90210"}'
Request example
{
  "street": "Test Street 123",
  "city": "London",
  "district": "District name",
  "name": "John Doe",
  "company_name": "Apple Inc.",
  "state": "California",
  "sorting_code": "123",
  "zip": "90210"
}
Request examples
{
  "street": "Test Street 123",
  "city": "London",
  "district": "District name",
  "name": "John Doe",
  "company_name": "Apple Inc.",
  "state": "California",
  "sorting_code": "123",
  "zip": "90210"
}
Response examples (200)
{
  "result": "John Doe\nApple Inc.\nTest Street 123\nLondon, California 90210",
  "time_taken_ms": 1.3892211
}
Response examples (422)
{
  "message": "Field missing: street. You are using strict mode, so the country requires filling out the following fields: street, city, zip. Documentation: https://tellusdb.com/docs"
}