Zippopotam.us
App · Travel & Places · 9 actions
Look up postal codes and zip codes from a workflow, in the 70 countries Zippopotam.us covers. Turn a postal code into the places it covers, with the state and coordinates, or a city into every code it holds, or search a state for the cities whose names contain some text. Check whether a code someone typed into a form is real, and whether it matches the city and state they typed with it, both answering yes or no rather than failing the step. Get one point for a code as numbers a mapping or weather step can use, measure how far apart two codes are in kilometers and miles, list the codes around one, or rank a list of codes to find the branch, depot or territory nearest an address. Every action reads: nothing here changes anything, at this service or anywhere else. No account or API key required.
Actions
| Action | What it does |
|---|---|
| Check a postal code | Check whether a postal code really exists in a country, and get back a yes or a no rather than a failed step. |
| Check a postal code matches a place | Check that a postal code and the city or state someone typed alongside it actually go together, which is the question an address form has to answer once it knows the code is real. |
| Find nearby postal codes | List the postal codes around one, nearest first, each with the places it covers, its state, and how far away it is in kilometers and in miles. |
| Find postal codes for a city | Find every postal code a city holds, which is the lookup the other way round: give a country, a state and a city and get the codes back. |
| Find the nearest postal code | Given one postal code and a list of others, find which of them is closest, with all of them ranked by distance. |
| Get coordinates for a postal code | Get one latitude and longitude for a postal code, as numbers a mapping, weather or routing step can use directly. |
| List supported countries | List the 70 countries the service covers, with each one's two-letter code, the other names it answers to, an example postal code, the range it holds, how many codes that is, and the form it stores them in. |
| Look up a postal code | Look up a postal code and get every place it covers: the place name, the state and its abbreviation, and the coordinates, as numbers rather than as the strings the service sends. |
| Measure the distance between two postal codes | Measure how far apart two postal codes are, in kilometers and in miles, so a workflow can decide whether an address is inside a delivery radius, which depot serves it, or what to charge for shipping. |
Check a postal code
Check whether a postal code really exists in a country, and get back a yes or a no rather than a failed step. This is the action for validating what a person typed into a form: a code that does not exist is an answer, not an error, and so is a country the service does not cover, so a workflow can branch on the result and tell the person what to fix. It reports the form that country stores its codes in, so the message can say what a valid one looks like. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- Postal code
postal_codetextRequired - The postal code to look up. Written the way people write it: a code read out of a spreadsheet as the number 2108 is padded back to 02108, a ZIP+4 keeps its first five digits, a full British postcode is trimmed to its outward half, a Canadian one to its first three characters, and the punctuation Poland, Japan, Brazil, Portugal, the Czech Republic and Slovakia store is put back. The answer always says what was actually looked up.
Outputs
asked_forobject- What the step was given, exactly as it arrived, before anything was put into the form the service stores.
countrytext- The country's name, as the service's table spells it. Empty when it is not covered.
country_codetext- The country's two-letter code. Empty when it is not covered.
country_supportedtrue/false- Whether the service covers the country given at all.
existstrue/false- Whether the postal code exists in that country: the answer to branch on.
normalizedtrue/false- Whether the code given had to be rewritten into that form first.
place_countnumber- How many places the code covers. 0 when it does not exist.
place_nameslist- The name of every place the code covers.
placeslist- Every place the code covers. Empty when it does not exist.
postal_codetext- The postal code checked, in the form the service stores it.
postal_code_formattext- How a code is written in that country, such as '5 digits, such as 00210', for telling a person what a valid one looks like.
reasontext- Why the code does not exist, or why the country is not covered, in words a person can act on. Empty when it exists.
summarytext- The places on one line.
urltext- The service's answer for this code, which the step read.
Example output
{
"asked_for": {
"country": "US",
"postal_code": "90210"
},
"country": "United States",
"country_code": "US",
"country_supported": true,
"exists": true,
"normalized": false,
"place_count": 1,
"place_names": [
"Beverly Hills"
],
"places": [
{
"country": "United States",
"country_code": "US",
"label": "Beverly Hills, CA 90210, United States",
"latitude": 34.0901,
"longitude": -118.4065,
"place_name": "Beverly Hills",
"post_code": "90210",
"state": "California",
"state_abbreviation": "CA"
}
],
"postal_code": "90210",
"postal_code_format": "5 digits, such as 00210",
"reason": "",
"summary": "Beverly Hills, CA 90210, United States",
"url": "https://api.zippopotam.us/us/90210"
}Check a postal code matches a place
Check that a postal code and the city or state someone typed alongside it actually go together, which is the question an address form has to answer once it knows the code is real. Give a place name, a state, or both. The state is matched against its name and its abbreviation, so 'California' and 'CA' are the same answer, and names are compared without regard to case, punctuation or accents. Answers rather than failing, and says what disagreed. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- Postal code
postal_codetextRequired - The postal code to look up. Written the way people write it: a code read out of a spreadsheet as the number 2108 is padded back to 02108, a ZIP+4 keeps its first five digits, a full British postcode is trimmed to its outward half, a Canadian one to its first three characters, and the punctuation Poland, Japan, Brazil, Portugal, the Czech Republic and Slovakia store is put back. The answer always says what was actually looked up.
- Expected city or place
place_nametext - The city the postal code is supposed to be in. Leave empty to check only the state. A name that contains the other counts as agreement, so 'New York City' against 'New York' is a match rather than a mismatch.
- Expected state
statetext - The state, province or region the postal code is supposed to be in, by name or by abbreviation. Leave empty to check only the city. Give at least one of the two.
Outputs
actual_placeslist- The places the code really covers.
actual_state_abbreviationslist- Those states' abbreviations.
actual_stateslist- The states the code is really in.
asked_forobject- What the step was given, exactly as it arrived.
countrytext- The country's name, as the service's table spells it. Empty when it is not covered.
country_codetext- The country's two-letter code. Empty when it is not covered.
country_supportedtrue/false- Whether the service covers the country given at all.
existstrue/false- Whether the postal code exists in that country.
matchestrue/false- Whether the code and the place or state given go together: the answer to branch on.
place_matchestrue/false- Whether the place given is one the code covers. Empty when no place was given.
placeslist- Every place the code covers.
postal_codetext- The postal code checked, in the form the service stores it.
reasontext- What disagreed, or why the code could not be checked. Empty when they match.
state_matchestrue/false- Whether the state given, by name or abbreviation, is the one the code is in. Empty when no state was given.
summarytext- The places the code covers, on one line.
urltext- The service's answer for this code, which the step read.
Example output
{
"actual_places": [
"Beverly Hills"
],
"actual_state_abbreviations": [
"CA"
],
"actual_states": [
"California"
],
"asked_for": {
"country": "US",
"place_name": "Beverly Hills",
"postal_code": "90210",
"state": "CA"
},
"country": "United States",
"country_code": "US",
"country_supported": true,
"exists": true,
"matches": true,
"place_matches": true,
"places": [
{
"country": "United States",
"country_code": "US",
"label": "Beverly Hills, CA 90210, United States",
"latitude": 34.0901,
"longitude": -118.4065,
"place_name": "Beverly Hills",
"post_code": "90210",
"state": "California",
"state_abbreviation": "CA"
}
],
"postal_code": "90210",
"reason": "",
"state_matches": true,
"summary": "Beverly Hills, CA 90210, United States",
"url": "https://api.zippopotam.us/us/90210"
}Find nearby postal codes
List the postal codes around one, nearest first, each with the places it covers, its state, and how far away it is in kilometers and in miles. Use it to widen a search to the neighboring area, offer the next codes over when one has no branch, or sketch a delivery zone around an address, with no list of codes to give; to rank codes you already have, use 'Find the nearest postal code'. The service answers with the ten places nearest the code, so up to ten codes come back, fewer where one code covers several of those places. It picks them by distance alone, so near a border some can be in the next country, which only their state shows. It has no nearby search for some codes it can look up, and the step then fails and says so. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- Postal code
postal_codetextRequired - The postal code to look up. Written the way people write it: a code read out of a spreadsheet as the number 2108 is padded back to 02108, a ZIP+4 keeps its first five digits, a full British postcode is trimmed to its outward half, a Canadian one to its first three characters, and the punctuation Poland, Japan, Brazil, Portugal, the Czech Republic and Slovakia store is put back. The answer always says what was actually looked up.
- Report the distance in
unittext - Which unit the headline distance and the ordering use. Both kilometers and miles come back either way, so this only picks which one a message reads and which one a condition compares.One of:
kilometers(Kilometres),miles. Default:kilometers.
Outputs
asked_forobject- What the step was given, exactly as it arrived, before anything was put into the form the service stores.
countnumber- How many nearby postal codes came back.
countrytext- The country's name, as the service's table spells it.
country_codetext- The country's two-letter code.
latitudenumber- The latitude the search was centered on, one of the code's places.
longitudenumber- The longitude the search was centered on, one of the code's places.
map_urltext- A link that opens that point on OpenStreetMap.
normalizedtrue/false- Whether the code given had to be rewritten into that form first.
postal_codetext- The postal code searched from, in the form the service stores it.
postal_codeslist- The nearby postal codes, nearest first, without the one searched from.
requests_madenumber- How many requests the step made.
resultslist- One row per nearby postal code, nearest first.
summarytext- The answer on one line: how many codes, and the nearest.
unittext- The unit distance is given in: kilometers or miles.
urltext- The service's nearby search for this code, which the step read.
Example output
{
"asked_for": {
"country": "US",
"postal_code": "90210"
},
"count": 3,
"country": "United States",
"country_code": "US",
"latitude": 34.0901,
"longitude": -118.4065,
"map_url": "https://www.openstreetmap.org/?mlat=34.0901&mlon=-118.4065#map=12/34.0901/-118.4065",
"normalized": false,
"postal_code": "90210",
"postal_codes": [
"90069",
"90212",
"90211"
],
"requests_made": 1,
"results": [
{
"distance": 2.552,
"kilometers": 2.552,
"miles": 1.585,
"place_names": [
"West Hollywood"
],
"postal_code": "90069",
"state": "California",
"state_abbreviation": "CA",
"summary": "West Hollywood, CA 90069"
},
{
"distance": 3.201,
"kilometers": 3.201,
"miles": 1.989,
"place_names": [
"Beverly Hills"
],
"postal_code": "90212",
"state": "California",
"state_abbreviation": "CA",
"summary": "Beverly Hills, CA 90212"
},
{
"distance": 3.515,
"kilometers": 3.515,
"miles": 2.184,
"place_names": [
"Beverly Hills"
],
"postal_code": "90211",
"state": "California",
"state_abbreviation": "CA",
"summary": "Beverly Hills, CA 90211"
}
],
"summary": "3 postal codes near 90210, the nearest 90069 at 2.6 km",
"unit": "kilometers",
"url": "https://api.zippopotam.us/nearby/us/90210"
}Find postal codes for a city
Find every postal code a city holds, which is the lookup the other way round: give a country, a state and a city and get the codes back. The service wants the state's abbreviation rather than its name, so a US state or a Canadian province written out in full is translated here and every other country is passed through as given. The city has to be named as the service names it, so 'New York' does not find New York City: the step fails and names the cities whose names contain what was typed. Match any name containing it instead to search a state, and get every city the text is part of, each with its codes. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- State
statetextRequired - The state, province or region the city is in. The service wants the abbreviation, so Massachusetts is 'MA'; a US state or a Canadian province written out in full is translated. Elsewhere, use whatever the postal code lookup reports as the state abbreviation for that country.
- City
citytextRequired - The city, as the service names it. Case, spacing, punctuation and accents typed with it do not matter, so 'winston-salem' finds Winston Salem and 'köln' finds Köln. A name written without its accents ('Koln'), an abbreviation ('NYC') or another name for the place ('St Louis' for Saint Louis) does not.
- Match
matchtext - Whether only a city with exactly this name counts, or every city in the state whose name contains it. A search by part of a name turns 'Spring' into Springfield, West Springfield and the rest, each with its own codes, and needs at least three letters.One of:
exact(Exactly this name),contains(Any name containing it). Default:exact.
Outputs
asked_forobject- What the step was given, exactly as it arrived.
citieslist- Every city found, once each.
citytext- The city's name, as the service spells it. Empty when a search by part of a name found more than one.
city_countnumber- How many cities were found: one for an exact name, any number for a search.
countrytext- The country's name, as the service's table spells it.
country_codetext- The country's two-letter code.
foundtrue/false- Always true: a city the service does not hold fails the step instead.
latitudenumber- The middle of every place found that carries coordinates.
longitudenumber- The middle of every place found that carries coordinates.
map_urltext- A link that opens the point on OpenStreetMap. Empty when no place carries coordinates.
place_countnumber- How many places came back, one for each code a city holds.
placeslist- Every place found, each with its code and coordinates.
places_with_coordinatesnumber- How many of the places carry coordinates, and so went into that point.
postal_code_countnumber- How many postal codes those cities hold.
postal_codeslist- Every postal code they hold, once each.
statetext- The state's name, as the service stores it.
state_abbreviationtext- The state's abbreviation, the form the service looks a city up by.
summarytext- The places on one line.
urltext- The service's answer for this city, which the step read.
Example output
{
"asked_for": {
"city": "Belmont",
"country": "US",
"match": "exact",
"state": "Massachusetts"
},
"cities": [
"Belmont"
],
"city": "Belmont",
"city_count": 1,
"country": "United States",
"country_code": "US",
"found": true,
"latitude": 42.4296,
"longitude": -71.3319,
"map_url": "https://www.openstreetmap.org/?mlat=42.4296&mlon=-71.3319#map=12/42.4296/-71.3319",
"place_count": 2,
"places": [
{
"country": "United States",
"country_code": "US",
"label": "Belmont, MA 02178, United States",
"latitude": 42.4464,
"longitude": -71.4594,
"place_name": "Belmont",
"post_code": "02178",
"state": "Massachusetts",
"state_abbreviation": "MA"
},
{
"country": "United States",
"country_code": "US",
"label": "Belmont, MA 02478, United States",
"latitude": 42.4128,
"longitude": -71.2044,
"place_name": "Belmont",
"post_code": "02478",
"state": "Massachusetts",
"state_abbreviation": "MA"
}
],
"places_with_coordinates": 2,
"postal_code_count": 2,
"postal_codes": [
"02178",
"02478"
],
"state": "Massachusetts",
"state_abbreviation": "MA",
"summary": "Belmont, MA 02178, United States; Belmont, MA 02478, United States",
"url": "https://api.zippopotam.us/us/ma/belmont"
}Find the nearest postal code
Given one postal code and a list of others, find which of them is closest, with all of them ranked by distance. This is the step that routes a lead to its nearest branch, picks the warehouse that should ship an order, or assigns a customer to a territory. A code in the list that does not exist is reported alongside the ranking rather than failing the step, so one bad row does not lose the answer. Each code is a request, so the list is capped at 25. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- Postal code
postal_codetextRequired - The postal code to look up. Written the way people write it: a code read out of a spreadsheet as the number 2108 is padded back to 02108, a ZIP+4 keeps its first five digits, a full British postcode is trimmed to its outward half, a Canadian one to its first three characters, and the punctuation Poland, Japan, Brazil, Portugal, the Czech Republic and Slovakia store is put back. The answer always says what was actually looked up.
- Postal codes to compare against
candidateslistRequired - The postal codes to rank by distance from the one above. A list from an earlier step, or several typed in separated by commas. At most 25, because each one is a separate request to a free service. Duplicates are dropped.
- Country of those codes
candidate_countrytext - Leave this empty unless the codes being compared really are in another country: they are then all read in the country above, which is what almost every search wants. Setting it changes how every one of them is read, so a two-letter value here is a country and never a state. 'CA' is Canada, where a code is stored as its first three characters, so US ZIP codes sent there become 904, 911, 921 and match nothing.
- Report the distance in
unittext - Which unit the headline distance and the ordering use. Both kilometers and miles come back either way, so this only picks which one a message reads and which one a condition compares.One of:
kilometers(Kilometres),miles. Default:kilometers. - How many to return
limitnumber - How many of the ranked codes to return, nearest first. Leave empty for all of them. Every code given is looked up either way, so this only trims the answer.From 1 to 25.
Outputs
candidate_countnumber- How many distinct codes were compared.
candidate_countrytext- The country the codes compared were read in.
candidate_country_codetext- That country's two-letter code.
candidates_looked_uplist- Every code compared, as given and as looked up, so a code the country rewrote can be seen.
countnumber- How many ranked codes came back, after the limit.
found_countnumber- How many of them were found and carry coordinates.
fromobject- The postal code ranked from: its places and the point every distance is measured from.
nearestobject- The closest of the codes compared, the first of the results.
not_foundlist- The codes the service does not hold, as given.
requests_madenumber- How many requests the step made, at most one per code.
resultslist- The codes compared, nearest first.
summarytext- The answer on one line.
truncatedtrue/false- Whether the limit left some ranked codes out.
unittext- The unit distance is given in: kilometers or miles.
without_coordinateslist- The codes it holds but has no coordinates for, which cannot be ranked.
Example output
{
"candidate_count": 2,
"candidate_country": "United States",
"candidate_country_code": "US",
"candidates_looked_up": [
{
"given": "90401",
"looked_up": "90401"
},
{
"given": "99999",
"looked_up": "99999"
}
],
"count": 1,
"found_count": 1,
"from": {
"country": "United States",
"country_code": "US",
"latitude": 34.0901,
"longitude": -118.4065,
"map_url": "https://www.openstreetmap.org/?mlat=34.0901&mlon=-118.4065#map=12/34.0901/-118.4065",
"place_count": 1,
"place_names": [
"Beverly Hills"
],
"places_with_coordinates": 1,
"postal_code": "90210",
"summary": "Beverly Hills, CA 90210, United States",
"url": "https://api.zippopotam.us/us/90210"
},
"nearest": {
"country_code": "US",
"distance": 11.397,
"kilometers": 11.397,
"latitude": 34.0154,
"longitude": -118.4912,
"map_url": "https://www.openstreetmap.org/?mlat=34.0154&mlon=-118.4912#map=12/34.0154/-118.4912",
"miles": 7.082,
"place_names": [
"Santa Monica"
],
"postal_code": "90401",
"summary": "Santa Monica, CA 90401, United States"
},
"not_found": [
"99999"
],
"requests_made": 3,
"results": [
{
"country_code": "US",
"distance": 11.397,
"kilometers": 11.397,
"latitude": 34.0154,
"longitude": -118.4912,
"map_url": "https://www.openstreetmap.org/?mlat=34.0154&mlon=-118.4912#map=12/34.0154/-118.4912",
"miles": 7.082,
"place_names": [
"Santa Monica"
],
"postal_code": "90401",
"summary": "Santa Monica, CA 90401, United States"
}
],
"summary": "90401 is the nearest of 2",
"truncated": false,
"unit": "kilometers",
"without_coordinates": []
}Get coordinates for a postal code
Get one latitude and longitude for a postal code, as numbers a mapping, weather or routing step can use directly. A postal code often covers several places, each with its own point, so this returns the middle of them and says how many it averaged, rather than presenting one place's coordinates as the code's own. Name a place to get that one place's point exactly instead. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- Postal code
postal_codetextRequired - The postal code to look up. Written the way people write it: a code read out of a spreadsheet as the number 2108 is padded back to 02108, a ZIP+4 keeps its first five digits, a full British postcode is trimmed to its outward half, a Canadian one to its first three characters, and the punctuation Poland, Japan, Brazil, Portugal, the Czech Republic and Slovakia store is put back. The answer always says what was actually looked up.
- Narrow to one place
place_nametext - Which of the places the code covers to take the point from. Leave empty to get the middle of all of them. Naming a place the code does not cover fails the step and says what it does cover.
Outputs
asked_forobject- What the step was given, exactly as it arrived.
countrytext- The country's name, as the service's table spells it.
country_codetext- The country's two-letter code.
exacttrue/false- Whether the point is one place's own rather than the middle of several.
latitudenumber- The latitude, as a number.
longitudenumber- The longitude, as a number.
map_urltext- A link that opens the point on OpenStreetMap.
place_countnumber- How many places the code covers in all.
place_nametext- The place the point belongs to, when it is one place's own. Empty when it is the middle of several.
placeslist- The places the point was taken from.
places_averagednumber- How many places the point is the middle of.
postal_codetext- The postal code looked up, in the form the service stores it.
summarytext- The places the point was taken from, on one line.
urltext- The service's answer for this code, which the step read.
Example output
{
"asked_for": {
"country": "US",
"place_name": "",
"postal_code": "90210"
},
"country": "United States",
"country_code": "US",
"exact": true,
"latitude": 34.0901,
"longitude": -118.4065,
"map_url": "https://www.openstreetmap.org/?mlat=34.0901&mlon=-118.4065#map=12/34.0901/-118.4065",
"place_count": 1,
"place_name": "Beverly Hills",
"places": [
{
"country": "United States",
"country_code": "US",
"label": "Beverly Hills, CA 90210, United States",
"latitude": 34.0901,
"longitude": -118.4065,
"place_name": "Beverly Hills",
"post_code": "90210",
"state": "California",
"state_abbreviation": "CA"
}
],
"places_averaged": 1,
"postal_code": "90210",
"summary": "Beverly Hills, CA 90210, United States",
"url": "https://api.zippopotam.us/us/90210"
}List supported countries
List the 70 countries the service covers, with each one's two-letter code, the other names it answers to, an example postal code, the range it holds, how many codes that is, and the form it stores them in. Use it to find out whether a country can be validated at all before a workflow tries, or to tell someone what a valid code looks like where they are. All 70 are shown, not a first few. This action makes no request: the list is the service's own published table. No API key required.
Inputs
- Narrow to
searchtext - Only countries whose code, name or other names match this text. Leave empty for all 70. Matched without regard to case, punctuation or accents.
- Sort by
sort_bytext - What order the countries come back in. By name by default, which is how the service's own table reads.One of:
name(Country name),code(Two-letter code),postal_code_count(Most postal codes first). Default:name.
Outputs
countnumber- How many countries are listed after narrowing.
countrieslist- Every country listed, with how a postal code looks there. Take a country's code for another step.
queryobject- What the list was narrowed and sorted by.
totalnumber- How many countries the service covers: 70.
total_postal_codesnumber- How many postal codes the service holds across every country.
urltext- The service's own page, with the table this list comes from.
Example output
{
"count": 70,
"countries": [
{
"also_known_as": [
"PRT"
],
"code": "PT",
"example": "1000-001",
"example_url": "https://api.zippopotam.us/pt/1000-001",
"name": "Portugal",
"postal_code_count": 204006,
"postal_code_format": "7 digits, a '-' after 4, such as 1000-001",
"range_from": "1000-001",
"range_to": "9980-999"
},
{
"also_known_as": [
"USA",
"United States of America",
"America",
"U.S.",
"U.S.A."
],
"code": "US",
"example": "00210",
"example_url": "https://api.zippopotam.us/us/00210",
"name": "United States",
"postal_code_count": 43624,
"postal_code_format": "5 digits, such as 00210",
"range_from": "00210",
"range_to": "99950"
}
],
"query": {
"search": "",
"sort_by": "postal_code_count"
},
"total": 70,
"total_postal_codes": 895395,
"url": "https://www.zippopotam.us/"
}Look up a postal code
Look up a postal code and get every place it covers: the place name, the state and its abbreviation, and the coordinates, as numbers rather than as the strings the service sends. A code often covers more than one place, so all of them come back rather than a first one picked as the answer. Works for the 70 countries the service covers, and the code is put into the form that country stores before it is looked up, so a ZIP read out of a spreadsheet as 2108 still finds Boston. The step fails if there is no such code; use 'Check a postal code' to ask instead. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- Postal code
postal_codetextRequired - The postal code to look up. Written the way people write it: a code read out of a spreadsheet as the number 2108 is padded back to 02108, a ZIP+4 keeps its first five digits, a full British postcode is trimmed to its outward half, a Canadian one to its first three characters, and the punctuation Poland, Japan, Brazil, Portugal, the Czech Republic and Slovakia store is put back. The answer always says what was actually looked up.
Outputs
asked_forobject- What the step was given, exactly as it arrived, before anything was put into the form the service stores.
countrytext- The country's name, as the service's table spells it.
country_codetext- The country's two-letter code.
foundtrue/false- Always true: a code the service does not hold fails the step instead.
latitudenumber- One latitude for the code: the middle of its places that carry coordinates.
longitudenumber- One longitude for the code: the middle of its places that carry coordinates.
map_urltext- A link that opens the point on OpenStreetMap. Empty when no place carries coordinates.
normalizedtrue/false- Whether the code given had to be rewritten into that form first, such as 2108 into 02108.
place_countnumber- How many places the code covers.
place_nameslist- The name of every place the code covers.
placeslist- Every place the code covers, each with its state and coordinates.
places_with_coordinatesnumber- How many of the places carry coordinates, and so went into that point.
postal_codetext- The postal code looked up, in the form the service stores it.
state_abbreviationslist- Those states' abbreviations, once each.
stateslist- Every state, province or region those places are in, once each.
summarytext- The places on one line, the way an address is written.
urltext- The service's answer for this code, which the step read.
Example output
{
"asked_for": {
"country": "US",
"postal_code": "90210"
},
"country": "United States",
"country_code": "US",
"found": true,
"latitude": 34.0901,
"longitude": -118.4065,
"map_url": "https://www.openstreetmap.org/?mlat=34.0901&mlon=-118.4065#map=12/34.0901/-118.4065",
"normalized": false,
"place_count": 1,
"place_names": [
"Beverly Hills"
],
"places": [
{
"country": "United States",
"country_code": "US",
"label": "Beverly Hills, CA 90210, United States",
"latitude": 34.0901,
"longitude": -118.4065,
"place_name": "Beverly Hills",
"post_code": "90210",
"state": "California",
"state_abbreviation": "CA"
}
],
"places_with_coordinates": 1,
"postal_code": "90210",
"state_abbreviations": [
"CA"
],
"states": [
"California"
],
"summary": "Beverly Hills, CA 90210, United States",
"url": "https://api.zippopotam.us/us/90210"
}Measure the distance between two postal codes
Measure how far apart two postal codes are, in kilometers and in miles, so a workflow can decide whether an address is inside a delivery radius, which depot serves it, or what to charge for shipping. The two codes can be in different countries. Both distances always come back; the unit only picks the headline. The measurement is a great-circle distance between the two codes' points, so it is how far apart they are, not how far it is to drive. No API key required.
Inputs
- Country
countrytextRequired - Which country the postal code is in. A two-letter code or a name, matched without regard to case, spacing or accents, so 'US', 'us', 'USA' and 'United States' all work, as do 'Netherlands' and 'Holland', the name this service's own table uses. Run 'List supported countries' to see the 70 it covers.
- Starting postal code
from_postal_codetextRequired - The postal code to measure from, in the country above. Written however people write it; it is put into the form that country stores before it is looked up.
- Destination postal code
to_postal_codetextRequired - The postal code to measure to. In the same country unless a destination country is set below.
- Destination country
to_countrytext - Leave this empty unless the destination really is in another country: both codes are then read in the country above, which is what almost every measurement wants. Setting it changes how the destination code is read, not just where it is looked up, so a two-letter value here is a country and never a state. 'CA' is Canada.
- Report the distance in
unittext - Which unit the headline distance and the ordering use. Both kilometers and miles come back either way, so this only picks which one a message reads and which one a condition compares.One of:
kilometers(Kilometres),miles. Default:kilometers.
Outputs
distancenumber- How far apart the two codes are, in that unit.
fromobject- The postal code measured from: its places and the point measured from.
kilometersnumber- How far apart they are, in kilometers.
milesnumber- How far apart they are, in miles.
requests_madenumber- How many requests the step made, at most one per code.
same_countrytrue/false- Whether both codes are in the same country.
summarytext- The measurement on one line.
toobject- The postal code measured to: its places and the point measured to.
unittext- The unit distance is given in: kilometers or miles.
Example output
{
"distance": 11.397,
"from": {
"country": "United States",
"country_code": "US",
"latitude": 34.0901,
"longitude": -118.4065,
"map_url": "https://www.openstreetmap.org/?mlat=34.0901&mlon=-118.4065#map=12/34.0901/-118.4065",
"place_count": 1,
"place_names": [
"Beverly Hills"
],
"places_with_coordinates": 1,
"postal_code": "90210",
"summary": "Beverly Hills, CA 90210, United States",
"url": "https://api.zippopotam.us/us/90210"
},
"kilometers": 11.397,
"miles": 7.082,
"requests_made": 2,
"same_country": true,
"summary": "Beverly Hills, CA 90210, United States to Santa Monica, CA 90401, United States is 11.4 km",
"to": {
"country": "United States",
"country_code": "US",
"latitude": 34.0154,
"longitude": -118.4912,
"map_url": "https://www.openstreetmap.org/?mlat=34.0154&mlon=-118.4912#map=12/34.0154/-118.4912",
"place_count": 1,
"place_names": [
"Santa Monica"
],
"places_with_coordinates": 1,
"postal_code": "90401",
"summary": "Santa Monica, CA 90401, United States",
"url": "https://api.zippopotam.us/us/90401"
},
"unit": "kilometers"
}