API reference / CAS (portfolio fetch)
3.3 CAS Auto Import: upload and import
Upload a statement PDF and import it into the portfolio in one call.
POST
/v1/cas/import- Authentication
- Bearer token
- Scope
cas:import
Before you integrate
- Send as multipart/form-data, not JSON: the PDF in the file field and the other fields as form fields.
- A statement is always locked: send password (CAMS, KFintech) or pan (NSDL, CDSL) or the call is refused.
- Reads the PDF and imports it in one call. Importing the next month's statement updates existing positions instead of adding duplicates.
Form fields (multipart upload)
| Field | Type | Required | Description |
|---|---|---|---|
file | string | Yes | The statement PDF, sent as the multipart form field named file. Up to 15 MB. |
password | string | No | The password chosen when the statement was requested (CAMS, KFintech); 1 to 64 characters. Send this or pan. |
pan | string | No | The investor's PAN, which opens NSDL and CDSL statements. Send this or password. |
dob | string | No | Date of birth as YYYY-MM-DD, for statements that need it. |
source | string | No | Who issued the statement, if you know it: kfintech, cams, nsdl or cdsl. Detected when left out. |
Sample code
Set your key in the GRAPPI_API_KEY environment variable. Sample values are placeholders.
curl -sS -X POST 'https://grappi.ai/v1/cas/import' \ -H "Authorization: Bearer $GRAPPI_API_KEY" \ -F "file=@statement.pdf" \ -F 'password=Sample@2026' \ -F 'source=cams'
Sample response
{
"request_id": "req_01HZY3K8M2",
"result": {
"import_id": "casim_1a2b3c4d5e6f7a8b",
"source": "cams",
"imported_at": "2026-11-06T09:30:00.000Z",
"holding_count": 1,
"created": 1,
"updated": 0,
"unchanged": 0,
"total_value_minor": 4412035,
"total_cost_minor": 4000250,
"total_gain_minor": 411785,
"xirr_percent": null,
"holdings": [
{
"key": "mutual_fund:INF123K01014:1234567/89",
"kind": "mutual_fund",
"name": "Sample Liquid Fund - Growth",
"isin": "INF123K01014",
"folio": "1234567/89",
"units": 124.239,
"value_minor": 4412035,
"cost_minor": 4000250,
"gain_minor": 411785,
"as_of": "2024-03-31"
}
],
"warnings": []
}
}Response fields
| Field | Type | Description |
|---|---|---|
import_id | string | Id of this import run. |
source | string | Who issued the statement, if known. |
imported_at | string | When the import ran, ISO 8601. |
holding_count | integer | Number of positions in the portfolio after this import. |
created | integer | Positions added by this import. |
updated | integer | Existing positions whose figures changed. |
unchanged | integer | Existing positions that stayed the same. |
total_value_minor | integer | Total market value in paise. |
total_cost_minor | integer | Total cost in paise. |
total_gain_minor | integer | Total gain in paise. |
xirr_percent | number | Annualised return in percent across all dated transactions; null unless the statement is detailed. |
holdings | array | The positions. |
holdings[].key | string | Stable id of the position; the same position gets the same key every month. |
holdings[].kind | string | mutual_fund or demat. |
holdings[].name | string | Scheme or security name. |
holdings[].isin | string | ISIN, if known. |
holdings[].folio | string | Folio or demat client id. |
holdings[].units | number | Units or quantity held. |
holdings[].value_minor | integer | Market value in paise. |
holdings[].cost_minor | integer | Cost in paise. |
holdings[].gain_minor | integer | Gain in paise. |
holdings[].as_of | string | Valuation date. |
warnings | array | Plain-text issues found, if any. |
Errors
Every failure has the same shape. A call that fails on our side or at the data source is refunded to your wallet; a "no record found" answer is charged. See the error reference.