Skip to main content

Advanced API Versioning with gRPC for Identity Microservices

Version identity microservices with one protobuf package per major version and additive changes inside it. Our versioned REST routes show the same pattern; a full KYC check costs $0.33 and the sandbox is free.

Advanced API Versioning with gRPC for Identity Microservices

Contents

In this guide

Jump to the part you need.

This how-to is for platform teams that run identity checks as microservices and need to change a contract without breaking existing clients. It sets out a versioning method for gRPC and Protocol Buffers, then applies the same pattern to the Didit API. We do not publish a gRPC contract: our documented surface is versioned REST plus webhooks, with v1, v2 and v3 routes running in parallel. A full KYC check costs $0.33, and the sandbox is free.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

The short answer

How to version identity microservices, and what the checks cost
QuestionAnswer
OutcomeClients on two contract versions run against the same backend, and only the client that asks for a new field ever sees it.
Recommended methodOne protobuf package per major version, additive-only changes inside a major version, a new package for anything breaking, and both versions served until the deprecation window closes.
Versioning unitThe proto package, for example yourco.identity.v2, not the individual message.
Our surface in the exampleREST over HTTPS at verification.didit.me with the x-api-key header. You create sessions on /v3/session/; decision routes exist at v1, v2 and v3 in parallel.
Full KYC price$0.33 per completed check: ID document $0.15, passive liveness $0.10, face match 1:1 $0.05, device and IP $0.03.
SandboxFree and unlimited on every plan. Every check is mocked, so compatibility testing costs nothing.
Main caveatWe publish no gRPC or protobuf contract. If your services speak gRPC internally, terminate gRPC in your own gateway and call the documented REST routes.

Start free in the sandbox at business.didit.me with no sales call: you can hold two versions of your client against the same workflow and compare both responses side by side. Developers who work through an AI assistant can connect the hosted server at didit.me/developers/mcp. For the checks themselves and the current per-check prices, see the pricing page and the pricing docs.

The outcome, and the method we recommend

The outcome is narrow and testable: a client generated from last quarter's contract keeps working, byte for byte, while a second client reads fields that did not exist when the first one shipped. For identity flows that matters more than it does for a content API, because the payload decides whether a person gets an account or a business gets onboarded. A dropped field can change the decision data your client receives.

We recommend two layers, and we keep them separate on purpose. Inside a major version, the contract only grows: new field numbers, new methods, new enum values appended at the end. Between major versions, you fork the package and run both implementations at once. That split is what lets a team ship weekly without a weekly client release.

We run identity and fraud checks for 4,000+ companies across 220+ countries, and our public API follows the same rule. The v3 session routes return plural arrays of report objects, each tagged with the workflow node that produced it; the v2 report shapes stay backwards compatible and return only the first instance of each feature. Both are served at the same time, so you can call either route against the same session and compare the responses.

Prerequisites

  • A short written version policy that says what counts as breaking. Without it, every release becomes an argument.
  • protoc and a build step that regenerates stubs for each package version you still serve.
  • A Didit sandbox application and its API key. Sandbox keys start with sk_test_, live keys start with sk_live_, and keys created before that format carry no prefix and keep working, so never validate a key by its prefix.
  • A workflow UUID from /v3/workflows/. The workflow type, KYC or KYB, decides which kind of session is created; there is no separate endpoint for KYB.
  • Server-side custody of the key. It is a long-lived secret on the x-api-key header and never ships to a browser or a mobile bundle.

Steps

The protobuf package and the gRPC snippets below are illustrative application design, not a Didit surface. Our documented integration remains REST and webhooks; nothing here asks you to run gRPC against Didit, and the pattern is the same whether your internal transport is gRPC, GraphQL or plain HTTP.

  1. Write the version policy first. List what counts as breaking: removing or renaming a field, changing a field number, changing a field type, tightening validation on an existing field, retiring a status value. Everything outside that list is additive and ships inside the current major version.
  2. Put the major version in the protobuf package. A package such as yourco.identity.v2 generates its own stub, so a v3 file can sit next to it while the v2 service implementation stays deployed. Versioning the message name instead, with UserV1 and UserV2, spreads the decision across every RPC and ends in a branch inside your handlers.
  3. Reserve what you remove, and deprecate before you remove. Mark the field [deprecated = true], keep serving it, and reserve the number and the name once traffic reaches zero, so nobody picks them up again by accident.
    syntax = "proto3";
    package yourco.identity.v2;
    
    message Session {
      string session_id = 1;
      string status = 2;
      reserved 3, 4;
      reserved "legacy_score";
      string vendor_data = 5;
      repeated string tags = 6 [deprecated = true];
    }
  4. Evolve additively inside the major version. New optional fields, new RPC methods, new enum values appended at the end. Never renumber, never reuse a name, never change a scalar type. A field that changes meaning gets a new number, and the old one is deprecated.
  5. Make both sides tolerate unknown data. Proto3 preserves unknown fields on the wire, so a client that re-serializes should pass them through rather than drop them. On the JSON side of an identity API, ignore keys you do not know; our error bodies do not share one envelope, and the guidance in the docs is to read them defensively and branch on the status first, then on code when it is present.
  6. Call the versioned create route. The version sits in the path, so a v4 can ship without touching this call. This is the request from our create-session docs:
    curl -X POST https://verification.didit.me/v3/session/ \
    -H "x-api-key: $DIDIT_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"workflow_id":"<WORKFLOW_ID>","vendor_data":"user-42","callback":"https://myapp.com/return"}'
    Send vendor_data as your stable identifier for the person or business. It binds the session to an entity and is what duplicate detection compares across sessions.
  7. Read the decision from a versioned route and branch on the discriminator. The same id resolves as a user session or a business session, and session_kind tells you which handler to run. Always branch on it rather than on a guess from the request.
    curl https://verification.didit.me/v3/session/<SESSION_ID>/decision/ \
    -H "x-api-key: $DIDIT_API_KEY"
  8. Version the asynchronous surface with the same discipline. Webhook payloads carry the same decision envelope as the retrieve response. A consumer that ignores unknown keys survives an additive change; a consumer that validates against a frozen schema does not. When an event shape breaks, publish the new shape alongside the old one and let subscribers move.
  9. Migrate pollers deliberately, and watch the rate-limit scope move with them. Rate limits are per identifier, your x-api-key or your client IP, each in a 60-second fixed window. The 100 per minute decision throttle applies to the v1 and v2 decision paths; GET /v3/session/<id>/decision/ is governed only by the 600 per minute generic-get ceiling. Session creation is capped at 600 per minute on POST /v3/session/. A version migration is a capacity change, so plan it like one.
  10. Run both versions until usage reaches zero, then retire. Count calls per version at your edge, not in a spreadsheet. Keep a sandbox key on the retiring version so the last clients can still reproduce their flows before you switch the route off. Clients discover a retirement date in two places: the changelog of the API they call, and the deprecation notice you send to the teams that own those clients. Write both dates down before the migration starts, and treat the retirement date as the day the old route starts returning 404.

Expected output

A successful create returns a session id and a hosted URL. The decision route then returns one object whose top-level keys are shared by user and business sessions, plus per-feature arrays that are plural in V3 and absent or null when the feature did not run. A trimmed response looks like this:

{
  "session_id": "0f6c1f9e-...",
  "session_kind": "user",
  "session_number": 41,
  "session_url": "",
  "status": "Approved",
  "vendor_data": "user-42",
  "features": "ID_VERIFICATION, LIVENESS, FACE_MATCH, IP_ANALYSIS",
  "decision_trace": { "decided_by": "automatic", "status": "Approved" },
  "id_verifications": [],
  "liveness_checks": [],
  "face_matches": [],
  "aml_screenings": null
}

The status enum is the part your client will branch on most: Approved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted, Awaiting User. Treat an unrecognised status as a non-terminal state and keep polling under a polling policy your application defines, with a ceiling and a fallback, since the docs do not prescribe how long to poll. That tolerance is exactly what makes a future additive change safe.

A session overview page in the Didit Business Console listing the session status and its warnings
The same session the decision route returns, with its warnings, in the Didit Business Console.

One field deserves its own mention when you version: decision_trace records how the status was reached, including decided_by set to manual, automatic or investigator. If you render a decision in a client, read it from decision_trace rather than inferring it from the top-level status.

Failure cases and recovery

What a versioned identity client sees when a call fails
StatusWhat it meansRecoveryRetry
400A field failed validation, or an image or document could not be readFix the field the body namesAfter fixing
401The key is wrong, malformed, revoked or expiredRe-fetch the key, or create a new one in Developers, API keysAfter fixing
403No key was sent, the key lacks access to this resource or action, the call came from outside the key's IP list, or the balance cannot cover the callIf the body names a credit shortfall, top up the balance; if it names access or an IP restriction, send a key that has that access or call from an address on its IP listAfter fixing
404The resource does not exist, or the session sits outside the key's workflow or status limitsCheck the id and the key's limitsNo
409The request conflicts with current state, for example a reused Idempotency-KeyRead code and reload the stateDepends on code
410The session or invitation has expiredCreate a new oneNo
422A wallet address fits more than one blockchain, so nothing was screened or billedResend with blockchain set to one of candidate_chainsAfter fixing
429A rate limit or quota was reachedWait for Retry-After; headers name the scope that trippedYes, after waiting
500, 502, 503An unexpected error on Didit's side, a dependency error, or a query timeoutRetry with backoff and contact support if it continuesWith backoff

On a 429 the response carries X-RateLimit-Scope, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset and Retry-After. Use Retry-After as the floor for backoff, layer jitter on top, and stop after a small ceiling such as five attempts. These headers are emitted on the 429 only, not on successful responses.

The ID document report for a session in the Didit Business Console, showing extracted fields and status
Each feature in the decision response has a matching report in the console: here, the ID document.

Inputs and outputs

Fields on the documented create call and the decision response
FieldDirectionTypeNotes
workflow_idInputUUID stringRequired. From /v3/workflows/; the workflow type sets KYC or KYB.
vendor_dataInputStringYour stable entity identifier. Used for duplicate detection.
callbackInputURLWe append verificationSessionId and status when the flow finishes.
callback_methodInputStringinitiator, completer or both.
metadataInputObjectEchoed back in responses and webhooks, never shown to the user.
tagsInputArray of stringsUp to 10, each up to 50 characters, stored in upper case.
session_expiration_timeInputIntegerSeconds, between 3600 and 2419200, overriding the workflow setting for this session.
languageInputStringISO 639-1 code for the verification UI.
session_idOutputUUIDCreated by POST /v3/session/.
session_urlOutputURLThe hosted verification link.
session_kindOutputStringuser or business. Always branch on it.
statusOutputStringThe session status enum listed above.
reviews, status_overrideOutputArray, objectManual review activity, and any status a reviewer changed by hand.
Feature arraysOutputArraysid_verifications, liveness_checks, face_matches, aml_screenings, registry_checks and the rest. Plural in V3, each item carrying a node_id.

API versioning strategies compared

Four strategies come up in every design review, and they are not exclusive. Most teams combine the first and the fourth: a path or package version for breaking changes, and additive message evolution for everything else.

Where the version lives, and what each choice costs
StrategyWhere the version livesGood forCost
Path versioning/v3/session/Breaking changes, simple routing, obvious logsDuplicate route surface; deep links and SDKs must move
Header versioningX-API-Version: 1Keeping URLs stable across majorsClients forget the header; proxies and caches ignore it
Content negotiationAccept: application/vnd.yourco.v1+jsonChoosing a representation on the same URLLeast understood by client developers; awkward over gRPC
Protobuf package versionyourco.identity.v2The gRPC contract itself, with both stubs deployedTwo implementations to test and monitor

Message-level versioning, where a single RPC accepts several message shapes, is a design tradeoff, not a free shortcut. It keeps one package but hides the fork inside a handler, where it is harder to spot in a trace and harder to retire. Use additive fields for additive changes and fork the package when the change is real.

API-first microservices and identity data

API first means the contract is the artefact you review, version and test, and the service implementation follows it. For identity microservices that has two consequences beyond the usual. First, report objects are the product: a decision payload must stay readable by clients that were generated a year ago, because those clients are often the ones sitting in a regulated onboarding flow. Second, the contract has to survive a change of provider logic underneath. Our V3 report objects carry a stable serializer shape across the decision route, webhook payloads and the standalone APIs, so the same field names appear whether you poll or listen.

Orchestration is where API-first pays off most. The Workflow Orchestrator is free and included, so adding a document or liveness step is a workflow change, not a contract change, and clients keep reading the same arrays.

Worked cost example

Take a team that runs 10,000 completed KYC checks a month and adds AML screening to 2,000 of them. Only completed checks are billed, so a sandbox compatibility run adds nothing to the bill.

  • KYC: 10,000 x $0.33 = $3,300.00
  • AML screening: 2,000 x $0.20 = $400.00
  • Total at list price: $3,300.00 + $400.00 = $3,700.00 per month
  • Same volume on Growth, where the 4% discount applies to every Didit price: 10,000 x $0.3168 = $3,168.00, plus 2,000 x $0.192 = $384.00, giving $3,552.00 of usage. That $3,552.00 figure is usage only and excludes the separate $99.00 monthly plan fee, which arrives as $115.00 of monthly credit.

The $0.33 breaks down as ID document $0.15, passive liveness $0.10, face match 1:1 $0.05 and device and IP analysis $0.03. If your versioned client only needs the document step, the published line for ID verification alone is $0.15.

  • Free: sandbox testing is free and unlimited, and every check is mocked. Build your v1 and v2 clients there and compare full JSON side by side before either reaches production.
  • Paid per completed check: the full KYC check at $0.33, AML screening at $0.20, wallet screening at $0.15 per screening, and ongoing AML monitoring at $0.07 per person per year. Billing is per completed check; confirm billing details in the pricing documentation.
  • Human boundary: when a session lands In Review, a person in the console holds it. The response then exposes assignee, waiting_since and sla_due_at, and status_override appears if the reviewer changed the status by hand. No API version changes that, and no client should try to shortcut it.
  • Where your responsibility ends: we publish no gRPC contract, so the gateway that translates between your protobuf packages and the documented REST routes is yours to own, version and test.

MCP setup for every client, with the hosted server at https://mcp.didit.me/mcp and OAuth sign-in.

Video thumbnail titled Use Didit with MCP, showing an AI assistant connected to the Didit server
If your team drives the API from an AI assistant, the MCP server is the documented route.

Sources

Next step: open the sandbox at business.didit.me, create one workflow, and run the create and decision calls above with a sandbox key. There is no sales call and no setup fee.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alejandro Rosas

Co-founder and CTO

Alejandro Rosas

Alejandro Rosas

Co-founder and CTO

About Didit

Questions

Frequently asked questions

What is gRPC versioning?

gRPC versioning is the set of rules that let you change a Protocol Buffers contract without breaking clients generated from an earlier version. It works at two levels: additive schema evolution inside one major version, where you add field numbers and reserve the ones you retire, and a package-level major version such as yourco.identity.v2 for anything breaking. Clients pick a version through the stub they generate, and the server keeps the old and new implementations deployed together.

What are the main API versioning strategies?

The four common strategies are path versioning, where the version is a URL segment; header versioning, where a custom header names the version; content negotiation, where the Accept header selects a media type and version; and protobuf package versioning, where the version lives in the schema and both stubs run. Most teams combine path or package versioning for breaking changes with additive fields for everything else.

Which API versioning strategy should identity microservices use?

Use a major version in the path or the protobuf package, and make every other change additive inside that version. Identity payloads feed regulated decisions, so a client generated months ago must keep reading the same field names. Keep the version visible in logs and tracing, and count calls per version so you can retire the old one on evidence rather than on a calendar.

What does API-first mean for identity microservices?

API first means the contract is the artefact you review, version and test, and the implementation follows it. For identity services the payload is the product, so the contract also has to stay stable when the checks behind it change. We keep one serializer shape for report objects across the decision route, webhook payloads and standalone APIs, so the field names do not move when the delivery method does.

Does Didit offer a gRPC API?

We do not publish a gRPC or protobuf contract. Our documented surface is REST over HTTPS at verification.didit.me with the x-api-key header, under versioned routes such as /v3/session/, plus webhooks. If your internal services speak gRPC, terminate gRPC in your own gateway and translate to the documented REST calls, which is the pattern this guide uses.

How does Didit version its own API?

We put the version in the path. You create sessions on POST /v3/session/, and decision routes exist at v1, v2 and v3 in parallel. Our V2 report shapes stay backwards compatible and return only the first instance of each feature, while V3 returns plural arrays where every item carries the node_id of the workflow node that produced it.

Can I add a field to a protobuf message without breaking old clients?

Yes, provided you add a new field number and never reuse an old one. Proto3 preserves unknown fields on the wire, so an older client ignores the new field and keeps working. The failure case is a client that rejects unknown data or re-serializes without passing it through, which is why you test both directions before a release.

What is the difference between backward and forward compatibility in gRPC?

Backward compatibility lets a new server serve an old client, which additive fields give you for free. Forward compatibility lets an old server handle a newer client, which requires that new fields are optional and that missing data has a defined default. Reserve field numbers before you need them, and treat an unrecognised enum value as a non-terminal state.

How much does it cost to test two client versions?

Nothing. Sandbox testing is free and unlimited on every plan, and every check is mocked, so you can run a v1 client and a v2 client against the same workflow and compare full responses. Live billing starts only with completed checks, at $0.33 for a full KYC check.

What error does an old client get if a route no longer exists?

A 404, which the docs define as a resource that does not exist or a session outside the key's workflow or status limits, and which should not be retried. An expired session returns 410, also not retried. A missing key header returns 403 and a wrong or revoked key returns 401, both fixable but neither retryable as-is.

What happens when a session is In Review while a new version ships?

Nothing in the review changes. The session exposes assignee, waiting_since and sla_due_at while a person holds it, and status_override records any status a reviewer set by hand, with the original kept as automatic_status. Your new client should read those fields rather than assume a decision is final.

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.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • 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.

Verify your first user today.

Start free

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