Create a client
Introduction
In order to interoperate with OpenCRVS' via APIs, you must create a system client.
You can create a system client to perform record search & event notifications from a health system via the National System Administrator UI.
From 2.0.1 you can also create clients with whatever scopes you wish from your country configuration, without going through the UI. See Process of creation via the country configuration below.
The option to create clients for managing Locations, Importing Legacy Records or integrating with Citizen Portals via the UI has been deprecated for security reasons in 2.0, as these clients are extremely powerful.
Docs will be updated in this section by Aug 2026 to include information on the creation of those types of client.

Process of creation via the UI
Click + Create client
You will see a modal overlay where you can select the type of client you wish to create. The business functionality available for each client is explained in subsequent pages in this section of our documentation.
The type of client you create is important and can only perform API requests associated with the business functionality relevant to that type. A Record Search client is not authorized to perform an Event Notification for example.
You must give each client a unique name.
When you click "Create", you will be shown the authentication details for the client along with a SHA Secret used to sign, encrypt, decrypt and verify the authenticity of payloads.

6. You can manage existing clients by using the 3 dots menu after the client has been created. You can reveal the Client ID and SHA Secret keys at any time and refresh the Client Secret to create a new one by selecting "Reveal Keys".
You can also temporarily "Deactivate" and "Enable" a client or alternatively "Delete" it.


Process of creation via the country configuration
A client created in the UI is limited to the permissions that come with its type. When an integration needs a different set — a national ID system that registers birth and death records on its own authority, for example — declare it in your country configuration instead.
The reason to give an integration its own client, rather than letting it reuse the access token of whichever user triggered the call, is the audit trail. A client that authenticates as itself is recorded as itself in a record's history. One that borrows a registrar's token is indistinguishable from that registrar afterwards.
Clients registered this way appear in the Integrations list alongside the ones created in the UI, where a National System Administrator can reveal their keys, deactivate them or delete them.
1. Implement the system ready trigger
Your country configuration exposes a GET /trigger/system/ready endpoint. The reference country configuration routes it to systemReadyHandler in src/api/integration/handler.ts, which registers every integration listed in its INTEGRATIONS array. The list ships empty, so an unmodified country configuration registers nothing and answers 200. If your country configuration answers 404 or 501, OpenCRVS reads it as "this country has no integrations to register":
OpenCRVS calls this endpoint during provisioning and passes a bearer token that already carries the integration.create scope. Your handler should forward that token rather than authenticating again.
2. Register each integration
Add each integration to INTEGRATIONS. The handler posts each one to POST /integrations on the events service, and skips any name that is already registered, so restarts never overwrite a secret a National System Administrator has rotated. Unless you pre-share credentials (see below), nothing needs to be stored in your country configuration — the credentials are generated by OpenCRVS and returned in the response. A simplified version of the handler:
EVENTS_URL must point at the events service on the internal network (http://events:5555/ in the default deployment). From OpenCRVS 2.1 it is required: it has no production default, so the country configuration service does not start without it, whether or not any integrations are configured.
Request payload
name
string
A unique name for the client, shown in the Integrations list
scopes
string[]
At least one encoded scope string (see below)
credentials
{ clientId: UUID, clientSecret: string }
Optional. Pre-shared credentials the integrating system already holds, so it can authenticate immediately without a Reveal keys step. Both must be given. Returns 409 CONFLICT if the client id is taken.
Response
The clientSecret is returned only in this response and is not retrievable afterwards. Either hand it to the integrating system from your handler, or discard it and have a National System Administrator use Reveal keys → Refresh secret on the Integrations page to issue a new one.
Scopes
Scopes are passed as encoded strings in query-string format: type=<scope type>&<option>=<value>,<value>. For record permissions the option is event, listing the event identifiers declared in your event configuration — birth, death, tennis-club-membership and so on. For example, type=record.register&event=birth,death. Rather than writing these strings by hand, define scopes as objects and encode them with encodeScope from @opencrvs/toolkit/scopes, as in the example above.
The available record scope types are:
record.search
Search for records
record.create
Create a new record
record.read
Read a record
record.declare
Submit a complete declaration
record.notify
Submit an incomplete notification
record.edit
Edit a declared record
record.reject
Send a record back for updates
record.archive
Archive a record
record.unarchive
Unarchive a record
record.review-duplicates
Review records flagged as potential duplicates
record.register
Register a record
record.print-certified-copies
Print certified copies
record.request-correction
Request a correction to a registered record
record.correct
Apply a correction to a registered record
record.unassign-others
Unassign a record assigned to another user
record.custom-action
Perform a custom action
record.action.accept
Accept a pending action after the country configuration returned 202
record.action.reject
Reject a pending action after the country configuration returned 202
record.action.accept and record.action.reject are how an integration confirms an asynchronous action — for example, MOSIP accepting a registration once the national ID has been issued. The scope of the action itself (such as record.register) does not allow confirming it, so a client that only confirms needs record.action.accept (and record.action.reject if it rejects) plus record.read, not record.register. These clients can only be registered from the country configuration as described here — the Integrations page cannot create them. See Action confirmation.
3. Authenticate as the integration
Nothing special: the integration exchanges its client id and secret for an access token exactly like a client created in the UI. See Authenticate a client.
Integration audit log
Every operation a system client performs is recorded in its own audit log. A user whose role has the integration.audit.read scope can read it through the integrations.audit endpoint of the events service. The scope is separate from integration.create, so read-only oversight can be granted on its own. It takes no options: system clients have no office or administrative area, so access is always national.
Request
GET https://gateway.<your_domain>/events/integrations.audit?input=<url-encoded JSON> with a user's Authorization: Bearer <token> header, for example input={"json":{"id":"2fd153ab-86c8-45fb-990d-721140e46061","count":20}}.
id
UUID
The client id of the integration
skip
number
Optional. Number of entries to skip. Default 0
count
number
Optional. Page size, 1–100. Default 10
timeStart
string
Optional. ISO 8601 date-time including an offset, e.g. 2026-05-01T00:00:00+02:00. Bare dates are refused
timeEnd
string
Optional. Same format as timeStart
Response
{ "results": [...], "total": <number> } — the operations the client performed, newest first. An unknown client id returns 404.
The log shows only what the client itself did. Who created, deactivated or re-keyed an integration is recorded in the audit log of the administrator who did it.
3. Authenticate as the integration
Nothing special: the integration exchanges its client id and secret for an access token exactly like a client created in the UI. See Authenticate a client.
Last updated