API reference / CAS (portfolio fetch)
3.1 CAS Auto Request — open session
Opens a session with the RTA and returns the CAPTCHA image the investor must read.
POST
/v1/cas/request/session- Authentication
- Bearer token
- Scope
cas:request
Before you integrate
- Step 1 of 2. Show the picture to the investor, then call submit with session_id and what they typed, within 10 minutes.
- Each session can be used once. If the answer is wrong or the session expires, open a new one.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Which issuer to request from: kfintech, cams, nsdl or cdsl. Only sources with request_automatable true work. |
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/request/session' \
-H "Authorization: Bearer $GRAPPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "kfintech"
}'Sample response
{
"request_id": "req_01HZY3K8M2",
"result": {
"session_id": "cassn_1a2b3c4d5e6f7a8b",
"source": "kfintech",
"captcha_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg==",
"expires_at": "2026-11-06T09:40:00.000Z",
"instructions": "Show captcha_image to the investor, then POST the characters to /v1/cas/request/submit."
}
}Response fields
| Field | Type | Description |
|---|---|---|
session_id | string | Pass this to submit. |
source | string | The issuer. |
captcha_image | string | The CAPTCHA picture as a data: URL; show it to the investor. |
expires_at | string | When the session stops working, ISO 8601 (10 minutes after it opens). |
instructions | string | What to do next, in plain words. |
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.