Bahari KYC API

REST over HTTPS, JSON in and out. Base URL https://kyc.baharione.com/api/v1.

Overview

  1. Your server creates a session for a customer and receives a url.
  2. The customer opens the link, chooses a national ID card, passport, driving licence or residence permit from any country, photographs the document and takes a selfie with a short head-turn check. On a desktop, a QR code hands the capture over to their phone. The camera captures automatically when the document is sharp and in frame.
  3. The checks run in a few seconds. The session ends as approved, declined, resubmission_requested or goes to review for your team.
  4. You receive a signed webhook for every status change, or poll GET /sessions/:id.

The document photos never pass through your server.

Authentication

Create an account, then create an API key in the dashboard under Developers once your email address is confirmed. Send the secret key, which starts with sk_live_, as a bearer token. There is no separate test mode: try the flow on the Free package, which includes a monthly allowance of real verifications.

curl https://kyc.baharione.com/api/v1/account -H "Authorization: Bearer sk_live_..."

Keep secret keys on your server. Revoke a key from the dashboard at any time; requests with it fail immediately.

Quickstart

curl https://kyc.baharione.com/api/v1/sessions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "applicant": { "external_id": "client-1042", "email": "[email protected]" },
    "redirect_url": "https://example.com/account/verified",
    "metadata": { "order": "8812" }
  }'
{
  "id": "6f1c0b4e-...",
  "object": "verification_session",
  "livemode": true,
  "status": "created",
  "applicant_id": "0b9a...",
  "url": "https://kyc.baharione.com/v/vs_...",
  "expires_at": "2026-11-21T10:00:00Z",
  ...
}

Send url to the customer, or redirect them to it. The link stays valid until expires_at (7 days by default, expires_in in seconds sets 15 minutes to 30 days).

Errors

{ "error": { "type": "invalid_request_error", "code": "invalid_parameter", "message": "...", "param": "redirect_url", "request_id": "..." } }
400Invalid parameters
401Missing or invalid API key
402insufficient_balance: the prepaid balance does not cover another live verification
403Live mode not enabled for the company, or IP not allowed for the key
404Not found
409Not possible in the current state, for example canceling a submitted session
429Rate limited. Wait for Retry-After seconds
429daily_limit_reached: your account has started its maximum number of verifications for today (UTC). Try again after midnight UTC, or contact support to raise the limit

Send an Idempotency-Key header on POST requests to retry safely. The same key returns the first response for 24 hours.

Sessions

POST/api/v1/sessions
applicantObject, creates a new applicant: external_id (your customer id), email, first_name, last_name, date_of_birth (YYYY-MM-DD), phone, metadata
applicant_idUse an existing applicant instead
redirect_urlHTTPS URL. The customer gets a button back to it after submitting
expires_inSeconds, 900 to 2592000. Default 604800
metadataUp to 20 keys, returned in webhooks
GET/api/v1/sessions/:id

Returns the session. url is present while the customer can still use it (created, started, resubmission_requested), so you can show the same link again.

document_type is set once the customer picks a document, otherwise null. document_country is the two letter issuing country.

nidNational ID card, any country. Front and back
passportPassport, any country. Photo page
driving_licenseDriving licence, any country. Front and back
residence_permitResidence permit, any country. Front and back

Data is read from the document itself: the MRZ (TD1, TD2 and TD3 formats, check digits validated), the barcode (Bangladesh NID and US/Canada AAMVA driving licences) or, failing both, the printed text. It is not checked against any issuing authority or government database. Tamper and screen-capture signals are hints for your reviewers, not proof.

GET/api/v1/sessions?applicant_id=&status=&limit=&starting_after=
POST/api/v1/sessions/:id/cancel

Only before the customer submits.

Applicants

POST/api/v1/applicants
GET/api/v1/applicants/:id
GET/api/v1/applicants?external_id=
DELETE/api/v1/applicants/:id

Deleting removes the applicant's personal data, photos, extracted document data and face template. Sessions stay as empty records for your audit trail.

Statuses

createdLink created, not opened
startedCustomer is taking photos
processingSubmitted, checks running. Usually 2 to 5 seconds
reviewWaiting for a reviewer in your dashboard
approvedFinal
declinedFinal. reason_codes says why
resubmission_requestedPhotos unusable. The same link works again
expired, canceledFinal

Reason codes

GET /api/v1/reason_codes lists every code with an English message. Show your own wording to customers. Codes such as FACE_MISMATCH or DUPLICATE_FACE are for your staff, not for the customer.

DOC_UNSUPPORTEDDocument type or country is not accepted by this workflow
DOC_IMAGE_BLURRYDocument photo is out of focus
DOC_IMAGE_GLAREGlare hides part of the document
DOC_CROPPEDPart of the document is outside the photo
DOC_EXPIREDDocument has expired
DOC_MRZ_INVALIDMRZ check digits do not match
DOC_BARCODE_MISMATCHBarcode data does not match the printed text
DOC_TAMPEREDSigns of editing or a replaced photo
DOC_SCREEN_CAPTUREDocument was photographed from a screen
FACE_NOT_FOUNDNo usable face in the selfie or document
FACE_MISMATCHSelfie does not match the document photo
LIVENESS_FAILEDSelfie appears to be a photo, screen or mask
LIVENESS_UNCERTAINLiveness result is inconclusive
DUPLICATE_FACEThe same face was verified under another applicant
DUPLICATE_DOCUMENTThe same document number was used by another applicant
AGE_BELOW_MINIMUMApplicant is younger than the workflow allows
COUNTRY_NOT_ALLOWEDIssuing country is not accepted by this workflow
MANUAL_DECLINEDeclined by a reviewer
BLOCKLISTEDMatches an entry on the platform blocklist
VIRTUAL_CAMERAThe selfie came from a virtual camera or camera app
DEEPFAKE_SUSPECTEDThe face may be synthetic or swapped
DOC_DATA_MISMATCHData on the front does not match the barcode or MRZ
DOC_DUPLICATE_IMAGEThe same document photo was used in another session
MANUAL_REVIEWSent to a reviewer to decide

DEEPFAKE_SUSPECTED means the selfie or a head turn photo looks AI-generated. The session goes to review; it is never declined on this score alone.

Events

Every webhook event is also stored, so you can catch up on anything a webhook endpoint missed.

GET/api/v1/events?type=&limit=&starting_after=

Newest first. type filters to one event type, for example session.approved.

GET/api/v1/events/:id

Returns one event, in the same format as a webhook delivery.

All list endpoints return { "object": "list", "data": [...], "has_more": true }. limit is 1 to 100 (default 20). To get the next page, pass the id of the last item as starting_after.

Account

GET/api/v1/account

Company name and can_start (also sent as can_start_live for older integrations). Use it to warn your staff before the balance runs out.

Webhook events

Add an endpoint in the dashboard under Webhooks. Each delivery is a POST with a JSON event:

{
  "id": "evt_...",
  "object": "event",
  "type": "session.approved",
  "livemode": true,
  "created_at": "2026-11-14T09:12:44Z",
  "data": { "object": { "id": "6f1c0b4e-...", "object": "verification_session", "status": "approved", "applicant_id": "...", "reason_codes": [], "metadata": { "order": "8812" }, ... } }
}

Types: session.created, session.started, session.submitted, session.processing, session.review, session.approved, session.declined, session.resubmission_requested, session.expired, session.canceled, applicant.deleted.

Respond with any 2xx within 10 seconds. Failed deliveries are retried with backoff for about 3 days. Events can arrive more than once or out of order: use Verify-Event-Id to drop duplicates and read the current status from the API if order matters.

Signatures

Every delivery has a Verify-Signature header: t=<unix seconds>,v1=<hex>. v1 is HMAC-SHA256 of t + "." + raw body with the endpoint's signing secret. Compare in constant time and reject timestamps older than 5 minutes.

// Node.js
const [t, v1] = header.split(",").map((p) => p.split("=")[1]);
const expected = crypto.createHmac("sha256", secret).update(t + "." + rawBody).digest("hex");
const valid = crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected))
  && Math.abs(Date.now() / 1000 - Number(t)) < 300;
// PHP
[$t, $v1] = array_map(fn($p) => explode("=", $p, 2)[1], explode(",", $header));
$expected = hash_hmac("sha256", $t . "." . $rawBody, $secret);
$valid = hash_equals($expected, $v1) && abs(time() - (int)$t) < 300;
# Python
import hmac, hashlib, time
t, v1 = (p.split("=", 1)[1] for p in header.split(","))
expected = hmac.new(secret.encode(), (t + "." + raw_body).encode(), hashlib.sha256).hexdigest()
valid = hmac.compare_digest(expected, v1) and abs(time.time() - int(t)) < 300

Use the raw request body exactly as received. If your framework parses JSON first, the bytes may change and the signature will not match.

SDKs

Official clients for JavaScript/TypeScript and Python. Both have no runtime dependencies, retry safely with an Idempotency-Key, and include the webhook signature check.

JavaScript / TypeScript

Node 20 or newer, Deno, Bun, or any runtime with fetch. Download bahari-kyc-sdk.tgz.

npm install ./bahari-kyc-sdk.tgz
import { KycClient, verifyWebhook } from "@bahari-kyc/sdk";

const kyc = new KycClient({ apiKey: process.env.KYC_SECRET_KEY, baseUrl: "https://kyc.baharione.com" });
const s = await kyc.sessions.create({
  applicant: { external_id: "user_42", email: "[email protected]" },
  redirect_url: "https://example.com/kyc/done",
});
// send the customer to s.url

// webhook, with the raw body
const event = await verifyWebhook(rawBody, req.headers["verify-signature"], process.env.KYC_WEBHOOK_SECRET);
if (event.type === "session.approved") { /* mark the customer verified */ }

Python

Python 3.9 or newer, standard library only. Download bahari-kyc-python.zip.

pip install ./bahari-kyc-python.zip
import os
from bahari_kyc import KycClient, verify_webhook

kyc = KycClient(api_key=os.environ["KYC_SECRET_KEY"], base_url="https://kyc.baharione.com")
s = kyc.sessions.create(applicant={"external_id": "user_42", "email": "[email protected]"},
                        redirect_url="https://example.com/kyc/done")
# send the customer to s["url"]

event = verify_webhook(raw_body, headers["Verify-Signature"], os.environ["KYC_WEBHOOK_SECRET"])
if event["type"] == "session.approved":
    ...  # mark the customer verified

Both also cover applicants, listing and cancelling sessions, events, reason codes and the account. Errors raise KycError with status, code, message and param.

Integrate with any website

Any website or app with a server can use Bahari KYC, in any language. There are three steps:

  1. Create a session on your server when a customer needs to verify, and save its id next to your customer.
  2. Send the customer to the url, by redirect, button or email. Set redirect_url to bring them back to your site when they finish.
  3. Receive the webhook and update the customer when the session is approved or declined.

Do not trust the return to redirect_url as proof: anyone can open that address. Wait for the webhook, or read the session with GET /sessions/:id.

1. Create a session

<?php
// PHP, with curl
$ch = curl_init("https://kyc.baharione.com/api/v1/sessions");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("KYC_SECRET_KEY"),
    "Content-Type: application/json",
    "Idempotency-Key: verify-" . $customerId,
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "applicant" => ["external_id" => (string)$customerId, "email" => $customerEmail],
    "redirect_url" => "https://example.com/account",
  ]),
]);
$session = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 201) {
  throw new Exception($session["error"]["message"] ?? "KYC request failed");
}
// save $session["id"] with the customer, then:
header("Location: " . $session["url"]);
// Node.js 18+
const res = await fetch("https://kyc.baharione.com/api/v1/sessions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KYC_SECRET_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": `verify-${customer.id}`,
  },
  body: JSON.stringify({
    applicant: { external_id: String(customer.id), email: customer.email },
    redirect_url: "https://example.com/account",
  }),
});
const session = await res.json();
if (res.status !== 201) throw new Error(session.error?.message);
// save session.id with the customer, then redirect to session.url
# Python, with requests
import os, requests
r = requests.post(
    "https://kyc.baharione.com/api/v1/sessions",
    headers={
        "Authorization": "Bearer " + os.environ["KYC_SECRET_KEY"],
        "Idempotency-Key": f"verify-{customer.id}",
    },
    json={
        "applicant": {"external_id": str(customer.id), "email": customer.email},
        "redirect_url": "https://example.com/account",
    },
    timeout=15,
)
session = r.json()
if r.status_code != 201:
    raise Exception(session["error"]["message"])
# save session["id"] with the customer, then redirect to session["url"]

If the customer comes back later, read the saved session with GET /sessions/:id. While it is still open, it returns the same url, so you do not need a new session.

2. Receive the webhook

Add your endpoint in the dashboard under Webhooks and keep the signing secret on your server.

<?php
// PHP: webhook.php
$raw = file_get_contents("php://input");
$header = $_SERVER["HTTP_VERIFY_SIGNATURE"] ?? "";
$secret = getenv("KYC_WEBHOOK_SECRET");
$parts = [];
foreach (explode(",", $header) as $p) { [$k, $v] = array_pad(explode("=", $p, 2), 2, ""); $parts[$k] = $v; }
$expected = hash_hmac("sha256", ($parts["t"] ?? "") . "." . $raw, $secret);
if (!hash_equals($expected, $parts["v1"] ?? "") || abs(time() - (int)($parts["t"] ?? 0)) > 300) {
  http_response_code(400); exit;
}
$event = json_decode($raw, true);
$s = $event["data"]["object"];
if ($event["type"] === "session.approved") { /* mark the customer with session $s["id"] verified */ }
if ($event["type"] === "session.declined") { /* $s["reason_codes"] says why */ }
http_response_code(200);
// Node.js with Express
const crypto = require("crypto");
app.post("/kyc/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const raw = req.body.toString("utf8");
  const parts = Object.fromEntries(String(req.get("Verify-Signature") || "").split(",").map((p) => p.split("=")));
  const expected = crypto.createHmac("sha256", process.env.KYC_WEBHOOK_SECRET).update(parts.t + "." + raw).digest("hex");
  const ok = parts.v1 && parts.v1.length === expected.length
    && crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected))
    && Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  if (!ok) return res.sendStatus(400);
  const event = JSON.parse(raw);
  if (event.type === "session.approved") { /* mark the customer verified */ }
  res.sendStatus(200);
});
# Python with Flask
import hmac, hashlib, json, os, time
from flask import Flask, request

app = Flask(__name__)

@app.post("/kyc/webhook")
def kyc_webhook():
    raw = request.get_data(as_text=True)
    parts = dict(p.split("=", 1) for p in request.headers.get("Verify-Signature", "").split(",") if "=" in p)
    expected = hmac.new(os.environ["KYC_WEBHOOK_SECRET"].encode(), (parts.get("t", "") + "." + raw).encode(), hashlib.sha256).hexdigest()
    if not hmac.compare_digest(expected, parts.get("v1", "")) or abs(time.time() - int(parts.get("t", 0))) > 300:
        return "", 400
    event = json.loads(raw)
    if event["type"] == "session.approved":
        pass  # mark the customer verified
    return "", 200

Answer quickly with a 2xx and do slow work afterwards. The same event can arrive twice, so make the handler safe to run again.

Plugins and modules

Ready-made modules connect Bahari KYC to common platforms without writing code. Each one checks webhook signatures, re-checks open sessions on a schedule in case a webhook was missed, and stores only the session id, status and reason codes. Photos and document data stay in Bahari KYC.

WHMCSbahari-kyc-whmcs.zip
WordPress and WooCommercebahari-kyc-wordpress.zip
FOSSBillingbahari-kyc-fossbilling.zip
Blesta (beta)bahari-kyc-blesta.zip
HostBill (beta)bahari-kyc-hostbill.zip
Clientexec (beta)bahari-kyc-clientexec.zip
PrestaShopbahari-kyc-prestashop.zip
Magento 2bahari-kyc-magento.zip
Odoobahari-kyc-odoo.zip
Laravelbahari-kyc-laravel.zip
Express (Node.js)bahari-kyc-express.tgz

For every module you need a secret API key (sk_live_...) from API keys in the dashboard, and a webhook endpoint added under Webhooks with the URL the module shows. Paste the endpoint's signing secret (whsec_...) back into the module.

WHMCS module

For WHMCS 8.x on PHP 7.4 or newer. Download bahari-kyc-whmcs.zip.

Install

  1. Unzip into the WHMCS root. It creates modules/addons/baharikyc/.
  2. Setup, Addon Modules, activate Bahari KYC and give access to the admin roles that should see it.
  3. Paste a secret API key.
  4. In the Bahari KYC dashboard add a webhook endpoint with the URL shown on the module page, and paste its signing secret into the module settings.

What it does

  • Client area page index.php?m=baharikyc where the client starts or continues verification. The status also shows on the client area home.
  • Status box on the admin client profile, with a link to the session in the Bahari KYC dashboard.
  • Optional: block checkout until the client is verified, or only for chosen product groups.
  • Optional: hold module provisioning (create) for unverified clients, so orders can be accepted and paid but not set up.
  • Webhooks update the status immediately. A cron task re-checks open sessions in case a webhook was missed.

The module stores only the session id, status and reason codes per client. Photos and document data stay in Bahari KYC.

WordPress and WooCommerce

For WordPress 6.0 or newer on PHP 7.4 or newer. WooCommerce is optional. Download bahari-kyc-wordpress.zip.

Install

  1. Plugins, Add New, Upload Plugin. Upload the zip and activate it.
  2. Settings, Bahari KYC: paste your secret API key and click Test connection.
  3. Add a webhook endpoint in the dashboard with the URL shown on the settings page (it ends in /wp-json/bahari-kyc/v1/webhook), and paste its signing secret into the settings.
  4. Create a page with the shortcode [bahari_kyc] and choose it as the verification page. With WooCommerce, customers also get an Identity verification tab in My Account.

What it does

  • Signed-in users start or continue verification with one button and see their status.
  • Identity column in the Users list, and a status box on each user profile with a link to the session in the dashboard.
  • Optional (WooCommerce): block checkout until the customer is verified, for all products or chosen categories. Works with the block and classic checkout.
  • Optional (WooCommerce): put orders from unverified customers on hold and move them to Processing when the customer is approved.
  • Optional: declined users can try again.
  • Open sessions are re-checked every hour.

If a security plugin blocks the WordPress REST API, allow the webhook URL.

FOSSBilling module

Download bahari-kyc-fossbilling.zip.

Install

  1. Unzip into the FOSSBilling root. It creates modules/Baharikyc/.
  2. Extensions: activate Bahari KYC. Make sure the FOSSBilling cron is running.
  3. Extensions, Bahari KYC, Settings: paste your secret API key.
  4. Add a webhook endpoint in the dashboard with https://your-fossbilling/baharikyc/webhook, and paste its signing secret into the settings.

What it does

  • Client page at /baharikyc, and a panel on the client dashboard until the client is verified.
  • Status box on the admin client profile with a link to the dashboard, and an admin page for lookups, re-checks and verification links.
  • Optional: require verification at checkout, for all orders or chosen product categories.
  • Optional: hold automatic order activation until the client is verified, then activate after approval. Admins can still activate by hand.
  • Open sessions are re-checked with the FOSSBilling cron.

Blesta plugin Beta

For Blesta 5.x. Download bahari-kyc-blesta.zip. Beta: tested against our API, but not yet on a live Blesta install. Please tell us at support if something does not work.

Install

  1. Unzip into the Blesta root. It creates plugins/bahari_kyc/.
  2. Settings, Company, Plugins, Available: install Bahari KYC.
  3. Click Manage and paste your secret API key.
  4. Add a webhook endpoint in the dashboard with the URL shown on the Manage page (it ends in /plugin/bahari_kyc/webhook/index/), and paste its signing secret.

What it does

  • Identity verification page in the client area, and a dashboard widget until the client is verified.
  • Widget on the staff client profile with the status, reason codes and a dashboard link. Overview under Tools, Bahari KYC.
  • Optional: send unverified clients from checkout to the verification page, for all orders or chosen package groups. Orders placed by staff or through the API are not checked.
  • Optional: hold automatic setup of pending services (they become In Review). After approval they go back to Pending and Blesta sets up the paid ones.
  • Open sessions are re-checked every 10 minutes.

HostBill module Beta

Download bahari-kyc-hostbill.zip. Beta: tested against our API, but not yet on a live HostBill install. Please tell us at support if something does not work.

Install

  1. Unzip into the HostBill root. It creates includes/modules/Other/baharikyc/.
  2. Settings, Modules, Plugins: activate Bahari KYC and paste your secret API key.
  3. Add a webhook endpoint in the dashboard with the URL shown on Extras, Plugins, Bahari KYC, and paste its signing secret into the settings.

What it does

  • Client verify page at index.php?cmd=baharikyc.
  • Admin page with connection test, client lookup, re-check and verification links, and a status box on the client profile.
  • Optional: hold automatic account creation for unverified clients, and run it automatically after approval.
  • Optional: ask logged-in clients to verify before ordering, for all orders or chosen order pages. HostBill has no server-side checkout hook, so use the hold above as the real gate.
  • Open sessions are re-checked every 5 minutes with the HostBill cron.

Clientexec plugin Beta

Download bahari-kyc-clientexec.zip. Beta: tested against our API, but not yet on a live Clientexec install. Please tell us at support if something does not work.

Install

  1. Unzip into the Clientexec root. It creates plugins/snapin/baharikyc/ and plugins/services/baharikycsync/.
  2. Settings, Plugins, Snapins, Bahari KYC: enable it and paste your secret API key.
  3. Add a webhook endpoint in the dashboard with https://your-clientexec/plugins/snapin/baharikyc/webhook.php, and paste its signing secret into the settings.
  4. Settings, Plugins, Services: enable Bahari KYC re-check.

What it does

  • Identity verification page in the client account menu.
  • Admin page under Clients, and an Identity verification tab on each client profile with a link to the dashboard.
  • Optional: hold new packages from unverified clients, for all or chosen product groups. They are set up automatically after approval.
  • Clientexec has no hook to stop checkout, so orders are accepted and held instead.

PrestaShop module

For PrestaShop 8.x. Download bahari-kyc-prestashop.zip.

Install

  1. Modules, Module Manager, Upload a module, and drop the zip.
  2. Click Configure and paste your secret API key.
  3. Add a webhook endpoint in the dashboard with the URL shown on the module page, and paste its signing secret.
  4. Optional: call the cron URL shown on the module page every 15 minutes, or use the Cron tasks manager module.

What it does

  • Identity verification page under My account.
  • Optional: require verification before checkout, for all products or chosen categories (subcategories included).
  • Optional: put new orders from unverified customers on Awaiting identity verification. They go back to their previous status on approval.
  • Status card on the admin customer and order pages, and verification links you can send, also to guests.

Magento 2 module

For Magento Open Source or Adobe Commerce 2.4.x on PHP 8.1 or newer. Download bahari-kyc-magento.zip.

Install

  1. Unzip into the Magento root. It creates app/code/Bahari/Kyc.
  2. Run the commands below. In production mode also run setup:di:compile and setup:static-content:deploy.
  3. Stores, Configuration, Customers, Bahari KYC: paste your secret API key.
  4. Add a webhook endpoint in the dashboard with https://your-store/baharikyc/webhook, and paste its signing secret. Make sure Magento cron is running.
bin/magento module:enable Bahari_Kyc
bin/magento setup:upgrade
bin/magento cache:flush

What it does

  • Identity verification in My Account, at /baharikyc/verify.
  • Optional: require verification to place orders, for all products or chosen categories. This also applies to orders placed through the API.
  • Optional: hold new orders from unverified customers and release them on approval.
  • Identity verification tab on the admin customer page, a status block on the order page, and Customers, Identity verification for re-checks and links. Also bin/magento bahari-kyc:sync.

Odoo addon

For Odoo 17. Download bahari-kyc-odoo.zip. No extra Python packages are needed.

Install

  1. Copy bahari_kyc, bahari_kyc_sale and bahari_kyc_website_sale into your addons path and restart Odoo.
  2. Apps, Update Apps List, find Bahari KYC and activate it. The Sales and eCommerce parts install themselves when those apps are installed.
  3. Settings, Bahari KYC: paste your secret API key and click Test connection.
  4. Add a webhook endpoint in the dashboard with https://your-odoo/bahari_kyc/webhook, and paste its signing secret. Make sure web.base.url is your public https address.

What it does

  • Customers verify from the portal at /my/verification.
  • Identity verification tab on each contact with the status, reason codes, a dashboard link and a Refresh button, plus list filters.
  • Optional: the online shop asks unverified customers to verify before paying.
  • Optional: staff cannot confirm quotations for unverified customers.
  • Open sessions are re-checked every 15 minutes.

Laravel package

For Laravel 10, 11 and 12 on PHP 8.1 or newer. Download bahari-kyc-laravel.zip and unzip it into packages/bahari-kyc-laravel in your app.

composer config repositories.bahari-kyc path packages/bahari-kyc-laravel
composer require bahari/kyc-laravel:@dev
php artisan vendor:publish --tag=kyc-config
php artisan vendor:publish --tag=kyc-migrations
php artisan migrate

Add BAHARI_KYC_API_KEY and BAHARI_KYC_WEBHOOK_SECRET to .env, and add https://your-app/kyc/webhook as a webhook endpoint in the dashboard.

// app/Models/User.php
use Bahari\Kyc\Concerns\HasKycVerification;
class User extends Authenticatable { use HasKycVerification; }

// routes/web.php: unverified users are sent to /kyc/start
Route::middleware(['auth', 'kyc.verified'])->get('/withdraw', WithdrawController::class);

// react to results
Event::listen(fn (\Bahari\Kyc\Events\VerificationApproved $e) => $e->user?->notify(new IdentityVerified()));

// routes/console.php: re-check open sessions in case a webhook was missed
Schedule::command('kyc:sync')->everyFifteenMinutes();

The package checks every webhook signature, saves the status on the user and fires VerificationApproved, VerificationDeclined and VerificationStatusChanged. Kyc::startVerification($user) returns the link to send the user to.

Express middleware

For Express 4 or 5 on Node 20 or newer. Download bahari-kyc-express.tgz and the JavaScript SDK.

npm install ./bahari-kyc-sdk.tgz ./bahari-kyc-express.tgz
import express from "express";
import { KycClient, webhook, requireVerified, startVerification } from "@bahari-kyc/express";

const app = express();
const kyc = new KycClient({ apiKey: process.env.BAHARI_KYC_API_KEY, baseUrl: "https://kyc.baharione.com" });

// mount the webhook before express.json()
app.post("/kyc/webhook", webhook({
  secret: process.env.BAHARI_KYC_WEBHOOK_SECRET,
  onEvent: async (event) => {
    if (event.type.startsWith("session.")) await saveStatus(event.data.object.id, event.data.object.status);
  },
}));
app.use(express.json());

app.get("/kyc/start", requireLogin, async (req, res) => {
  const { url, session } = await startVerification({ client: kyc, externalId: String(req.user.id), email: req.user.email,
    current: { sessionId: req.user.kycSessionId, status: req.user.kycStatus } });
  await saveSession(req.user.id, session.id, session.status);
  res.redirect(url);
});

app.get("/withdraw", requireLogin, requireVerified({ getStatus: (u) => u.kycStatus }), withdrawHandler);

webhook() answers 401 to a bad signature and calls onEvent for valid ones. requireVerified() sends anyone who is not approved to /kyc/start, or answers 403 to JSON requests. startVerification() reuses an open link instead of creating a duplicate.

Your own domain

On packages that include it, verification links can use your own address, for example https://verify.yourcompany.com/v/... instead of https://kyc.baharione.com/v/.... Customers then see your domain from start to finish.

  1. In the dashboard open Branding and enter a subdomain such as verify.yourcompany.com. Use a subdomain, not your main domain, so your website keeps working.
  2. Add the two DNS records the dashboard shows where your domain's DNS is managed. If your DNS is on Cloudflare, set the record to DNS only (grey cloud).
  3. We check every minute. When the records are found, we set up the security certificate and the domain becomes active.

Once the domain is active, the url of new and open sessions uses it automatically. You do not need to change your code. The API itself stays at https://kyc.baharione.com/api/v1.

One domain per account. Remove it in Branding to go back to the standard links.

Billing

Verifications are prepaid in US dollars. The price is charged once per session when the customer submits; resubmissions on the same session are free. The price follows your volume in the current calendar month (UTC), as listed on the pricing page. When the balance does not cover another verification, POST /sessions returns 402 insufficient_balance. Sessions already created keep working because their cost is reserved at creation. See pricing.

Invoices and receipts

Every top-up gets a receipt, every package payment an invoice, and refunds or corrections a credit note. Each is a PDF.

  • Find them in the dashboard under Billing, Invoices. Open one to preview it, download it as a PDF, or download a ZIP of all documents that match the filter.
  • They are emailed with their PDF to team members who keep Billing emails turned on in their account, and to the billing email, if you set one.
  • Package invoices show the package period and any discount.

Billing details

Under Billing, Details you can set the legal name, billing address, tax or VAT ID and billing email printed in the "Billed to" block. Empty fields fall back to your business profile. New documents use the new details. Documents already issued keep the details they were issued with.

Monthly statements

Early each month a statement for the previous month is available under Billing, Invoices, with the opening and closing balance and every entry. It is also emailed to members who keep the Monthly summary turned on in their account notification settings.