Prembly Developer SDKs
Prembly's SDKs and APIs allow you to programmatically verify the identities of your customers in seconds through an easy, secure, and fully customizable integration. Whether you are building for web browsers, cross-platform mobile apps (React Native, Flutter, Ionic/Capacitor), or backend microservices, our prebuilt UI components handle document capture, liveness challenges, and identity verification securely.
Getting Credentials
Before embedding Prembly's SDK into your application, you must generate your integration keys from the dashboard:
- Log into your Prembly Dashboard.
- Navigate to SDK Setup → Add New Widget.
- Create your configuration and copy your credentials:
widget_id(orconfig_id): The unique ID representing your verification workflow configuration.widget_key(ormerchant_key): Your public API key for client-side SDK initialization.
Security Requirement: Public Keys Only
Never expose your Secret Key (X-API-Key) in client-side code (browsers, React Native, Flutter, or Capacitor bundles). Client-side SDKs must only use your Public Key (widget_key). Perform all administrative operations and final session lookups exclusively on your backend server.
Platform SDK Quick Links
Choose your integration target below to view detailed installation steps, full prop tables, native permission setup, and troubleshooting guides:
| Platform | Package / Script | Guide Link |
|---|---|---|
| Web: Workflows | https://js.prembly.com/v1/inline/widget-v3.js | View Web SDK Guide |
| Web: Identity widget | https://js.prembly.com/v1/inline/widget.js | View Web SDK Guide |
| React Web | prembly-react-kyc | View Web SDK Guide |
| React Native | prembly-react-native-kyc | View React Native Guide |
| Flutter | prembly_identity_kyc | View Flutter Guide |
| Ionic (Capacitor) | prembly-capacitor-kyc | View Ionic (Capacitor) Guide |
| Backend & Webhooks | GET /api/v1/checker-widget/sdk/sessions/{id}/ | View Backend & Webhooks Guide |
Already know your customer's BVN or NIN? See Prefill an ID number.
Prefill an ID number
If you already know your customer's ID number, pass it when the session starts. The customer skips the ID screen and goes straight to their next step, such as the selfie.
Supported IDs
BVN and NIN only. Pass exactly one per session.
Passport, driver's licence, and voter's card are not supported yet. A passport check also needs a last name and date of birth, which prefill does not carry, so the ID screen cannot be skipped.
Prefill works with workflows. It applies to a widget only when that widget is linked to a workflow.
Choose how to pass it
| Route | Use it when | Can the customer change the ID? |
|---|---|---|
| From your server | The ID must be the one you set. | No |
| Typed SDK option | You start a workflow from the Web SDK or a mobile app. | Yes, by altering the app's traffic |
In metadata | You use the identity widget, or an existing integration already sends metadata. | Yes, by altering the app's traffic |
From your server
Create the session from your backend with your Secret Key, add a prefill object with exactly one ID, then open the link the response returns in your app or browser.
POST /api/v1/compliance-workflow/sdk/sessions/initiate/ HTTP/1.1
Host: api.prembly.com
X-API-Key: your_secret_api_key
Content-Type: application/json
{
"workflow_id": "wf_123",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"prefill": { "bvn": "22212345678" }
}The response contains a session_url. Open it to run the workflow.
If the workflow's identity step doesn't accept the ID type you sent, the request fails with 400 Bad Request and the error lists the accepted types. The prefill field is refused on requests made with a publishable key.
Typed SDK option
The workflow SDKs take a prefill option:
| SDK | Component | Minimum version | Option |
|---|---|---|---|
Web (widget-v3.js) | Prembly.workflow.start() | 1.2.0 | prefill: { bvn: '22212345678' } |
Flutter (prembly_identity_kyc) | WorkflowOptions | 0.1.3 | prefill: const WorkflowPrefill(bvn: '22212345678') |
React Native (prembly-react-native-kyc) | PremblyWorkflow | 2.0.2 | prefill={{ bvn: '22212345678' }} |
Capacitor (prembly-capacitor-kyc) | PremblyWorkflow.start() | 0.1.2 | prefill: { bvn: '22212345678' } |
Use nin in place of bvn to prefill a NIN. The SDK sends the ID to Prembly inside the session's metadata.
In metadata
Any integration can pass the ID in the metadata object it already sends, including the Web SDK and the identity widget components. Either form works:
// Nested
metadata: {
prefill: { bvn: '22212345678' }
}
// Flat
metadata: {
prefill: true,
bvn: '22212345678'
}In the flat form, prefill accepts true, "true", 1, "1", or "yes". You can add channel_code: 'bvn' to say which ID to use. It's optional when only one ID is present.
If the workflow's identity step doesn't accept the ID type, or the widget isn't linked to a workflow, the ID is ignored and the customer is asked for it as usual.
Other metadata keys, such as user_id or transaction_id, are not used for prefill and are returned unchanged in the callback, the session lookup, and webhooks.
If you pass it more than once
| If you set… | Then |
|---|---|
The server prefill field and an ID in metadata | The server field wins. |
The typed SDK prefill option and the same key in your metadata | The typed option wins. |
A nested prefill: { bvn } object and a root-level bvn in metadata | The nested object wins. |
What the customer sees
The prefilled ID is locked: the customer sees it masked and cannot edit it. If the check on a prefilled ID fails, the session goes to manual review, and the customer is told to contact the organisation that sent them the link.
Security
IDs sent from an app or browser can be changed
An ID passed through an SDK or metadata comes from the customer's device, and anyone who can read the app's traffic can change it. When the ID must be the one you set, use the server route.
When a prefilled ID is used, Prembly stores it encrypted, removes it from the session's metadata, and clears it when the session ends. It does not appear in the session lookup or webhooks.
An ignored ID is returned as sent
If an ID in metadata is ignored — because the workflow doesn't accept that ID type, the widget isn't linked to a workflow, or you also sent the server prefill field — it stays in metadata as plain text and is returned in the session lookup and webhooks like any other key.
Sandbox & Testing
Sandbox is a setting on the widget, not an SDK option. To test without incurring charges or consuming live verification quotas, set the widget to Sandbox Mode in the dashboard. Every session that widget starts runs in sandbox, with no change to your integration code.
Until your organisation is verified, all widget sessions run in sandbox regardless of the widget's setting.
is_test has no effect
Older examples pass is_test: true in the SDK configuration. Prembly ignores it, so it does not switch a session to sandbox. Use the widget's setting instead.
Verification Results & Status Matrix
When a user completes or exits the verification flow, the SDK callback function fires with a standard response object.
Callback Status Values
| Status | Description | User Action Required |
|---|---|---|
success | User completed verification and passed all identity and biometric checks. | Proceed to onboard user / grant access. |
failed | User completed verification but failed data validation or biometric checks. | Prompt user to retry with valid documents. |
closed | User exited or dismissed the verification modal before completion. | Offer user option to resume verification. |
error | A technical error occurred (e.g., network disconnect, timeout). | Inspect error details and retry attempt. |
Global HTTP Status Codes
When making server-to-server requests or handling API responses:
| Code | Status | Meaning & Required Action |
|---|---|---|
200 / 201 | Success | Request succeeded. Continue normal application processing. |
400 | Bad Request | Invalid request payload, missing parameters, or incorrect data formatting. |
401 | Unauthorized | Missing or invalid widget_key, widget_id, or backend secret API key. |
402 | Payment Required | Wallet balance depleted. Fund your Prembly account wallet. |
500 / 503 | Server Error | Temporary service issue. Retry request using exponential backoff. |