API reference / CAS (portfolio fetch)
3.3 CAS Auto Import — import parsed CAS
Folds a parsed CAS into the portfolio: one stable key per position (so next month updates rather than duplicates), cost/value/gain rolled up, XIRR when available.
POST
/v1/cas/import/document- Authentication
- Bearer token
- Scope
cas:import
Before you integrate
- Use this when you already have the statement as JSON, for example from the read call. A body with no folios and no demat lines is refused.
- Importing the next month's statement updates existing positions by key instead of adding duplicates.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
source | string | No | Who issued the statement: kfintech, cams, nsdl or cdsl. |
statement_type | string | No | summary or detailed. |
period_from | string | No | Statement period start, up to 20 characters. |
period_to | string | No | Statement period end, up to 20 characters. |
folios | array | No | Mutual-fund folio lines, up to 2000. Send at least one folio or one demat line. |
folios[].folio | string | No | Folio number, up to 60 characters. |
folios[].amc | string | No | Fund house, up to 160 characters. |
folios[].scheme | string | No | Scheme name, up to 240 characters. |
folios[].isin | string | No | Scheme ISIN, up to 20 characters. |
folios[].units | number | No | Units held. Defaults to 0. |
folios[].nav_minor | integer | No | NAV per unit in paise. |
folios[].value_minor | integer | No | Market value in paise. |
folios[].cost_minor | integer | No | Cost in paise. |
folios[].as_of | string | No | Valuation date, up to 20 characters. |
demat | array | No | Demat holding lines, up to 2000. |
demat[].dp_id | string | No | Depository participant id, up to 30 characters. |
demat[].client_id | string | No | Demat client id, up to 30 characters. |
demat[].isin | string | No | Security ISIN, up to 20 characters. |
demat[].security | string | No | Security name, up to 240 characters. |
demat[].quantity | number | No | Quantity held. Defaults to 0. |
demat[].price_minor | integer | No | Price per unit in paise. |
demat[].value_minor | integer | No | Market value in paise. |
demat[].asset_class | string | No | Asset class, up to 40 characters. |
demat[].as_of | string | No | Valuation date, up to 20 characters. |
transactions | array | No | Transactions, up to 20000. Needed for an XIRR. |
transactions[].folio | string | No | Folio number, up to 60 characters. |
transactions[].scheme | string | No | Scheme name, up to 240 characters. |
transactions[].isin | string | No | ISIN, up to 20 characters. |
transactions[].date | string | Yes | Transaction date, up to 20 characters; required for each transaction you send. |
transactions[].description | string | No | Description, up to 300 characters. |
transactions[].type | string | No | For example purchase, redemption, switch_in, switch_out or dividend. Defaults to other. |
transactions[].amount_minor | integer | No | Amount in paise. |
transactions[].units | number | No | Units bought or sold. |
transactions[].nav_minor | integer | No | NAV per unit in paise. |
transactions[].balance_units | number | No | Unit balance after the transaction. |
review_required | boolean | No | Mark the data as needing a human check. Defaults to false. |
warnings | array | No | Up to 200 notes, each up to 500 characters, kept with the import. |
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/document' \
-H "Authorization: Bearer $GRAPPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "cams",
"statement_type": "detailed",
"period_to": "2024-03-31",
"folios": [
{
"folio": "1234567/89",
"scheme": "Test Liquid Fund - Growth",
"isin": "INF209K01XX1",
"units": 124.239,
"nav_minor": 35512,
"value_minor": 4412035,
"cost_minor": 4000250
}
]
}'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.