Verify
Validate a structured or free-form address and get a verdict, corrections and confidence score.
POST
/v1/addresses/verifyParameters
| Name | Type | Required | Description |
|---|---|---|---|
address | object | no | A structured address: street, house_number, locality, county or county_code, postal_code. Send address or freeform, not both. A postal_code you send is checked against the street and house number, not taken as given. |
freeform | string | no | A single free-form address string, e.g. "Str. Mihai Vitezu 12, cluj". |
options.osm | boolean | no | true/false: allow or skip matching against OpenStreetMap for this request only. Omitted = your organisation setting. |
Example request
curl -X POST https://api.posty.ro/v1/addresses/verify \
-H "Authorization: Bearer psk_live_xxx" \
-H "Content-Type: application/json" \
-d '{ "freeform": "Str. Mihai Vitezu 12, cluj" }'Example response
{
"verdict": "partial",
"confidence": 0.54,
"input": {
"locality": "cluj",
"street": "Mihai Vitezu",
"house_number": "12"
},
"normalized": {
"postal_code": "400151",
"locality": "Cluj-Napoca",
"county_code": "CJ",
"street": "Piață Mihai Viteazu",
"house_number": "12"
},
"corrections": [
{
"field": "locality",
"from": "cluj",
"to": "Cluj-Napoca",
"reason": "typo"
},
{
"field": "street",
"from": "Mihai Vitezu",
"to": "Piață Mihai Viteazu",
"reason": "typo"
}
],
"unmatched": [],
"source": "gov",
"metadata": {
"source_versions": {
"baseline": "infocod-2016-05"
}
}
}Response fields
| Name | Description |
|---|---|
verdict | verified: every field you sent matched (fields you left out, such as postal_code, are filled in normalized and do not lower the verdict). corrected: at least one field you sent was changed, see corrections. partial: part of the address could not be confirmed, see unmatched. unverifiable: the locality could not be found. |
confidence | 0 to 1, rounded to 3 decimals. A corrected field earns at most half its weight, so a wrong postal code scores lower than the right one. |
normalized | The address in its official form, with postal_code, county and county_code filled in when the locality is found. |
corrections | The fields you sent that were changed: field, from, to, reason. |
unmatched | The fields you sent that could not be matched (locality, street, house_number, postal_code), so you know what to ask the user for. Empty when everything matched. |
source | gov or osm: the data the address was matched against. |
The postal code is checked
Posty finds the address from county, locality, street and house number, then compares the code you sent with the one that covers the address. A code for another street, another locality or no locality at all is corrected. When county, locality and street agree with each other, a postal code from elsewhere does not move the address.
{
"address": {
"street": "str. Memorandumului", "house_number": "28",
"locality": "Cluj-Napoca", "county_code": "CJ", "postal_code": "400001"
}
}{
"verdict": "corrected",
"confidence": 0.8,
"normalized": {
"postal_code": "400114",
"locality": "Cluj-Napoca",
"county": "Cluj",
"county_code": "CJ",
"street": "str. Memorandumului",
"house_number": "28"
},
"corrections": [
{
"field": "postal_code",
"from": "400001",
"to": "400114",
"reason": "locality_mismatch"
}
],
"unmatched": [],
"source": "gov"
}Data sources: official and OpenStreetMap: Every autocomplete suggestion, verify response, batch result row and postal code lookup carries source: "gov" or "osm". Filter on it, or treat OpenStreetMap results differently, if your process accepts only official data.