API Documentation

AI-powered document processing API for developers

Version 1.0 REST API JSON Format

Quick Start

1

Get Your API Key

Sign up for a paid plan and generate your API key in the settings page.

2

Prepare Your Document

Convert your document to base64 format.

3

Make API Request

Send a POST request to our processing endpoint.

4

Get Results

Receive extracted data in JSON format immediately.

📋 Requirements

  • • Paid subscription plan (Starter, Professional, Business, or Enterprise)
  • • Valid API key
  • • Documents in JPEG, PNG, or PDF format
  • • Maximum file size: 10MB per document

Example Request

curl -X POST "https://bankstatementflow.com/api/v1/process" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document": "iVBORw0KGgoAAAANSUhEUgAA...",
    "detection_type": "auto"
  }'

Example Response

{
  "success": true,
  "message": "Document processed successfully",
  "data": {
    "processing_id": "proc_abc123def456",
    "extracted_fields": {
      "date": "2025-06-12",
      "amount": "1,234.56",
      "description": "Payment to vendor ABC"
    },
    "confidence_scores": {
      "date": 0.95,
      "amount": 0.98,
      "description": 0.87
    }
  }
}

Authentication

The BankStatementFlow API uses API key authentication. Include your API key in the request headers using one of these methods:

Bearer Token (Recommended)

Authorization: Bearer YOUR_API_KEY

Custom Header

X-API-Key: YOUR_API_KEY

⚠️ API Key Security

  • • Keep your API key secure and never share it publicly
  • • Use environment variables to store your API key
  • • Regenerate your API key if you suspect it has been compromised

API Endpoints

POST /api/v1/process

Process a document with AI-powered data extraction

Request Body

Parameter Type Required Description
document string Base64 encoded document (JPEG, PNG, PDF)
detection_type string "auto" or "custom"
custom_fields array * Required if detection_type is "custom"

Example with Custom Fields

{
  "document": "iVBORw0KGgoAAAANSUhEUgAA...",
  "detection_type": "custom",
  "custom_fields": [
    "invoice_number",
    "vendor_name",
    "total_amount",
    "tax_amount",
    "due_date"
  ]
}

Response Codes

200 Document processed successfully
400 Invalid document format
401 Invalid or missing API key
402 Insufficient credits
403 API access requires paid subscription
422 Validation failed
429 Rate limit exceeded
500 Processing error
GET /api/v1/history

Get your processing history

Query Parameters

Parameter Type Default Description
limit integer 20 Number of results (1-100)
offset integer 0 Number of results to skip
from_date date - Start date (YYYY-MM-DD)
to_date date - End date (YYYY-MM-DD)
GET /api/v1/account

Get your account information and subscription details

Example Response

{
  "success": true,
  "data": {
    "user_id": 123,
    "email": "[email protected]",
    "name": "John Doe",
    "subscription": {
      "plan": "Professional",
      "slug": "professional",
      "credits": 450,
      "api_access": true
    },
    "preferred_fields": [
      "date", "amount", "description"
    ]
  }
}

Rate Limits

Per-Plan Limits

Starter 100 requests/hour
Professional 500 requests/hour
Business 1,000 requests/hour
Enterprise 5,000 requests/hour

Rate Limit Headers

X-RateLimit-Limit

Your hourly rate limit

X-RateLimit-Remaining

Remaining requests this hour

X-RateLimit-Reset

When your limit resets (Unix timestamp)

Error Handling

All API responses include a success field. When an error occurs, the response will include additional error information:

{
  "success": false,
  "message": "Validation failed",
  "error_code": "VALIDATION_ERROR",
  "errors": {
    "image": ["The image field is required."],
    "detection_type": ["The detection type must be auto or custom."]
  }
}

Common Error Codes

  • MISSING_API_KEY - API key not provided
  • INVALID_API_KEY - Invalid API key
  • SUBSCRIPTION_REQUIRED - Paid plan required
  • INSUFFICIENT_CREDITS - Not enough credits
  • RATE_LIMIT_EXCEEDED - Too many requests
  • INVALID_DOCUMENT_FORMAT - Unsupported file format
  • PROCESSING_ERROR - Server processing error
  • VALIDATION_ERROR - Request validation failed

Code Examples

JavaScript / Node.js

const fs = require('fs');

// Convert document to base64
const documentBuffer = fs.readFileSync('document.jpg');
const base64Document = documentBuffer.toString('base64');

const response = await fetch('https://bankstatementflow.com/api/v1/process', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    document: base64Document,
    detection_type: 'auto'
  })
});

const result = await response.json();
console.log(result);

Python

import requests
import base64

# Convert document to base64
with open('document.jpg', 'rb') as f:
    document_data = base64.b64encode(f.read()).decode()

response = requests.post(
    'https://bankstatementflow.com/api/v1/process',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'document': document_data,
        'detection_type': 'custom',
        'custom_fields': ['date', 'amount', 'description']
    }
)

result = response.json()
print(result)

PHP

$documentData = base64_encode(file_get_contents('document.jpg'));

$data = [
    'document' => $documentData,
    'detection_type' => 'auto'
];

$options = [
    'http' => [
        'header' => [
            'Authorization: Bearer YOUR_API_KEY',
            'Content-Type: application/json'
        ],
        'method' => 'POST',
        'content' => json_encode($data)
    ]
];

$context = stream_context_create($options);
$result = file_get_contents('https://bankstatementflow.com/api/v1/process', false, $context);
$response = json_decode($result, true);

print_r($response);

cURL

# Convert document to base64 first
DOCUMENT_BASE64=$(base64 -i document.jpg)

curl -X POST "https://bankstatementflow.com/api/v1/process" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"document\": \"$DOCUMENT_BASE64\",
    \"detection_type\": \"auto\"
  }"

Need Help?

Our team is here to help you integrate with our API successfully.

Email Support

Get help with API integration

[email protected]

Live Chat

Chat with our support team

Contact Sales

Enterprise solutions & custom plans

Contact Us