Skip to main content

Server SDK

Didit Java SDK for identity verification

Create sessions, read decisions and verify webhooks from your Java or Kotlin server. One dependency from Maven Central.

implementation("me.didit:didit-java:1.18.0")

Install

Install and set your key

Add the dependency, then set one environment variable.

Environment variables

DIDIT_API_KEYNeeded for every call.
DIDIT_ORGANIZATION_IDNeeded for calls scoped to an organization, such as cases, networks and regulatory reports.
DIDIT_APPLICATION_IDNeeded for the same calls, to pick the application.

new Didit() reads DIDIT_API_KEY on its own. Use the builder only to override it. Keep the key on your server.

// Gradleimplementation("me.didit:didit-java:1.18.0")<!-- Maven --><dependency>  <groupId>me.didit</groupId>  <artifactId>didit-java</artifactId>  <version>1.18.0</version></dependency>

Create a session

Create a session

A session is one run of your checks for one person. One call returns the URL to send your user to.

What you send

workflow_idThe workflow to run. A workflow is the set of checks a session runs.
vendor_dataYour own user ID. Didit returns it with every result.
callbackThe page Didit sends the user to after the flow.

What you get back

session.url()https://verify.didit.me/session/3FaJ9wLqX2MzSend your user here

Open the URL on the web. The response also carries a session token for the native SDKs.

import me.didit.Didit;import me.didit.types.SessionsCreateParams;Didit client = new Didit();var session = client.sessions().create(SessionsCreateParams.builder()        .workflowId("11111111-2222-3333-4444-555555555555")        .vendorData("user-123")        .callback("https://example.com/verification/done")        .build());System.out.println(session.url());

Webhook

Verify the webhook

A webhook is a message Didit sends to your server when a result is ready. One call checks that it is real.

InputThe raw body, exactly as received, and the request headers.
On failureWebhooks.verify throws WebhookVerificationException for anything that is not a valid, fresh delivery.
On successA typed event, such as SessionStatusUpdatedEvent.
Spring BootTake the body as @RequestBody byte[] body and the headers as @RequestHeader Map<String, String> headers.
Secret rotationTo accept two secrets while you rotate one, pass VerifyOptions.
Verify
import java.util.Map;import me.didit.errors.WebhookVerificationException;import me.didit.webhooks.SessionStatusUpdatedEvent;import me.didit.webhooks.WebhookEvent;import me.didit.webhooks.Webhooks;public class DiditWebhookHandler {    private final String secret = System.getenv("DIDIT_WEBHOOK_SECRET");    public int handle(byte[] rawBody, Map<String, String> headers) {        WebhookEvent event;        try {            event = Webhooks.verify(rawBody, headers, secret);        } catch (WebhookVerificationException e) {            System.out.println("rejected: " + e.reason());            return 400;        }        if (event instanceof SessionStatusUpdatedEvent) {            SessionStatusUpdatedEvent updated =                (SessionStatusUpdatedEvent) event;            System.out.println(updated.sessionId().orElse("")                + " " + updated.status().orElse(""));        }        return 200;    }}

Requirements

What you need

Six facts about the SDK.

Java 11 and laterThe artifact is me.didit:didit-java on Maven Central.
Sync and asyncEvery method has an ...Async variant that returns a CompletableFuture.
Works with KotlinOptional response fields are Optional values. In Kotlin, read them with .getOrNull().
Typed buildersRequest types are builders. build() checks the required fields.
Three dependenciesjava.net.http, Jackson and the JSpecify nullness annotations.
Release 1.18.0The two Google Wallet endpoints are not in this release yet.

Questions

Questions about the Java SDK

Which Java version does the SDK need?
Java 11 or later. The library depends only on java.net.http, Jackson and the JSpecify nullness annotations.
Does the Java SDK work with Kotlin?
Yes. It is the official library for Java and Kotlin. Optional response fields are Optional values, and in Kotlin you read them with .getOrNull().
Does the Java SDK support async calls?
Yes. Every method has an Async variant that returns a CompletableFuture.
How do I add the Didit Java SDK to my build?
With Gradle, add implementation("me.didit:didit-java:1.0.1"). With Maven, add the dependency with groupId me.didit, artifactId didit-java and version 1.0.1. The artifact is on Maven Central, and the source and changelog are in didit-protocol/sdk-java on GitHub. new Didit() reads DIDIT_API_KEY from the environment.
How do I verify a webhook in Spring Boot?
Take the body as @RequestBody byte[] body and the headers as @RequestHeader Map<String, String> headers, then call Webhooks.verify with your secret. It throws WebhookVerificationException, with a reason, for anything that is not a valid, fresh delivery. To accept two secrets while you rotate one, pass VerifyOptions.
How do I handle API errors in Java?
Every Didit exception extends the unchecked DiditException. Catch NotFoundException for a missing resource and ApiStatusException for any other non-2xx response, which exposes statusCode() and requestId(). There are subclasses for 400, 401, 403, 404, 409, 422, 429 and 5xx responses.
Does the Java SDK retry failed requests?
Yes. Every Didit server Software Development Kit (SDK) retries a failed request up to 2 times, with exponential backoff from 0.5 seconds (at most 8 seconds), and honours Retry-After. POST and PATCH are retried only on 429 or when the connection failed before sending, so a retry never creates a second session. The default timeout is 60 seconds. Set timeout and maxRetries on Didit.builder(), or per call with RequestOptions.
How does the Java SDK check required fields?
Request types in the Didit Java SDK are builders, and build() checks the required fields before anything is sent. Optional response fields are Optional values, so you read them with methods like orElse. Methods follow the API's resources, for example client.sessions().create(...).
Which calls need the organization and application ids?
Application-scoped calls such as regulatory reports need them. Set DIDIT_ORGANIZATION_ID and DIDIT_APPLICATION_ID in the environment, or set them with organizationId and applicationId on Didit.builder(). The Didit SDK fills both path ids for you, so you never pass them per call. Without them those calls fail with a configuration error before any request is sent.
How are the Didit Java SDK versions numbered?
The Java SDK follows semantic versioning and is on 1.x. A change that mirrors the Didit API ships as a minor release, even when it can break typed code, and the release notes list it under "API changes that can break typed code". A major version is only for a change to the SDK's own design. Each repository's CHANGELOG.md lists every release.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Trusted by EU regulators

    After a year of supervised testing, EU financial regulators confirmed that verifying with Didit is safer than checking an ID in person.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Start

Install the SDK

Create an account, get your sandbox key and add the dependency.

Create accountRead the docs

Free sandbox. Credit applies to work-email sign-ups.