Skip to main content

Overview

CAS Parser extracts structured data from Consolidated Account Statement (CAS) PDFs issued by Indian depositories and registrars.

Supported CAS types

SourceFormatPasswordCoverage
CDSLeCAS from myeasicm.comEncrypted PANAll holdings (CDSL + NSDL)
NSDLeCAS from nsdlcas.nsdl.comEncrypted PANAll holdings (NSDL + CDSL)
CAMSCAS from camsonline.comPAN numberMutual funds only
KFintechCAS from kfintech.comPAN numberMutual funds only
Use /v4/smart/parse — it auto-detects the CAS type and applies the correct parser.
Cross-depository coverage: CDSL and NSDL eCAS statements contain holdings from both depositories (CDSL + NSDL), not just the issuing depository. This includes demat and non-demat assets across all accounts.

Parse a PDF file

import requests

response = requests.post(
    "https://api.casparser.in/v4/smart/parse",
    headers={"x-api-key": "YOUR_API_KEY"},
    files={"file": open("cas.pdf", "rb")},
    data={"password": "ABCDE1234F"}
)

data = response.json()

Parse from URL

If your CAS PDF is hosted online:
response = requests.post(
    "https://api.casparser.in/v4/smart/parse",
    headers={
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={
        "pdf_url": "https://example.com/cas.pdf",
        "password": "ABCDE1234F"
    }
)

Response format

All CAS types return a unified JSON structure:
{
  "status": "success",
  "cas_type": "cdsl",
  "investor": {
    "name": "John Doe",
    "email": "john@example.com",
    "pan": "ABCDE1234F",
    "mobile": "9876543210"
  },
  "summary": {
    "total_value": 2500000.00,
    "as_on_date": "2024-01-15",
    "accounts": {
      "demat_accounts": 2,
      "mutual_fund_folios": 5,
      "insurance_policies": 1,
      "nps_accounts": 1
    }
  },
  "demat_accounts": [
    {
      "dp_id": "12345678",
      "dp_name": "HDFC Bank",
      "client_id": "12345678901234",
      "total_value": 1500000.00,
      "equities": [...],
      "corporate_bonds": [...],
      "mutual_funds": [...],
      "aifs": [...]
    }
  ],
  "mutual_funds": [
    {
      "folio": "1234567890",
      "amc": "HDFC Mutual Fund",
      "schemes": [...]
    }
  ],
  "insurance": [...],
  "nps": [...]
}

Asset classes extracted

CAS Parser extracts 9 asset classes from your CAS:
Asset ClassSourceFields
EquitiesCDSL, NSDLISIN, name, units, value
Mutual Funds (Demat)CDSL, NSDLISIN, scheme, units, NAV
Mutual Funds (Non-Demat)CAMS, KFintechFolio, scheme, units, NAV, transactions
Corporate BondsCDSL, NSDLISIN, issuer, coupon, maturity
G-SecsCDSL, NSDLISIN, name, units, value
AIFsCDSL, NSDLISIN, fund, units, value
InsuranceCDSL, NSDLPolicy, provider, sum assured
NPSCDSL, NSDLPRAN, tier, fund, units
ETFsCDSL, NSDLISIN, name, units, value

Password requirements

CAS TypePassword FormatExample
CDSL eCASEncrypted PANAXXXX1234X (varies)
NSDL eCASEncrypted PANAXXXX1234X (varies)
CAMS CASPlain PANABCDE1234F
KFintech CASPlain PANABCDE1234F
For CDSL and NSDL eCAS, the password is an encrypted version of the PAN. It varies by statement. If parsing fails, check the email that delivered the CAS for the correct password.

Error handling

response = requests.post(...)
data = response.json()

if data.get("status") == "failed":
    error = data.get("msg")
    # Common errors:
    # - "Invalid password" — wrong PAN/encryption
    # - "Invalid PDF" — corrupted or scanned file
    # - "Unsupported format" — not a CAS file

Next steps