Documentation Index
Fetch the complete documentation index at: https://casparser.in/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Inbound Email API lets you create unique email addresses (likeie_xyz@import.casparser.in) where your users can forward their CAS statements. When an email arrives, we validate the sender, upload attachments to cloud storage, and deliver the result to your app.
Use Case: Lower-friction alternative to OAuth or manual file upload.
Delivery options
callback_url is optional. It controls how you receive parsed files:
With callback_url
We
POST parsed files to your URL whenever an investor forwards a CAS.
Files also remain retrievable via GET /v4/inbound-email/{id}/files for 48h.Best for: server-side workflows, recurring statement ingestion.Without callback_url
Retrieve files via
GET /v4/inbound-email/{id}/files. The address is
scoped to a 30-min sliding session (each poll extends it). Used by the
Portfolio Connect widget when enableInboundEmail: true.Best for: onboarding flows, frontend-heavy apps with no backend.callback_url.
How It Works
Quick Start
The Quick Start below provides a
callback_url for webhook delivery. For a frontend-only flow with no backend, see Use with Portfolio Connect.1. Create an Inbound Email
201 Created):
status here is the inbound email’s lifecycle (active / paused).2. Display to User
Show the email address in your UI:3. Handle Webhook
When the user forwards an email, we POST to yourcallback_url:
Retrieving Files
TheGET /v4/inbound-email/{id}/files endpoint returns every file that has been
forwarded to a given inbound email address. It’s available on every eligible inbound
email, regardless of whether you configured a callback_url. Common uses:
- Frontend polling — the Portfolio Connect widget polls it automatically when
enableInboundEmail: true(see below). - Backend polling — use it instead of (or alongside) a webhook if a pull model fits your stack better.
- Replay / backfill — fetch files that were delivered via webhook if your endpoint was down or needs to re-process them.
cursor as since on your next call
to receive only files that arrived after it. Timestamps are guaranteed
strictly monotonic at microsecond precision, so no entry is returned twice.
Persist the cursor on your side between polls.
expires_in differs depending on whether callback_url was set: long-lived presigned URLs (48h) when set, aligned with the session TTL when omitted. Treat the value as authoritative and refresh by re-polling if a download fails.- With
callback_urlset: files retained 48 hours from arrival. - Without
callback_url: files retained for the sliding session TTL; each call extends it.
Use with Portfolio Connect
For frontend-only apps, the Portfolio Connect widget can drive the entire flow: it creates a short-lived inbound email (without acallback_url),
displays it to the user, polls the retrieval endpoint above, and auto-parses
the forwarded PDF. No webhook required.
React
- Creates an inbound email via
POST /v4/inbound-email(nocallback_url). - Displays the address with a copy button.
- Polls
GET /v4/inbound-email/{id}/filesevery few seconds. - Parses the first file it receives and emits
onSuccess. - Deletes the inbound email on widget close (or lets the 30-min TTL expire it).
Sender Validation
We automatically verify that forwarded emails originated from trusted CAS authorities:- CDSL → eCAS@cdslstatement.com
- NSDL → NSDL-CAS@nsdl.co.in
- CAMS → donotreply@camsonline.com
- KFintech → samfS@kfintech.com
Managing Inbound Emails
List All
Get Details
Delete
Best Practices
1. Download Attachments Promptly
Presigned URLs expire in 48 hours. Download and store attachments in your own storage.2. Use HTTPS for Callbacks
Production callback URLs must use HTTPS (HTTP is allowed forlocalhost during development).
3. Use reference for Correlation
Store your user ID in reference to map inbound emails back to your users.
4. Filter by allowed_sources
If you only need CDSL statements, set "allowed_sources": ["cdsl"] to reject others automatically.
Billing
0.2 credits per validated email received, regardless of whethercallback_url was set — charged on successful webhook delivery, or when the file is stored for polling.
Notes:
- Inbound email creation, listing, and polling reads (
GET /files): free. - Emails from unknown senders: not billed.
- Webhook-delivery failures (after retries): still billed — the email was valid.
- The Portfolio Connect widget incurs an additional 1.0 credit when it auto-parses the received file (standard smart-parse cost).
Error Handling
Common Issues
| Error | Cause | Solution |
|---|---|---|
callback_url must be HTTPS | Using HTTP in production | Use HTTPS or test with localhost |
Inbound email not found | Wrong ID or deleted | Check ID or recreate |
alias already taken | Another inbound email uses this alias | Choose a different alias |
Webhook Delivery Failures
If your webhook endpoint is down or returns an error, we retry automatically with exponential backoff.Security
Email Authentication
We validate:- Exact email whitelist: Only emails from official CAS authority addresses
- Header parsing: Extract original sender from forwarded emails
Webhook Security
- HTTPS required: Production callbacks must use HTTPS
- Automatic retries: Failed webhook deliveries are retried automatically
- Attachment URLs: Time-limited presigned URLs (48h expiry)
Data Retention
- Inbound email configs with
callback_urlset: active indefinitely, marked inactive after 30 days without emails. - Inbound email configs without
callback_url: auto-expire after 30 minutes of no polling activity (sliding TTL). - Received file records (for polling): retained 48 hours when
callback_urlis set; aligned with the session TTL otherwise.
Use Cases
- Onboarding Flow: “Forward your CAS to get started” — simpler than OAuth
- Recurring Updates: Users forward monthly statements → auto-sync portfolios
- Offline Users: Works for investors without OAuth access or app login
Next Steps
- Parse CAS PDFs — parse the downloaded files
- Gmail Inbox Import — alternative: pull CAS from user’s Gmail
- CDSL Fetch — alternative: fetch CAS directly via OTP

