Address validation rules
GET/v1/geo/address-rules
scope catalog.read
What we enforce when an address is saved, published so you can validate before sending and show your own users a useful message instead of a rejected order.
Query parameters#
| Name | Example | |
|---|---|---|
country | RO | ISO country code — required |
Response#
| Field | Type | Description |
|---|---|---|
country_code | string | The country these rules apply to. |
street | object | What a street line must look like. |
street. | integer | Shortest accepted street line. |
street. | integer | Longest accepted street line. |
street. | boolean | Whether a house or building number is required. true rejects "Main Street" with no number — a parcel cannot be delivered to a street. |
postal_code | object | What a postal code must look like. |
postal_code. | string | A regular expression the code must match. Apply it in your own system BEFORE sending, so a bad address fails while a human is still looking at it rather than when the courier is booked. |
postal_code. | string | A well-formed code, for your placeholder text. |
postal_code. | boolean | Whether the code must also start with the prefix belonging to its county — see postal_prefixes on GET /v1/geo/counties. This is what catches a correct-looking code from the wrong part of the country. |
required_fields | string[] | Which address fields must be present for this country. Countries differ: not every one has counties, and asking for one where it does not apply produces addresses a courier will reject. |
Example
{
"country_code": "RO",
"street": {
"min_length": 5,
"max_length": 50,
"must_contain_digit": true
},
"postal_code": {
"pattern": "/^\\\\d{6}$/",
"example": "500123",
"validated_by_county_prefix": true
},
"required_fields": [
"country_code",
"county_id",
"city_id",
"address",
"postal_code"
]
}