Get started with the Digipost API
Integrating with Digipost is quick. The fastest way to get started is to let an AI assistant build the integration with you, using the resources below. You can also integrate by hand with our Java or .NET client libraries.
Build with an AI assistant
Point your AI assistant at Digipost’s own resources and it builds from our descriptions of each flow: no guessing, no hallucinated endpoints. Install the skill set into any skills-compatible agent (Claude Code, Codex CLI, Gemini CLI, Cursor, GitHub Copilot):
npx skills add digipost/digipost-skills
Then just ask. “Set up a Digipost integration that sends a PDF to a recipient by fødselsnummer.” No further setup. Your assistant picks the right skill and follows our own description of the flow, so you go from first question to a working request in minutes.
Three resources back your assistant at every stage:
- Understand: point your assistant at llms.txt, a compact summary of our docs, and its answers stay grounded in our APIs instead of drifting into guesswork.
- Build: Digipost skills are ready-made recipes for common integration flows, so your assistant follows a proven path rather than inventing one. They follow the open Agent Skills standard.
- Validate: our MCP server (
mcp.test.digipost.no) gives your assistant tools to validate requests and look up data types and API schemas against Digipost directly, so it can catch mistakes before you send.
You still need a sender account, which is step 1 below. From there an assistant can take you through the rest, or follow the three steps yourself.
1. Get registered as a Digipost sender
All organisations that wish to send digital mail must have a Digipost organisation (sender) account. To get a test account, send an email to support@digipost.no with the following information:
- Organisation name
- Organisation number
- Telephone number
- Email address
- The Digipost addresses of the people who should have access
2. Choose between the Java or .NET Digipost client libraries
Use the Digipost client library in either Java or .NET to send requests to the Digipost API. You can also integrate directly with the API, but we recommend using a client library.
Java client library .NET client library
3. Call Digipost client library code from your code
All it takes is a few lines of code to send digital mail. The following code shows a bare bones example of how to do this. There are many other options and possibilities in the client libraries and Digipost API, but the below is quick introduction to how sending a letter to a Digipost recipient works.
Java
// 1. Les inn sertifikatet du har knyttet til din Digipost-konto (i .p12-formatet)
Signer signer;
try (InputStream sertifikatInputStream = Files.newInputStream(Paths.get("certificate.p12"))) {
signer = Signer.usingKeyFromPKCS12KeyStore(sertifikatInputStream, "TheSecretPassword");
}
// 2. Opprett en DigipostClient
SenderId senderId = SenderId.of(123456); // Din konto-ID
DigipostClient client = new DigipostClient(
DigipostClientConfig.newConfiguration().build(), senderId.asBrokerId(), signer
);
// 3. Opprett et fødselsnummerobjekt
PersonalIdentificationNumber pin = new PersonalIdentificationNumber("26079833787");
// 4. Opprett hoveddokumentet
UUID documentUuid = UUID.randomUUID();
Document primaryDocument = new Document(documentUuid, "Dokumentets emne", PDF);
// 5. Opprett en forsendelse
Message message = newMessage("din-forsendelses-id", primaryDocument)
.personalIdentificationNumber(pin)
.build();
// 6. Legg til innhold og send
client.createMessage(message)
.addContent(primaryDocument, Files.newInputStream(Paths.get("content.pdf")))
.send();
.NET
// 1. Initialiser konfig med din Digipost avsender id
// Avsender id finner du på digipost.no/bedrift
var config = new ClientConfig(senderId: "xxxxx", environment: Environment.Production);
// 2. Initialiser klient med thumbprint til sertifikat som er knyttet til din Digipost virksomhetskonto
// Virksomhetssertifikat knyttes til din Digipost konto på digipost.no/bedrift.
// Informasjon om bruk av thumbprints finnes på http://digipost.github.io/digipost-api-client-dotnet/#installcert.
var client = new DigipostClient(config, thumbprint: "84e492a972b7e...");
// 3. Lag melding med bruk av fødselsnummer som personidentifikator
var message = new Message(
new RecipientById(IdentificationType.PersonalIdentificationNumber, "00000000000"),
new Document(subject: "Dokumentets emne", fileType: "pdf", path: @"c:\...\dokument.pdf")
);
// 4. Send melding
var result = client.SendMessage(message);
Next steps
Now that you have completed a test integration, the next step is to implement the full integration in your application or system. Read our guide to integration (in Norwegian) to see which steps are typically involved in implementing a production-ready integration with Digipost.
For additional questions you may have, see our FAQ. You can also contact Digipost regarding integration questions.
If your organisation is considered public sector and you are looking for information about Digdir’s digital mail program, see Digdir’s web pages on this topic.