Skip to navigation

Headless KYC

Embed multi-step KYC flow in your own interface without building custom UI against the KYC APIs.

View as Markdown

Headless KYC is a UI module that enables partners to integrate the multi-step KYC flow directly into their applications by simply loading Transak’s KYC widget.

Current Limitations

LimitationDetails
Headless KYC APIs (Transaction Session API)

APIs are to be called only from the partner backend and subjected to the whitelisting of partner IP addresses. We don’t support API calls from the frontend due to security restrictions.

Camera permission

Partner app must grant camera permission at the manifest or browser level. If permission isn’t available, the module shows fallback automatically.

Supported for JS, React, and React Native integrations

The Transak UI SDK is available for JS, React, and React Native integrations.

FCA Flow (For UK Users) not supported

Partners can integrate the APIs to submit the FCA requirements. See the How to Submit FCA Requirements guide for step-by-step instructions.

How to integrate?

1

Whitelist Your API Key & Enable Headless KYC

Action
Follow the steps in the Need help in Integration section
Request API key whitelisting
Share your public IP addresses with Transak for whitelisting to use our APIs in your backend
2

User Authentication

You can use either of the following authentication options:

OptionDescription
White-label AuthUse the standard Transak authentication flow to generate a user access token. Partners can do this by calling the Send User OTP API followed by the Verify User API to generate the access token.

Learn more
Auth RelianceUse Auth Reliance by passing these headers with every request: x-user-identifier and x-access-token

Please refer to the tutorial on how to create partner access token.

3

Generate a quote using the Quote API

Call the Get Quote API to get a quote for the transaction. Pass the apiKey, fiat amount, fiat currency, crypto currency, network, and order type.

A successful response returns a quoteId.

4

Create a transaction session (using Backend only)

Call the Transaction Session API from your backend, passing the quoteId from the previous step and a new module field set to "kyc".

ParameterDescription
quoteIdQuote ID returned by the Get Quote API in the previous step
moduleSet to "kyc" to initialize a Headless KYC session
configOptional. colorMode (DARK or LIGHT) to theme the KYC component and colors object to override individual theme colors

A successful response returns a sessionId.

5

Load the Headless KYC Component via Transak UI SDK

Use the Transak UI SDK to render the KYC component. Pass the sessionId received in the previous step.

The module renders no Back/Next/Submit buttons of its own, wire your own UI to the SDK’s next() / back() methods.

npm install @transak/ui-components
import { createTransakKyc } from '@transak/ui-components';
const kyc = createTransakKyc({
sessionId, // sessionId from previous step
environment, // 'STAGING' | 'PRODUCTION'
onReady: () => {
// Component is ready
},
onStateChange: (state) => {
// Current step changed (e.g. personalDetails, address, idProof) — no user data included.
// Use this to enable/disable your own Back/Next buttons.
},
onSubmitted: ({ kycStatus }) => {
// All required forms submitted. kycStatus is almost always 'SUBMITTED';
// track final approval separately via the KYC status API or webhook.
},
onError: ({ code }) => {
// Handle error
},
});
await kyc.mount('kyc-slot');
// wire to your own Back/Next buttons:
kyc.back();
kyc.next();
// and then
kyc.unmount();

Error codes

The onError callback receives a code value. Use it to handle specific failure scenarios:

CodeDescription
CONFIG_LOAD_FAILEDThe session could not be loaded covers a missing, invalid, or expired sessionId
STEP_SUBMIT_FAILEDA form submission for the current step returned a non-2xx (non-validation) response
FILE_UPLOAD_FAILEDDocument upload (proof of address / source docs) failed.
KYC_PROVIDER_UNAVAILABLEOnfido/vendor downtime or workflow-run failure
INVALID_OPTIONSInvalid or missing options passed to the SDK
IFRAME_LOAD_FAILEDThe embedded iframe failed to load
INVALID_STATESDK method called in an unexpected state
6

Handle the ID proof and selfie step

The ID proof and selfie step is handled inside the module via Onfido, no separate integration is required. Keep the following in mind:

  • Your app is responsible for granting camera permission (native app manifest or browser).
  • If permission isn’t available, the module automatically shows a fallback.
7

Track the final KYC status

The module’s onSubmitted callback fires once all required forms are submitted, it does not guarantee final approval. Use the Get KYC Requirement API to poll for the final status.

Partner can also use the KYC Webhooks to receive a notification when the final status is available.

API Overview

API Errors

HTTP StatusError CodeMessage
4011002Invalid or missing authentication token.
4226003This feature is not enabled for your account. Please contact support.
4226005Quote not found or could not be loaded.
5006005Failed to create a session for the user.