Skip to main content

Prerequisites

  • cURL installed
  • Get an API key
  • Have a CAS PDF ready (or use sandbox key)

1. Parse a CAS PDF

curl -X POST https://api.casparser.in/v4/smart/parse \
  -H "x-api-key: YOUR_API_KEY" \
  -F "file=@cas.pdf" \
  -F "password=YOUR_PAN_NUMBER"

2. Parse from URL

curl -X POST https://api.casparser.in/v4/smart/parse \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pdf_url": "https://example.com/cas.pdf",
    "password": "YOUR_PAN_NUMBER"
  }'

3. Try it yourself

Test without consuming credits:
curl -X POST https://api.casparser.in/v4/smart/parse \
  -H "x-api-key: sandbox-with-json-responses" \
  -F "file=@cas.pdf" \
  -F "password=test"

Check your credits

curl -X POST https://api.casparser.in/v1/credits \
  -H "x-api-key: YOUR_API_KEY"
Response:
{
  "used": 15,
  "remaining": 35,
  "limit": 50,
  "reset_date": "2024-02-01",
  "features": ["cdsl", "nsdl", "cams_kfintech", "inbox", "cdsl_fetch"]
}

Response headers

Every API response includes:
HeaderDescription
X-Request-IDUnique request ID (e.g., req_abc123) for support
X-Credits-UsedCredits consumed by this request
X-Credits-RemainingRemaining credits for billing period

Error handling

# Check response status
response=$(curl -s -w "\n%{http_code}" -X POST https://api.casparser.in/v4/smart/parse \
  -H "x-api-key: YOUR_API_KEY" \
  -F "file=@cas.pdf" \
  -F "password=WRONG_PASSWORD")

http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')

if [ "$http_code" -ne 200 ]; then
  echo "Error: $body"
  exit 1
fi

echo "$body" | jq '.summary.total_value'

Common errors

StatusErrorSolution
400Invalid passwordCheck PAN format (encrypted PAN for CDSL/NSDL)
401Invalid API keyVerify your API key at app.casparser.in
402Insufficient creditsUpgrade plan or wait for reset
422Invalid PDFEnsure PDF is not scanned/tampered

Next steps