Filling in a company from its CUI with the ANAF public web service
· 5-minute read · Romanian compliance · by Direct Softworks
One POST with a fiscal code returns the name, the trade register number, the address and the VAT status as the state holds them. Two small details decide whether it works.

Somebody adds a client. The company name comes from an email signature, the address from an old PDF, the trade register number from wherever it was last written down. Three fields, typed by hand, every one of them already held by the state in a form you can ask for.
ANAF publishes a web service that takes a CUI and returns what the tax authority knows about the company. It needs no account and no certificate. Our own panel calls it from the client form, and what follows comes from that integration, including the stretch where it quietly did nothing at all.
What the service is
One endpoint, https://webservicesp.anaf.ro/api/PlatitorTvaRest/v9/tva, called with a POST. The body is a JSON array of objects, each with a numeric cui and a data in YYYY-MM-DD form.
const res = await fetch("https://webservicesp.anaf.ro/api/PlatitorTvaRest/v9/tva", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify([{ cui: Number(digitsOnly), data: "2026-11-28" }]),
signal: AbortSignal.timeout(8000),
});
The answer comes back in blocks. date_generale carries the name, the address, nrRegCom, the registration state, the CAEN code and more. inregistrare_scop_Tva carries scpTVA, true or false. There are blocks for VAT on collection, split VAT and the inactive status, and two address blocks: adresa_sediu_social for the registered office and adresa_domiciliu_fiscal for the fiscal domicile. A CUI the register does not know comes back in a notFound list rather than as an error.
The limits are in ANAF's own documentation: at most 100 CUIs per request, at most one request per second per client, and a warning that any attempt to overload the server will be sanctioned. Read the limits before you write the loop, not after the first block.
Two details that decide whether it works
The CUI is digits only. A leading RO is the VAT prefix, not part of the fiscal code, and in our experience sending it gets you an empty result rather than an error. Strip the prefix, strip spaces, keep digits, and send it as a number.
The date is a question, not a timestamp. ANAF documents data as the date for which the search is made. The answer describes the company on that day. Our form sends today's date, because it is filling a client in now. A check meant to defend a particular invoice should send that invoice's date, because the question that matters later is whether the partner was a VAT payer when you invoiced them, not whether they are one this morning.
The version that answered 404
When we first built the lookup into the panel, it pointed at the previous version of this service. ANAF had retired it, and the old path answered 404 for every company.
The lookup is fail-soft on purpose. If the register does not answer, the operator gets a plain sentence telling them to type the details in by hand, and the form still saves. ANAF being slow at eleven at night should never stop somebody sending an invoice. So every 404 turned into that polite sentence, the operator typed the details by hand, which is what they would have done anyway, and the autofill silently never worked until a QA pass before launch caught it.
The current version also changed shape. The path moved, and the single address string in date_generale is not always filled in. The full address sits in the two granular blocks instead, with every field prefixed by the block it came from (sdenumire_Strada in one, ddenumire_Strada in the other). Our code takes the flat string when it is there, then composes the registered office, then falls back to the fiscal domicile.
Fail-soft is right for the person at the keyboard and wrong for the log. The operator should see a sentence, not an HTTP code. The log should see the status of every failed call, and something should be counting them. A dead endpoint is a fact you can act on only if it reaches somebody, which is the same lesson as the rate feed that died and still returned 200.
What to do with the answer
Prefill, never gate. The register fills the name, the trade register number and the address; a person can still correct any of them. Our form also tells the operator whether ANAF lists the company as a VAT payer, which is the fact that decides how the identifier is printed.
Keep the state's answer visible. Our lookup returns ANAF's raw response next to the parsed fields, so when a prefill looks odd, the operator can see what the state actually said rather than guessing what the code did to it.
Check suppliers as well as clients. Under the Fiscal Code, art. 11 alin. (7), a business that buys from a taxpayer after that taxpayer has been entered in the register of inactive taxpayers loses the right to deduct the expense and the VAT on those purchases, with narrow exceptions. The inactive flag is in the same response. On the purchasing side, this lookup is not a convenience. Ask your accountant how often they want suppliers rechecked.
Batch politely. A nightly refresh of three thousand partners is thirty requests of a hundred, sent a second apart: half a minute.
The version number has changed before and will change again. Check ANAF's web services page before relying on the path in this article.
The wider point
The check digit and the register answer different questions. Validating the CUI at the keyboard catches typing mistakes, and four lines of arithmetic do it with no network at all. The register catches everything arithmetic cannot: a company that does not exist, one that is not VAT registered, one that has gone inactive.
Use both, in that order. And treat any fallback that hides a failure from the user as a promise to show that failure to somebody else, because a fallback with no counter next to it will hide a broken integration for exactly as long as nobody happens to look.