Skip to main content

Base URL

https://api.casparser.in

Authentication

All API requests require an x-api-key header:
curl -X POST https://api.casparser.in/v4/smart/parse \
  -H "x-api-key: YOUR_API_KEY" \
  -F "file=@cas.pdf" \
  -F "password=ABCDE1234F"
Sandbox: Use sandbox-with-json-responses for testing without consuming credits.

Access Tokens

For frontend/SDK use, generate short-lived tokens from your backend:
response = requests.post(
    "https://api.casparser.in/v1/token",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={"expiry_minutes": 30}
)
token = response.json()["access_token"]  # at_xxx
Access tokens (at_ prefix) can replace API keys on all /v4/* endpoints.

Endpoints

Parsing

MethodEndpointDescription
POST/v4/smart/parseAuto-detect CAS type and parse
POST/v4/cdsl/parseParse CDSL eCAS
POST/v4/nsdl/parseParse NSDL eCAS
POST/v4/cams_kfintech/parseParse CAMS/KFintech CAS
POST/v4/contract_note/parseParse broker contract notes

Data Retrieval

MethodEndpointDescription
POST/v4/kfintech/generateRequest CAS via KFintech email
POST/v4/cdsl/fetchCDSL OTP request (Step 1)
POST/v4/cdsl/fetch/{session_id}/verifyCDSL OTP verify (Step 2)

Email Import

MethodEndpointDescription
POST/v4/inbox/connectGet Gmail OAuth URL
POST/v4/inbox/statusCheck connection status
POST/v4/inbox/casList/parse CAS from inbox
POST/v4/inbox/disconnectRevoke access

Account

MethodEndpointDescription
POST/v1/creditsCheck remaining credits
POST/v1/usageGet usage logs
POST/v1/usage/summaryGet aggregated usage
POST/v1/tokenGenerate access token
POST/v1/token/verifyVerify access token

Response Format

{
  "status": "success",
  "cas_type": "cdsl",
  "investor": {
    "name": "John Doe",
    "pan": "ABCDE1234F"
  },
  "summary": {
    "total_value": 2500000.00,
    "as_on_date": "2024-01-15"
  },
  "demat_accounts": [...],
  "mutual_funds": [...]
}

Error Handling

{
  "status": "failed",
  "msg": "Invalid password for PDF"
}
StatusMeaningRetry?
400Bad requestNo — fix request
401Invalid API keyNo — check key
402Insufficient creditsNo — upgrade plan
500Server errorYes — exponential backoff

Request ID

Every response includes X-Request-ID:
X-Request-ID: req_2xYz7KpL8mN3Ab
Include this when contacting support.