Data & APIs

Danish Address Validation API: Addresses and Phone Numbers

2026-10-01 · 8 min read

Almost every Danish web form asks for an address or a phone number at some point — checkout, a booking page, a lead-capture form, a tenant application. And almost every one of them gets it wrong in the same small ways: a free-text address field that accepts "Nørrebro" with no postal code, a phone field that happily takes "12 34" and calls it valid, a city name that does not match the postal code the customer typed next to it. None of these mistakes are dramatic on their own, but they turn into failed deliveries, bounced SMS confirmations, and support tickets that a few lines of validation would have prevented.

For addresses, the fix is to stop trusting free text and start validating against a real dataset instead. Danadresse.dk is a DAWA-compatible API covering roughly 2.7 million official Danish addresses, which means a form can offer autocomplete as the customer types and only accept an address that actually exists, with the correct postal code and municipality attached automatically. Because it follows the same structure Danish developers already know from DAWA, swapping it in is usually a matter of pointing an existing integration at a new endpoint rather than rewriting the address-handling logic from scratch. The payoff is immediate: no more guessing whether "Århus" and "Aarhus" are the same place, and no more delivery addresses that look plausible but do not exist.

Phone numbers deserve the same scepticism, for a different reason. A Danish mobile or landline number has a predictable shape, but "looks like a number" and "is a working, legitimate number" are not the same check. A signup form, a classifieds site, or a rental listing that accepts any eight digits is an open door for fake accounts and throwaway numbers. Nummeropslag.dk exposes a lookup for Danish numbers — including whether a number has been reported as spam — which is useful not only for the classic "who just called me" case but also as a lightweight sanity check in a signup or listing flow before a lead gets passed on to a sales team that will otherwise waste time on it.

The two combine well in practice. A lead-generation form that validates the address against Danadresse and checks the phone number before accepting the submission hands the sales or support team leads that are far more likely to be real, which matters more than it sounds once someone has to work through a list of them by hand. A CRM import job can run the same two checks in batch to clean up years of accumulated typos and dead numbers before anyone has to look at the data manually. And on the call-handling side, once a lead's phone number is in the CRM with the right context attached, a tool like LynBro PBX can use that same record when the customer calls back, instead of starting the conversation from zero.

Address validation via API: a concrete example

DAWA closed on 1 October 2026 (see our migration guide), but the pattern is the same as before: the customer types, the form asks an address API, and only a chosen suggestion is accepted. With Danadresse the call looks like this. You get a free key at danadresse.dk and send it in the X-Api-Key header:

// Server-side: the key stays out of the browser
const res = await fetch(
  'https://api.danadresse.dk/autocomplete?type=adresse&q=' + encodeURIComponent(q),
  { headers: { 'X-Api-Key': process.env.DANADRESSE_API_KEY } }
);
const hits = await res.json();
// hits[0].tekst → 'Rådhuspladsen 1, 1550 København V'

Store the address id from the chosen suggestion with the order, and you have postal code, municipality and coordinates without parsing text later. For existing data that already sits as free text there is /datavask/adresser, which returns the best official match and a category: A is a safe match, B a likely one, and C needs a human to look at it.

Danish postal code API: get the city from the postcode

The smallest check with the biggest effect is postcode → city: the customer types four digits and the city fills itself in. It saves a field, removes spelling variants like “Kbh. Ø”, and flags a postcode that does not exist straight away. With Danadresse it is one call to /postnumre/{nr}:

// 2100 → 'København Ø'
const res = await fetch('https://api.danadresse.dk/postnumre/' + zip, {
  headers: { 'X-Api-Key': process.env.DANADRESSE_API_KEY }
});
if (res.ok) city.value = (await res.json()).navn;

A 404 means the postcode does not exist, so the field can be marked at once. If you would rather show suggestions while the customer types (“21” → 2100, 2150 …), /postnumre/autocomplete?q= returns a list of numbers and cities.

Address suggestions while the customer types

For the address field itself, use /autocomplete as in the example above: send what the customer has typed, show the first suggestions and accept only a chosen one. Route the call through your own server so the API key never reaches the browser, and wait 150–200 ms after the last keystroke before asking, so the field stays fast without a request per letter.

A Danish phone number can be format-checked locally before you call any lookup: eight digits, optionally prefixed with +45, and the first digit is not 0 or 1.

const digits = input.replace(/[\s\-().]/g, '');
const ok = /^(?:\+45|0045)?[2-9]\d{7}$/.test(digits);

The format check catches typos. Whether the number is in use or reported as spam takes a lookup such as Nummeropslag.dk.

None of this requires a large engineering effort — both APIs are built for exactly this kind of lightweight integration, and most teams can wire up address autocomplete or a phone check in an afternoon rather than a sprint. If a form, a checkout flow, or a data-import job in a Danish codebase could use either check and the time has not been there to build it, get in touch and we will help plug it in.

Frequently asked questions

Which address API can I use now that DAWA has closed?

The official route is Datafordeleren, which requires registration and new integrations. Danadresse.dk is DAWA-compatible, so an existing DAWA integration usually only needs a new base URL and an API key.

Is there a free Danish postcode API?

Yes. With a free key from Danadresse.dk you can look up a postcode and get the city name. Postcodes rarely change, so the answer is safe to cache.

How do I validate an address the customer has already typed?

Send the text to /datavask/adresser. You get the best official match and a category A, B or C, so only the uncertain addresses need a human look.

Should the API key sit in the page's JavaScript?

No. Call the API from your own server or a small proxy function, and let the browser talk only to that.

Related Articles

Ready to Cross the Bridge?

Let's build your lightning bridge to digital transformation. From first consultation to live deployment — we move fast.

Get Started Today