c2bspan c2bspan API
SPEC: 2026-11-16.active
Ctrl K
Get API Key

c2bspan REST API Specification

The c2bspan REST API empowers B2B aggregators, distributor networks, fintech applications, and independent retailer systems to issue New PAN cards and process PAN Corrections via Religare's authorized NSDL E-KYC infrastructure.

Build with AI

Download the full guide, or hand a ready prompt to your AI assistant. The key never goes in the prompt.

Full API guide

Authentication, every endpoint, webhooks and error codes in one professional PDF.

Download PDF

AI integration prompt

Reads the key from C2B_API_KEY only. It never asks for the key or writes it into code.

Copy and open in

View the prompt
c2bspan-ai-prompt.txt
Zero Aadhaar Storage Architecture
To guarantee strict statutory compliance with the Aadhaar Act and DPDP Act, your servers never handle or store user Aadhaar numbers, biometric fingerprints, or OTPs. Your server requests a short-lived session, and your end-user completes the application directly on the secure NSDL gateway.

High-Level Lifecycle Flow

  1. Session Initiation: Your backend dispatches POST /api/v1/pan/start with optional sub-retailer ID and firm branding.
  2. Launch URL Handoff: c2bspan returns a secure, single-use launchUrl valid for exactly 120 seconds.
  3. NSDL Portal Completion: The retailer opens the URL in a browser or embedded webview. The applicant completes e-KYC (Aadhaar OTP or biometric scan).
  4. Atomic Wallet Hold: When the application begins, Religare triggers a balance check, and c2bspan holds ₹107.00 in integer paise.
  5. Automated Callback: Upon final clearance or reversal, c2bspan updates ledger records and notifies your server via an HMAC-signed webhook.

Authentication & Permissions

Every request to the c2bspan REST API must be authenticated using an API Access Token. Unauthenticated calls are rejected with HTTP 401 Unauthorized.

Supply your API token in either of the standard request headers:

x-api-key: pk_live_38bf8c991a04...
Authorization: Bearer pk_live_38bf8c991a04...

Granular Token Scopes (Least Privilege)

In accordance with default-deny security principles, API tokens must be created with explicit scopes. Wildcard scopes (*) are strictly prohibited.

Scope Identifier Granted Capability Applicable Routes
wallet:read Retrieve balance, held reserves, and available funds GET /api/v1/wallet
pan.new:create Initiate new PAN card application sessions POST /api/v1/pan/start
pan.corr:create Initiate PAN change or correction sessions POST /api/v1/pan/start
pan.status:read Query application statuses, ACK numbers, and allotted PANs GET /api/v1/transactions/*

IP Whitelisting & Subnets

For enterprise security, every API key can be restricted to specific originating IP addresses or CIDR subnets. Requests from unlisted IPs receive HTTP 403 Forbidden.

  • IPv4 Single Host: 103.21.244.1
  • IPv4 CIDR Subnet: 192.168.1.0/24 (matches any IP within that /24)
  • IPv6 Single Host: 2001:db8::1
  • IPv6 CIDR Subnet: 2001:db8::/32

Manage allowed IPs dynamically in the Retailer Portal under API Settings → Allowed IPs with WhatsApp OTP step-up authentication.

Rate Limiting

All API keys are governed by a token-bucket rate limiter set to 120 requests per minute. If exceeded, the server returns HTTP 429 Too Many Requests with a Retry-After header in seconds.

GET /api/v1/wallet scope: wallet:read

Retrieve the current wallet balance, held reserves for in-flight applications, and available funds.

Response Fields

FieldTypeDescription
retailerIdstring Your primary c2bspan account identifier (e.g. C2B81738).
balancenumber (INR) Total funded balance in Indian Rupees.
heldnumber (INR) Total funds temporarily locked for pending NSDL application sessions.
availablenumber (INR) Liquid balance available for new applications (balance - held).
POST /api/v1/pan/start scope: pan.new:create | pan.corr:create

Requests a fresh, authenticated session on Religare's E-PAN NSDL gateway and generates a one-time launch URL.

Request Body Parameters

FieldTypeDescription
retailerId string • max 40 optional Your internal sub-retailer ID (e.g. SHOP102). Mapped upstream as C2B81738_SHOP102. The fee is charged to your parent wallet.
firmName string • max 50 optional Custom firm or shop title displayed on the NSDL gateway header. Overrides account default.
logoUrl https URL • max 70 optional HTTPS link to your logo image displayed on the Religare form. Must use HTTPS.
copyright string • max 70 optional Footer copyright line displayed on the NSDL interface.
Launch URL Expiration Rule
The returned launchUrl is valid for exactly 120 seconds and can be accessed only once. If your retailer closes or refreshes the tab before initiating, call this endpoint again to receive a fresh URL.
GET /api/v1/transactions scope: pan.status:read

List historical PAN applications with optional filtering by status and sub-retailer.

Query Parameters

ParameterTypeDescription
limitinteger • 1–100 Maximum number of records to return (default: 20).
statusstring Filter by state: Held, Pending, Success, Failure, Reversal.
retailerIdstring Filter by your custom sub-retailer ID.
GET /api/v1/transactions/:id scope: pan.status:read

Retrieve full details for a single application by its internal ID, requestId, or txnId. Adding ?refresh=1 instructs the server to perform an active upstream status check with Religare before responding.

GET /api/v1/pan/allotment/:orderId pan.status:read

Retrieve authoritative PAN card allotment details, 15-digit acknowledgement number, applicant name, and e-PAN status once cleared by NSDL.

Path Parameters

FieldTypeDescription
orderId string • required The unique order identifier returned when initiating the session.

Response Structure

{ "status": "Success", "orderId": "ORD_1731678901234", "ackNo": "881029384756123", "panNumber": "ABCDE1234F", "applicantName": "KUMAR S", "ePanAvailable": true }

Webhooks & HMAC Signatures

When Religare and NSDL update an application's status, c2bspan dispatches a real-time HTTP POST event to your configured callback_url.

Cryptographic Verification (`X-Signature`)

Every webhook includes the X-Signature header. This is a computed HMAC-SHA256 hash of the exact, raw request payload, using your unique callback_secret as the key.

Timing-Safe Comparison Mandatory
Always verify the signature against the raw unparsed request body using a timing-safe equality check (e.g., crypto.timingSafeEqual in Node.js) to prevent timing attacks.

Replay Defense & Idempotency

  • Webhooks require a 2xx response within 10 seconds.
  • If your server fails to respond, c2bspan retries automatically after 5 seconds and 30 seconds.
  • Network retries may cause duplicate deliveries. Deduplicate incoming events using the unique pair txnId + status.

Retailer Network Integration

Multi-tenant architecture allowing corporate aggregators, distributors, and fintech platforms to route user applications for hundreds of sub-agents under a single parent wallet.

Pass your agent's unique ID as retailerId when initiating POST /api/v1/pan/start. c2bspan tags all ledger events, transaction receipts, and Religare logs with your scoped identifier (e.g., C2B81738_SHOP102).

  • Unified Wallet Accounting: All fees are debited from your master distributor wallet. Sub-retailers do not require separate gateway accounts.
  • Reporting & Reconciliation: Filter transactions by sub-retailer ID using GET /api/v1/pan/transactions?retailerId=SHOP102.

Firm Name & Co-Branding

Custom branding enables your retail network to present their localized trade identity to users during the NSDL e-KYC handoff.

Provide the firmName field (up to 60 characters) during session creation:

"firmName": "Sri Cyber Express Services"

The applicant sees the registered firm name in the top authorization header of the official e-KYC portal, reinforcing consumer trust.

Status State Machine

StatusLifecycle StageWallet Impact
Held Application started on NSDL; session active. Fee held in wallet (₹107.00 locked)
Pending NSDL is processing the e-KYC submission. Fee remains held
Success Application completed. ackNo is issued. Held converted to permanent debit
Failure Application rejected or canceled by user. Fee released back to available balance
Reversal Religare reversed an earlier transaction. Full refund credited to wallet
Expired Session started but user did not finish form. Fee released back to available balance

Error Code Dictionary

The API uses standard HTTP status codes combined with explicit, machine-readable error codes and human-friendly remediation guidance.

HTTP StatusError CodeMeaning & Action
400 Bad Request E_INVALID_PAYLOAD Missing or invalid request parameter. Review validation messages.
401 Unauthorized E_UNAUTHORIZED Missing or invalid API token. Pass token in x-api-key or Authorization: Bearer.
403 Forbidden E_INSUFFICIENT_SCOPE Token lacks required permission (e.g. attempting to create PAN without pan.new:create).
403 Forbidden E_IP_NOT_ALLOWED Client IP is not registered in your account allowlist. Add the IP with OTP verification in portal.
402 Payment Required E_INSUFFICIENT_FUNDS Available wallet balance is less than application fee (₹107.00). Top up wallet in retailer portal.
404 Not Found E_NOT_FOUND Transaction or order ID not found in your account records.
429 Too Many Requests E_RATE_LIMITED Request limit (120 req/min) exceeded. Pause and retry using Retry-After header value.
502 Bad Gateway E_RELIGARE_UNAVAILABLE Upstream NSDL/Religare server timed out or is temporarily unreachable. Retry with backoff.