API Documentation

Complete guide to integrating FinanceAI's document processing API

Getting Started

Base URL

https://api.financeai.com/v1

Quick Start

  1. Sign up for a free account
  2. Get your API key from the dashboard
  3. Make your first API call
  4. Process your documents!

🚀 Get Started

Ready to start processing documents? Create your free account to get instant access to the API.

Authentication

All API requests require authentication using your API key in the Authorization header.

Example Request

curl -X POST https://api.financeai.com/v1/documents/scan \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F "file=@document.pdf"

API Endpoints

POST/documents/scan

Upload and process a financial document to extract structured data.

Parameters:

file (required) - The document file to process
type (optional) - Document type: bank_statement, receipt, invoice

Response:

{ "id": "doc_123456789", "type": "bank_statement", "status": "completed", "data": { "account_number": "****1234", "balance": 5420.50, "transactions": [ { "date": "2025-01-15", "description": "ACH Credit", "amount": 2500.00, "type": "credit", "merchant": "SALARY DEPOSIT" } ] } }

GET/documents/{id}

Retrieve the processing results for a specific document.

Response:

{ "id": "doc_123456789", "type": "receipt", "status": "completed", "created_at": "2025-01-19T10:30:00Z", "data": { "merchant_name": "Office Supplies Plus", "total_amount": 45.99, "date": "2025-01-19", "tax_amount": 3.68, "items": [ { "description": "Printer Paper", "amount": 15.99 }, { "description": "Pens (Pack)", "amount": 8.99 } ] } }

Code Examples

JavaScript/Node.js

const FormData = require('form-data'); const fs = require('fs'); const axios = require('axios'); const form = new FormData(); form.append('file', fs.createReadStream('bank_statement.pdf')); form.append('type', 'bank_statement'); const response = await axios.post( 'https://api.financeai.com/v1/documents/scan', form, { headers: { 'Authorization': 'Bearer YOUR_API_KEY', ...form.getHeaders() } } ); console.log(response.data);

Python

import requests url = "https://api.financeai.com/v1/documents/scan" headers = {"Authorization": "Bearer YOUR_API_KEY"} with open("receipt.pdf", "rb") as f: files = {"file": f} data = {"type": "receipt"} response = requests.post(url, headers=headers, files=files, data=data) result = response.json() print(result)

Rate Limits & Pricing

Free Tier

100

documents per month

5 requests/minute

Pro

5,000

documents per month

50 requests/minute

Enterprise

Unlimited

Custom pricing

Custom rate limits

Error Handling

HTTP Status Codes

200Success
400Bad Request
401Unauthorized
429Rate Limited
500Server Error

Error Response Format

{ "error": { "code": "invalid_file_type", "message": "File type not supported. Please upload PDF, PNG, or JPG files.", "details": { "supported_types": ["pdf", "png", "jpg", "jpeg"] } } }

Webhooks

Configure webhooks to receive real-time notifications when document processing is complete.

Webhook Events

document.processedDocument processing completed
document.failedDocument processing failed
batch.completedBatch processing completed

Webhook Payload Example

{ "event": "document.processed", "timestamp": "2025-10-19T14:30:00Z", "data": { "document_id": "doc_abc123", "type": "invoice", "status": "completed", "extracted_data": { "supplier_name": "ABC Supplies Inc.", "invoice_number": "INV-2024-001", "total_amount": 1250.00, "currency": "USD", "invoice_date": "2024-10-15" } } }

SDK Libraries

Use our official SDKs for faster integration in your preferred programming language.

Python SDK

Official Python client for FinanceAI

pip install financeai-python
View Documentation →

Node.js SDK

Official Node.js client for FinanceAI

npm install @financeai/node
View Documentation →

Ruby SDK

Official Ruby client for FinanceAI

gem install financeai
View Documentation →

PHP SDK

Official PHP client for FinanceAI

composer require financeai/php
View Documentation →

Best Practices

Document Quality

For best results, upload documents with resolution of at least 300 DPI. Ensure text is clearly visible and not obscured by shadows or glare. PDFs are preferred over image formats when available.

Error Handling

Always implement retry logic with exponential backoff for failed requests. Check the confidence scores of extracted data and implement a review process for low-confidence results.

Rate Limiting

Monitor your rate limit headers and implement queuing for batch processing. Consider upgrading your plan if you frequently hit rate limits during peak usage.

Security

Never expose your API keys in client-side code or public repositories. Rotate keys regularly and use environment variables to store sensitive credentials.

Data Retention

Documents are automatically deleted after 30 days. Download and store extracted data in your own systems if you need long-term access. Use the retention settings to adjust storage duration.

Ready to Get Started?

Sign up for your free API key and start processing documents today.

Get Your API Key