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://www.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_umv8thj6lv85gar8",
    "extracted_fields": [
      {
        "Date": "10/02",
        "Description": "POS PURCHASE",
        "Debit": "4.23",
        "Credit": "",
        "Balance": "65.73"
      },
      {
        "Date": "10/03",
        "Description": "PREAUTHORIZED CREDIT",
        "Debit": "",
        "Credit": "763.01",
        "Balance": "828.74"
      },
      {
        "Date": "10/04",
        "Description": "POS PURCHASE",
        "Debit": "11.68",
        "Credit": "",
        "Balance": "817.06"
      }
    ],
    "detection_type": "auto",
    "fields_requested": null,
    "processing_time_ms": 12246,
    "pages_processed": 2
  },
  "usage": {
    "credits_used": 2,
    "remaining_credits": 1902
  },
  "timestamp": "2025-06-21T14:55:48.421550Z"
}

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

Rate Limits

Per-Plan Limits

All Plans 100 requests/hour

Higher Limits Available

Need more than 100 requests per hour? Contact us for custom rate limits tailored to your business needs.

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://www.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://www.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://www.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://www.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.

Get Support

Questions about API integration, troubleshooting, or custom solutions? We're here to help.

Contact Support