Skip to main content

POST /api/metazip

Returns all available metadata for a postal code, including coordinates, county (US), timezone (US), and any additional data source fields.

Request

POST https://postaldatapi.com/api/metazip
Content-Type: application/json

Body Parameters

ParameterTypeRequiredDescription
zipcodestring or numberYesThe postal code to look up
apiKeystringYesYour API key
countrystringNoISO 3166-1 alpha-2 country code (default: "US")

Response

US Example (200)

{
"meta": {
"zipcode": "90210",
"city": "Beverly Hills",
"state": "California",
"stateAbbrev": "CA",
"county": "Los Angeles County",
"latitude": 34.1031,
"longitude": -118.4163,
"timezone": "America/Los_Angeles"
},
"performance": { "totalTime": "2ms" },
"balance": 4.99
}

Non-US Example (200)

{
"meta": {
"postalCode": "10115",
"country": "DE",
"placeName": "Berlin",
"latitude": 52.532,
"longitude": 13.3879,
"adminLevel1": "Berlin",
"adminLevel1Code": "BE"
},
"performance": { "totalTime": "1ms" },
"balance": 4.99
}

Response Fields

The meta object contains all available fields for the postal code. Available fields vary by country:

All countries:

FieldTypeDescription
postalCode or zipcodestringThe postal code
placeName or citystringCity or place name
latitudenumberLatitude coordinate
longitudenumberLongitude coordinate

US-specific fields:

FieldTypeDescription
statestringFull state name
stateAbbrevstringTwo-letter state abbreviation
countystringCounty name
timezonestringIANA timezone identifier

Non-US fields:

FieldTypeDescription
countrystringISO 3166-1 alpha-2 country code
adminLevel1stringTop-level administrative region (state, province, etc.)
adminLevel1CodestringAbbreviated code for the administrative region
adminLevel2stringSecond-level administrative region (if available)
tip

The metazip endpoint returns every field available in the data source. As PostalDataPI adds more data sources, additional fields may appear without a breaking API change.

Examples

# US ZIP with rich metadata
curl -X POST https://postaldatapi.com/api/metazip \
-H "Content-Type: application/json" \
-d '{"zipcode": "90210", "apiKey": "YOUR_API_KEY"}'

# Japanese postal code
curl -X POST https://postaldatapi.com/api/metazip \
-H "Content-Type: application/json" \
-d '{"zipcode": "1000001", "country": "JP", "apiKey": "YOUR_API_KEY"}'

Errors

StatusErrorCause
400Missing required field: zipcodeNo zipcode in request body
401Invalid API keyAPI key does not exist or was revoked
402Insufficient balanceAccount balance is zero
404ZIP code not foundPostal code does not exist in the specified country
429Rate limit exceededToo many requests

SDK Examples

from postaldatapi import PostalDataPI

client = PostalDataPI(api_key="YOUR_API_KEY")

result = client.metazip("90210")
print(result.city) # Beverly Hills
print(result.latitude) # 34.1031
print(result.longitude) # -118.4163
print(result.meta["county"]) # Los Angeles County
print(result.meta["timezone"]) # America/Los_Angeles