1. Objective
CBOS creates the Demat account for the customer. On success, the system receives a client_id and dp_id (Depository Participant ID). These two identifiers mark the customer as having a live trading account.
STP vs Non-STP
For STP (Straight-Through Processing) leads, CBOS is called immediately after eSign completes. For Non-STP leads, CBOS is called ONLY after a human verifier approves the application.
2. Preconditions
| Path |
Required State |
Additional Conditions |
| STP |
lead.state = ESIGN_DONE |
eSign completed successfully, signed AOF document present |
| Non-STP |
lead.state = NON_STP_REVIEW |
Verifier has approved the application (verifier approval flag set) |
Non-STP Gate
Non-STP leads MUST NOT proceed to CBOS until the verifier has explicitly approved. The system returns BE_ACC_PENDING_VERIFIER if a Non-STP lead attempts account creation without verifier approval.
3. STP vs Non-STP Timing
| Attribute |
STP |
Non-STP |
| When CBOS is called |
Immediately after eSign completes |
ONLY after verifier approves |
| Trigger state |
ESIGN_DONE |
NON_STP_REVIEW + verifier approval |
| Customer wait time |
Real-time (seconds) |
Hours to days (depends on verifier queue) |
| Retry on failure |
CS Journey retry every 15 minutes |
CS Journey retry every 15 minutes (after verifier approval) |
4. CBOS Payload
The CBOS payload is assembled from data collected across all prior stages. It spans 10 categories:
| # |
Category |
Source Stage(s) |
Key Fields |
| 1 |
Identity |
Stage 4 (PAN) |
PAN, full name, DOB, gender |
| 2 |
Contact |
Stage 1 (Mobile), Stage 3 (Email) |
Mobile number, email address |
| 3 |
Address |
Stage 5 (Aadhaar/DigiLocker), Stage 9 (Personal Details) |
Permanent address, correspondence address, pincode, city, state |
| 4 |
Bank |
Stage 6 (Bank Verification) |
Bank account number, IFSC, bank name, branch, MICR |
| 5 |
KYC |
Stage 2 (KRA), Stage 5 (Aadhaar) |
KRA status, Aadhaar reference, KYC verification mode |
| 6 |
Personal |
Stage 9 (Personal Details) |
Occupation, income, marital status, father/mother name, political exposure |
| 7 |
Nominee |
Stage 9 (Nominee Details) |
Nominee name, relationship, DOB, address, percentage |
| 8 |
Products |
Stage 11 (Final Validation) |
Segments selected (Equity, F&O, Currency, Commodity), product type |
| 9 |
Signed Documents |
Stage 13 (eSign) |
Signed AOF document reference, eSign transaction ID |
| 10 |
Consents & Application |
All stages |
All consent records, application reference, STP flag, journey path |
Payload Assembly
The payload is built by BuildCbosPayloadAsync which aggregates data from all prior entities: leads, pan_verifications, aadhaar_verifications, bank_verifications, personal_details, document_uploads, consents, and esign_transactions.
5. CBOS Response Handling
Response Scenarios
1
Success with both IDs: CBOS returns both client_id and dp_id → Transition to ACCOUNT_CREATED immediately. Store both IDs on account_activations.
2
Success with client_id only: CBOS returns client_id but no dp_id → Store client_id. Start polling CBOS every 15 minutes for up to 24 hours to retrieve dp_id.
3
Failure: CBOS returns error → Enter CS Journey retry cycle. Retry every 15 minutes. After 3 consecutive failures, raise a P0 alert.
4
Duplicate client_id: CBOS returns a client_id that already exists in our system → Raise P0 alert immediately. Do not overwrite existing records.
P0 Escalation
Both "3 consecutive CBOS failures" and "duplicate client_id" scenarios trigger P0 alerts. These require immediate engineering and ops investigation.
6. Backend Validations
| # |
Validation |
Action on Failure |
| 1 |
Payload completeness: All 10 categories must have required fields populated |
Block CBOS call, log missing fields, return error |
| 2 |
Signed AOF present: eSign transaction must be complete with signed document reference |
Block CBOS call, redirect to eSign re-attempt |
| 3 |
Non-STP timing: Non-STP leads must have verifier approval before CBOS call |
Return BE_ACC_PENDING_VERIFIER, do not call CBOS |
| 4 |
CBOS unavailable: CBOS service is down or times out |
CS Journey retry entry, retry every 15 minutes |
| 5 |
dp_id polling timeout: 24 hours elapsed without receiving dp_id |
Raise P1 alert, mark lead for manual intervention |
7. Existing SP Mapping
Reference Only
These stored procedures are from the old system. The new backend reimplements this logic in .NET 8 services. Listed here for migration reference and validation comparison.
| Old Stored Procedure |
Purpose |
New Backend Equivalent |
USP_CLIENT_GENERATECLIENTCODE_SJET (6 variants) |
Generate client code via CBOS, 6 different entry points for different flows |
AccountCreationService.CreateAccountAsync |
USP_CLIENT_GENERATEUCID_SJET |
Generate UCID (Unique Client Identifier) after client code generation |
AccountCreationService.CreateAccountAsync (combined flow) |
USP_PUSH_TRADINGDETAILS_SJET |
Push trading/segment details to downstream systems |
DownstreamEventService.PublishDownstreamUpdatesAsync |
8. Error Codes
| Error Code |
When Raised |
Blocking? |
Resolution |
CS_ACCOUNT_CREATION_FAIL |
CBOS call fails (network, timeout, CBOS error response) |
Yes — retried via CS Journey |
Auto-retry every 15 min. P0 after 3 failures. |
BE_ACC_PENDING_VERIFIER |
Non-STP lead attempts account creation without verifier approval |
Yes — blocks until approval |
Wait for verifier to approve in ops dashboard |
9. Exit State
| Field |
Value |
lead.state |
ACCOUNT_CREATED |
client_id |
Assigned by CBOS (e.g., MO12345) |
dp_id |
Assigned by CBOS (Depository Participant ID) |
account_created_at |
UTC timestamp of successful CBOS response |
cbos_response_code |
Raw CBOS response code for audit trail |
10. Vendor Calls
| Vendor / System |
Call Type |
Purpose |
| CBOS |
Sync (blocking) |
Create Demat account, receive client_id + dp_id |
| CleverTap |
Async |
Push account creation event for analytics |
| Zoho CRM |
Async |
Update lead/deal with account details |
| Datalake |
Async |
Publish account creation payload for compliance (7-year retention) |
| Appsflyer |
Async |
Push conversion event for attribution tracking |
11. Database Tables
| Table / Entity |
Operation |
Key Columns |
account_activations |
WRITE |
LeadId, ClientId, DpId, CbosResponseCode, AccountCreatedAt, CbosPayloadJson |
leads |
WRITE |
State = ACCOUNT_CREATED, ClientId, DpId |
12. Notes
File Storage
All document storage (signed AOF, supporting documents) uses a configured drive path resolved via document_path_info table. No S3 or cloud storage — all files on configured local/network drive.
CBOS Simulated Mode
For dev/test environments, CBOS has a simulated mode that generates mock client_id (format: MO + sequence) and dp_id (format: IN + sequence) without calling the real CBOS API. Controlled via application_config feature flag.