Skip to content

Parse CAS

Send a CAS PDF from CAMS, KFintech, or an NSDL e-CAS (which also covers CDSL demat accounts). The parser is deterministic — no model reads the statement — and returns a snapshot with holdings, units, NAV, cost and transactions.

POST https://api.portfoliointel.co.in/api/v1/parse

X-API-Key: sk_… or Authorization: Bearer sk_…. Both sk_test_ and sk_live_ keys can parse real PDFs here; each parse spends credits. No key yet? An agent can register one itself.

Client typeAuth model
Claude Desktop / ChatGPTOAuth 2.1 + PKCE
Claude Code / Cursor / CopilotBearer token in config
REST clientsBearer token or X-API-Key
Terminal window
curl -X POST https://api.portfoliointel.co.in/api/v1/parse \
-H "X-API-Key: $PI_KEY" \
-F "file=@cas.pdf" \
-F "password=$CAS_PASSWORD"

Multipart (file) or JSON — send exactly one of file, pdf_base64 or pdf_url.

FieldTypeNotes
filefileMultipart only.
pdf_base64stringJSON only.
pdf_urlstringPublic HTTPS URL; the service fetches it.
passwordstringFor password-protected statements (usually the PAN in capitals).
pi_redactionbooleanDefault true: investor_name is returned as "REDACTED". Send false to receive it.

Bundled sample statements live on the web host and need a test key. They cost nothing and need no PDF.

Terminal window
curl -s -X POST https://portfoliointel.co.in/api/v1/parse \
-H "X-API-Key: sk_test_…" \
-H "Content-Type: application/json" \
-d '{"pdf_ref":"sample_cams_2024"}'

pdf_ref is sample_cams_2024 or sample_kfintech_2024. It is only accepted on portfoliointel.co.in; the api. host answers it with MISSING_PDF. On that sandbox host a test key can’t upload a real file (SANDBOX_PDF_REF_REQUIRED) — send real files to the api. host.

{
"success": true,
"data": {
"snapshot_id": "snap_…",
"as_of_date": "2025-12-31",
"statement_start_date": "2025-01-01",
"statement_end_date": "2025-12-31",
"source": "CAMS",
"statement_type": "DETAILED",
"file_name": "cas.pdf",
"total_value": 1250000,
"total_cost_value": 980000,
"folio_count": 3,
"investor_name": "REDACTED",
"mutual_funds": [
{
"name": "Axis Bluechip Fund - Direct Growth",
"isin": "INF846K01EW2",
"folio": "…",
"units": 500.123,
"nav": 52.34,
"value": 26174.44,
"costValue": 20000,
"transactions": [
{ "date": "10-Apr-2025", "type": "Purchase", "amount": 5000, "units": 97.6, "nav": 51.23, "balance": 500.123 }
]
}
],
"confidence": { "document": 0.95, "level": "HIGH" },
"_parse_time_ms": 842,
"_page_count": 6,
"_credits_charged": 12
}
}
  • snapshot_id is the handle for Snapshots, Reports and Skills. To call Enrich directly, map each mutual_funds[] entry to an instrument (value becomes currentValue).
  • For an NSDL e-CAS, every holding — mutual funds and demat holdings alike — is returned in mutual_funds[].
  • confidence.level is HIGH, MEDIUM or LOW, from the validation pass (field checks and units × NAV reconciliation).
  • Transaction type is one of Purchase, Redemption, Switch In, Switch Out, Dividend, SIP, Other; dates keep the statement’s DD-Mon-YYYY form.

A parse costs 10 credits for up to 5 pages, plus 2 credits for each further block of 5 pages: a 6-page statement costs 12, a 12-page one 14. Credits are checked before parsing — a request that would overdraw returns 402 without spending anything.

LimitValueError
File size10 MB413 FILE_TOO_LARGE
Pages150413 TOO_MANY_PAGES
Time to open and parse45 seconds422 PARSE_TIMEOUT

Real CAS statements are well inside these. They exist so a small, crafted PDF can’t consume minutes of CPU.

Errors are { "success": false, "error": { "code", "message" } }.

StatusCodeMeaningRetry?
400MISSING_FILE, MISSING_PDFNo PDF in the request (multipart / JSON), including pdf_ref sent to the api. hostFix the request
400INVALID_REQUESTMore than one of file, pdf_base64, pdf_urlFix the request
400INVALID_FILE, INVALID_PDF_URLNot a PDF, or the URL couldn’t be fetchedNo
400PASSWORD_REQUIREDEncrypted and no, or the wrong, passwordWith the password
401UNAUTHORIZEDMissing or invalid keyNo
402INSUFFICIENT_CREDITSdata.required and data.remaining say by how muchAfter topping up
413FILE_TOO_LARGE, TOO_MANY_PAGESSee LimitsNo
422PARSE_TIMEOUTThe document took too long to readNo
429RATE_LIMITEDHonour Retry-AfterYes
503SERVER_BUSYAll parser workers busyYes, shortly
500PARSE_ERROR, INTERNAL_ERRORUnexpected failureOnce; then report the X-Request-ID