Skip to content
API documentation

KYC sessions

Create and manage DigiLocker consent sessions using OAuth 2.0 + PKCE handled by KYC Karo.

A KYC session represents one customer's DigiLocker consent. It moves through these statuses:

StatusMeaning
createdLink created; the customer hasn't finished DigiLocker consent yet.
authorizedThe customer approved. You can fetch documents. The session is billed now.
failedThe customer denied access, or DigiLocker returned an error (see error).
expiredThe link wasn't used in time (30 minutes by default).
revokedYou revoked the DigiLocker tokens.

After consent, the customer is sent to your redirect_url with ?session_id=…&reference_id=…&status=authorized. Don't rely on the redirect alone — confirm the status with GET /sessions/{id} or the webhook.

Use req_doctype[] to request specific documents, for example PANCR for PAN or DRVLC for a driving licence. See the list of document codes.

POST /api/v1/sessions

Create a consent session. Redirect your user to authorization_url. Charged once the user authorizes.

Billing: KYC consent session (DigiLocker authorization) (free in test mode)

Parameters

NameDescription
reference_idstring, optional — your own customer / order id
redirect_urlurl, optional — where we send the user afterwards (?session_id=&status=)
purposekyc | verification | compliance | availing_services | educational
req_doctype[]optional — DigiLocker doctypes to request, e.g. PANCR, DRVLC
dl_flowsignin (default) | signup — send new users straight to DigiLocker sign-up
verified_mobile10 digits, optional — skips mobile OTP on sign-up
consent_valid_tillunix timestamp, optional — consent expiry

Request

curl -X POST "https://kyckaro.in/api/v1/sessions" \
  -H "Authorization: Bearer kk_test_xxxxxxxx" \
  -H "Accept: application/json" \
  -d "reference_id=CUST-1001" \
  -d "redirect_url=https://yourapp.com/kyc/complete" \
  -d "purpose=kyc" \
  -d "req_doctype[]=PANCR"

Response 201

{
    "success": true,
    "data": {
        "id": "3f6c2a1e-8b1d-4c55-9f0e-2d6a7b9c1e44",
        "object": "kyc_session",
        "environment": "test",
        "status": "created",
        "reference_id": "CUST-1001",
        "authorization_url": "https://kyckaro.in/kyc/3f6c2a1e-8b1d-4c55-9f0e-2d6a7b9c1e44",
        "redirect_url": "https://yourapp.com/kyc/complete",
        "options": {
            "purpose": "kyc",
            "req_doctype": [
                "PANCR"
            ]
        },
        "digilocker_id": null,
        "user": null,
        "scope": [],
        "error": null,
        "charged": 0,
        "expires_at": "2026-11-19T10:30:00+05:30",
        "authorized_at": null,
        "created_at": "2026-11-19T10:00:00+05:30"
    },
    "meta": {
        "request_id": "9b1f…",
        "charged": 0
    }
}

GET /api/v1/sessions

List sessions. Filters: status, reference_id, per_page. Free.

Request

curl "https://kyckaro.in/api/v1/sessions" \
  -H "Authorization: Bearer kk_test_xxxxxxxx" \
  -H "Accept: application/json"

GET /api/v1/sessions/{id}

Session status and DigiLocker user (name, DOB, gender, verified mobile, masked Aadhaar). Free.

Request

curl "https://kyckaro.in/api/v1/sessions/3f6c2a1e-8b1d-4c55-9f0e-2d6a7b9c1e44" \
  -H "Authorization: Bearer kk_test_xxxxxxxx" \
  -H "Accept: application/json"

Response 200

{
    "success": true,
    "data": {
        "id": "3f6c2a1e-8b1d-4c55-9f0e-2d6a7b9c1e44",
        "object": "kyc_session",
        "environment": "test",
        "status": "authorized",
        "reference_id": "CUST-1001",
        "authorization_url": null,
        "redirect_url": "https://yourapp.com/kyc/complete",
        "options": {
            "purpose": "kyc",
            "req_doctype": [
                "PANCR"
            ]
        },
        "digilocker_id": "123e4567-e89b-12d3-a456-426655440000",
        "user": {
            "name": "Sunil Kumar",
            "dob": "31121970",
            "gender": "M",
            "eaadhaar": "Y",
            "mobile": "9876543210",
            "uid": "xxxxxxxx1234"
        },
        "scope": [
            "files.issueddocs",
            "userdetails"
        ],
        "error": null,
        "charged": 10,
        "expires_at": "2026-11-19T10:30:00+05:30",
        "authorized_at": "2026-11-19T10:02:41+05:30",
        "created_at": "2026-11-19T10:00:00+05:30"
    },
    "meta": {
        "request_id": "9b1f…",
        "charged": 0
    }
}

POST /api/v1/sessions/{id}/revoke

Revoke the DigiLocker access and refresh tokens (sign the user out).

Billing: Revoke DigiLocker token (free in test mode)

Request

curl -X POST "https://kyckaro.in/api/v1/sessions/3f6c2a1e-8b1d-4c55-9f0e-2d6a7b9c1e44/revoke" \
  -H "Authorization: Bearer kk_test_xxxxxxxx" \
  -H "Accept: application/json"