For Developers & AI Agents

Portfolio API for AI Agents

Developer-friendly REST API with official SDKs. Agent Toolkit with MCP server providing 17 live API tools. 14 ready-to-use code templates. Build portfolio features in hours, not months.

Quick Start

Get started with CASParser in under 5 minutes.

REST API (curl)

Try with sandbox key - no signup needed:

curl -X POST https://portfolio-parser.api.casparser.in/v4/smart/parse \
  -H "x-api-key: sandbox-with-json-responses" \
  -F "pdf_file=@cas_statement.pdf" \
  -F "password=encrypted_pan"

Python

import requests

resp = requests.post(
    "https://portfolio-parser.api.casparser.in/v4/smart/parse",
    headers={"x-api-key": "sandbox-with-json-responses"},
    files={"pdf_file": open("cas.pdf", "rb")},
    data={"password": "encrypted_pan"}
)
portfolio = resp.json()

Node.js / TypeScript

const form = new FormData();
form.append('file', fs.createReadStream('cas.pdf'));
form.append('password', 'encrypted_pan');

const res = await fetch(
  'https://portfolio-parser.api.casparser.in/v4/smart/parse',
  { method: 'POST', headers: { 'x-api-key': 'KEY' }, body: form }
);
const portfolio = await res.json();

Portfolio Connect SDK (React)

npm install @cas-parser/connect

import { CASParserConnect } from '@cas-parser/connect';

CASParserConnect.open({
  accessToken: 'at_...',
  onSuccess: (data) => console.log(data),
  onExit: () => console.log('closed'),
});
AI Agent Integration

MCP Server for AI Agents

The official cas-parser-node-mcp package provides an MCP server with all CAS Parser API endpoints as tools. Works with Claude Code, Cursor, Windsurf, and VS Code.

Claude Code (CLI)

claude mcp add cas_parser_node_mcp \
  -e CAS_PARSER_API_KEY=your-api-key \
  -- npx -y cas-parser-node-mcp@latest

Cursor / VS Code (mcp.json)

{
  "mcpServers": {
    "cas_parser_node_mcp": {
      "command": "npx",
      "args": ["-y", "cas-parser-node-mcp@latest"],
      "env": { "CAS_PARSER_API_KEY": "your-key" }
    }
  }
}
17

Live API Tools

14

Code Templates

<500ms

API Response Time

Agent Toolkit

Ready-to-use templates and skills for AI coding agents. Install with one command.

Install

npx skills add casparser/agent-toolkit

What's Included

AGENTS.md
Complete integration rules and API reference
SKILL.md
Domain knowledge and code templates
14 Code Templates
Python, Node.js, React, HTML, curl
OpenAPI Spec

API & SDK Features

REST API

Comprehensive REST API with OpenAPI spec. Parse CAS, fetch CDSL, generate statements, import from Gmail.

Python SDK

Official cas-parser-python package. Thin wrapper around the REST API.

Node.js / TypeScript SDK

Auto-generated from OpenAPI spec by Stainless. Full TypeScript types included.

Portfolio Connect SDK

Drop-in @cas-parser/connect widget. React, Vue, Angular, vanilla JS.

MCP Server

17 live API tools for AI agents. Code Mode lets agents write TypeScript in a sandbox.

Ask AI (GPT)

India PortfolioGPT - custom ChatGPT for portfolio questions. Try it →

API Reference Quick Facts

Timeouts

  • CAS / Contract Note Parsing60s
  • CDSL OTP Fetch (captcha solving)50s
  • Access Tokens / Credits10s

Error Handling

{
  "status": "error",
  "msg": "Invalid password for this CAS"
}
  • 400/401/403 - Not retryable (fix the request)
  • 500/502/503 - Retryable (backoff: 1s, 2s, 4s)
  • All responses include X-Request-ID header

Start Building

Free tier available. Sandbox API key for testing. Integrate in 5 minutes.

Sandbox key for testing: sandbox-with-json-responses