oneapi
Sign in
Utile v1 / Adrese

Check an address

Checks a structured address against its country's rules: which fields are required there, what shape the postcode takes, whether the subdivision exists. It does not check that the address exists on the ground.

POST
https://oneapi.ro/api/utile/v1/adrese/valideaza

Request body

Sent as JSON in the request body (Content-Type: application/json) — not in the query string.

NameTypeDescriptionAccepted values
tararequired string REQUIRED. The ISO alpha-2 code. max 2 car.
numeoptional string | null Recipient name. max 160 car.
organizatieoptional string | null Organisation. max 160 car.
stradaoptional string | null Street and number. max 300 car.
subzonaoptional string | null Sub-locality (district, sector). max 120 car.
localitateoptional string | null Locality. max 120 car.
regiuneoptional string | null County, state or province. max 120 car.
cod_postaloptional string | null Postal code. max 32 car.
cod_sortareoptional string | null Sorting code (CEDEX in France). max 32 car.
A correct Romanian address Request body
{
    "tara": "RO",
    "nume": "Ion Popescu",
    "strada": "Str. Memorandumului 28",
    "localitate": "Cluj-Napoca",
    "cod_postal": "400114"
}
Wrong postal code Request body
{
    "tara": "RO",
    "strada": "x",
    "localitate": "Cluj-Napoca",
    "cod_postal": "4001"
}
A German address Request body
{
    "tara": "DE",
    "strada": "Unter den Linden 1",
    "localitate": "Berlin",
    "cod_postal": "10117"
}

Query parameters

This route accepts no query parameters.

How it behaves

  • POST, with the address in the body (JSON): tara (required, ISO alpha-2), nume, organizatie, strada, subzona (district, sector), localitate, regiune (county, state, province), cod_postal, cod_sortare (CEDEX in France). The recipient name and the address are personal data: in a URL they would end up in access logs, in caches and in the referrer of any page calling the route — so a GET gets 405 metoda_nepotrivita. Nothing is retained.
  • This checks FORM, not existence. It confirms that the fields the country requires are filled, that the postal-code pattern matches, and that the region is a recognised one. It does NOT confirm the address exists on the ground — that would need each country's postal register.
  • The postal-code pattern is anchored before comparison. The source gives it without anchors, and used as-is, 12 would pass for Romania because it would match inside a longer string.
  • The region is compared without diacritics: "Timis" finds "Timiș". It only checks that it is a REAL subdivision of the country, not that it matches the locality — that would need a locality→county mapping, which the source does not have.
  • For Romania, if you need checking against real data — that the street exists in that locality, with that postal code — use /locations/v1/validare/adresa, which rests on the official nomenclature.
  • adresa_formatata is returned even when the address is invalid, so you can see how it would look. Missing fields leave empty lines, which are dropped, and orphaned separators (stray commas) are cleaned up.

What it is for

  • Check at checkout whether the address entered is complete for the chosen country, before accepting the order.
  • Clean an address import, flagging rows whose postal code does not match the country pattern.
  • Compose the formatted address for a label, in the country's correct order.

Response structure

All fields below live inside data.

FieldTypeDescription
tara string The country the value refers to.
valida boolean true only if no formal problem was found.
probleme array The problems found, each naming the offending field.
adresa_formatata array The address laid out on lines, in the country's order, with the upper-casing the post office expects.
observatie string A note on how to read the response: a computation convention or a limit of the data.
sursa.nume string Name of the official source.
sursa.licenta string The licence under which the source allows reuse.
probleme[].camp string The key of the field with the problem.
probleme[].problema string What exactly is wrong.
probleme[].tipar string For the postal code: the expression it was compared against.
probleme[].exemple array For the postal code: real codes, so the expected shape is visible.
probleme[].sugestii For the region: a few valid subdivisions of the country.

Response examples

body: {"tara": "RO", "nume": "Ion Popescu", "strada": "Str. Memorandumului 28", "localitate": "Cluj-Napoca", "cod_postal": "400114"}

POSThttps://oneapi.ro/api/utile/v1/adrese/valideaza
{
    "data": {
        "tara": "RO",
        "valida": true,
        "probleme": [],
        "adresa_formatata": [
            "Ion Popescu",
            "STR. MEMORANDUMULUI 28",
            "400114 CLUJ-NAPOCA"
        ],
        "observatie": "Verificarea e de FORMĂ: câmpuri cerute, tiparul codului poștal, subdiviziune recunoscută. NU confirmă că adresa există la fața locului.",
        "sursa": {
            "nume": "Google libaddressinput — metadatele de adresare folosite de Chrome",
            "licenta": "Apache-2.0."
        }
    }
}

Error codes

CodeSlugWhen it occurs
401neautentificatToken missing, invalid, expired or revoked.
403feature_indisponibilThe current plan does not include the feature the route depends on.
404negasitWe hold no addressing rules for the given country.
405eroaremetoda_nepotrivita: the route only accepts POST, with the address in the body.
422validaretara is missing or a field exceeds its maximum length.
429cota_depasitaThe plan's monthly quota has been exceeded (see Retry-After).

All errors share the same shape. eroare.cod is stable and is the value you should branch on in code — not the text in mesaj, which may change.

{
    "eroare": {
        "cod": "validare",
        "mesaj": "tara is missing or a field exceeds its maximum length."
    }
}