Postal search
Find postal codes from a locality, street and house number.
POST
/v1/postal-codes/searchThe inverse of the postal code lookup: start from address fields and get the matching postal codes. No match is a 200 with an empty list. Requires the postal_lookup scope. See Postal lookup for the opposite direction.
Parameters (JSON body)
| Name | Type | Required | Description |
|---|---|---|---|
locality | string | yes | The locality. Up to 256 characters. |
county_code | string | no | County code (e.g. MS), to tell apart localities that share a name. Up to 256 characters. |
street | string | no | The street. Up to 256 characters. |
house_number | string | no | House number as written on the building; alphanumerics allowed (e.g. 12A, 255-T). Requires street, otherwise 400 house_number_requires_street. |
limit | integer | no | Maximum number of results (1-500). Defaults to 100. |
Example request
curl -X POST https://api.posty.ro/v1/postal-codes/search \
-H "Authorization: Bearer psk_live_xxx" \
-H "Content-Type: application/json" \
-d '{ "locality": "Târgu Mureș", "county_code": "MS", "street": "bd. 1 Decembrie 1918", "limit": 50 }'Example response
{
"postal_codes": [
{
"street": "bd. 1 Decembrie 1918",
"locality": "Târgu Mureș",
"county": "Mureș",
"county_code": "MS",
"postal_code": "540510",
"house_number": "nr. 255-T"
}
]
}Common errors
400 invalid_body: Unknown field or wrong type (the body is strict).400 missing_locality: locality is missing.400 house_number_requires_street: house_number sent without street.400 field_too_long: A field is longer than 256 characters.403 insufficient_scope: The key lacks the postal_lookup scope.