Skip to main content

πŸ”— Integrations (API)

The Docflo API provides comprehensive access to document processing, analysis, and management capabilities. This REST API allows you to integrate Docflo's intelligent document processing features into your applications.

✨ Key Features:
  • Connect Docflo.ai with ERPs, CRMs, and other business platforms
  • Fetch structured document data once it is processed
  • Update dynamic fields to be shown to users within Docflo platform
  • Manage API keys based on service-level permissions

πŸš€ How it works​

  1. Go to the Integration section in the Docflo.ai platform.
  2. Create an API key with relevant permissions.
  3. Explore code samples to find a template that can be used as a kickstart.
  4. Perform a test call within our Swagger playground.

Base URL​

https://api.docflo.ai

Authentication​

All API requests require authentication using two headers:

  • x-tenant-id: Your tenant identifier
  • apiKey: Your API key

Example:

curl -H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
"https://api.docflo.ai/docs/v1/document"

Data Types​

Please refer to Data Types for supported data structure.

Get Documents​

Retrieve a list of documents with optional filtering and pagination.

Endpoint: GET /docs/v1/document

Parameters:

  • type (string, optional) - Document type filter
  • skip (string, optional) - Number of documents to skip for pagination
  • top (string, optional) - Number of documents to return (limit)
  • source (string, optional) - Document source filter
  • search (string, optional) - Search term for document content
  • status (string, optional) - Document status filter
  • sortBy (string, optional) - Field to sort by
  • sortOrder (string, optional) - Sort order (asc/desc)
  • createdFrom (string, optional) - Filter documents created from this date (format: date-time, example: "2025-01-01")
  • createdTo (string, optional) - Filter documents created until this date (format: date-time, example: "2025-10-01")
  • favorite (boolean, optional) - Filter favorite documents
  • myApprovals (boolean, optional) - Filter documents pending your approval
  • approverId (string, optional) - Filter by approver ID
  • includeResults (boolean, optional) - Include processing results in response

Example Request:

curl -X GET "https://api.docflo.ai/docs/v1/document?type=invoice&top=10&skip=0" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key"

Create Document​

Upload and create a new document for processing.

Endpoint: POST /docs/v1/document

Request Body (multipart/form-data):

  • file (binary, required) - The document file to upload
  • type (string, optional) - Document type classification

Example Request:

curl -X POST "https://api.docflo.ai/docs/v1/document" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
-F "file=@invoice.pdf" \
-F "type=invoice"

Get Document by ID​

Retrieve a specific document by its ID.

Endpoint: GET /docs/v1/document/byId/{documentId}

Path Parameters:

  • documentId (string, required) - The document ID

Example Request:

curl -X GET "https://api.docflo.ai/docs/v1/document/byId/12345" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key"

Analyze Document​

Analyze a document without storing it permanently in the system.

Endpoint: POST /docs/v1/document/analyze

Request Body (multipart/form-data):

  • type (string, required) - Document type for analysis
  • file (binary, required) - The document file to analyze

Example Request:

curl -X POST "https://api.docflo.ai/docs/v1/document/analyze" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
-F "type=invoice" \
-F "file=@document.pdf"

Get Original File​

Download the original uploaded file.

Endpoint: GET /docs/v1/document/download/{id}/original

Path Parameters:

  • id (string, required) - The document ID

Example Request:

curl -X GET "https://api.docflo.ai/docs/v1/document/download/12345/original" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
--output original-document.pdf

Get Original Email​

If document is extracted from a mailbox, it allows retrieving the original email in EML format.

Endpoint: GET /docs/v1/document/download/{id}/email

Path Parameters:

  • id (string, required) - The document ID

Example Request:

curl -X GET "https://api.docflo.ai/docs/v1/document/download/12345/email" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
--output original-email.eml

Update Model Fields​

Update document configurations in terms (customer fields).

Endpoint: PATCH /docs/v1/fields

Query Params :

  • documentType (string, required) - Document type
  • name (string, required) - Field name

Request Body (JSON):

  • type (string, required) - Field data type; see Supported Data Types for available options
  • visible (boolean, optional) - Field visibility
  • extractionMethod (string, optional) - Extraction method
  • extractionSettings (object, optional) - Extraction configuration settings
  • fields (array of strings, optional) - Field names array

Example Request:

curl -X PATCH "https://api.lab.docflo.ai/docs/types/invoice/field/YourFieldName" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"type": "currency",
"visible": true,
"extractionMethod": "ai"
}'

Update Document Fields​

Update multiple fields in a document's data. This endpoint allows you to update complex nested objects and arrays with create, update, and delete operations.

Endpoint: PATCH /docs/v1/document/fields/{id}

Path Parameters:

  • id (string, required) - The document ID

Request Body (JSON):

  • fields (object, required) - Object containing the fields to update with their new values

Array Operations: For array elements, you can specify operations using the operation field:

  • create - Add a new item to the array
  • update - Update an existing item (requires _id)
  • delete - Remove an item from the array (requires _id)

Example Request:

curl -X PATCH "https://api.docflo.ai/docs/v1/document/fields/12345" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"InvoiceId": "12345",
"InvoiceTotal": {
"Amount": 12345,
"CurrencyCode": "USD"
},
"Items": [
{
"operation": "create",
"Description": "API Item 3",
"amount": {
"amount": 12345,
"currencyCode": "USD"
}
},
{
"operation": "update",
"_id": "item-1",
"Description": "API Item 1",
"amount": {
"amount": 234,
"currencyCode": "ILS"
}
},
{
"operation": "delete",
"_id": "68befa1fe9a9f9a3327627c9"
}
]
}
}'

Note: This endpoint validates field keys against the document type schema to ensure data consistency.

Update Document Status​

Update the status of a document.

Endpoint: PATCH /docs/v1/document/info/{id}

Path Parameters:

  • id (string, required) - The document ID

Request Body (JSON):

  • status (string, required) - New document status

Example Request:

curl -X PATCH "https://api.docflo.ai/docs/v1/document/info/12345" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
-H "Content-Type: application/json" \
-d '{"status": "APPROVED"}'

Document Status Values​

Documents can have the following status values:

  • CONFIRMED - Document has been confirmed and validated
  • REQUIRES_VALIDATION - Document requires manual validation
  • PROCESSING - Document is currently being processed
  • ANALYZING - Document is being analyzed by AI
  • ANALYZED - Document analysis has been completed
  • APPROVED - Document has been approved
  • FAILED - Document processing has failed

Get Document Information​

Retrieve detailed information about a specific document.

Endpoint: GET /docs/v1/document/info/{id}

Path Parameters:

  • id (string, required) - The document ID

Example Request:

curl -X GET "https://api.docflo.ai/docs/v1/document/info/12345" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key"

Get Enabled Document Types​

Retrieve all enabled document types in your system.

Endpoint: GET /docs/v1/types/enabled

Example Request:

curl -X GET "https://api.docflo.ai/docs/v1/types/enabled" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key"

Get Document Type Configuration​

Retrieve configuration for a specific document type.

Endpoint: GET /docs/v1/types/{type}

Path Parameters:

  • type (string, required) - Document type name

Example Request:

curl -X GET "https://api.docflo.ai/docs/v1/types/invoice" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key"

AI-Powered Features​

Search through documents using AI-powered semantic search.

Endpoint: POST /docs/v1/document/ai/search

Request Body (JSON):

  • model_ids (string, optional) - Comma-separated document types to search (e.g., "invoice,receipt")
  • query (string, required) - Search query
  • score_threshold (number, required) - Minimum similarity score threshold

Example Request:

curl -X POST "https://api.docflo.ai/docs/v1/document/ai/search" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"query": "Find all invoices from Microsoft",
"score_threshold": 0.7,
"model_ids": "invoice,receipt"
}'

AI Assistant​

Use the AI assistant to ask questions about your documents.

Endpoint: POST /docs/v1/document/ai/ask

Request Body (JSON):

  • query (string, required) - Question to ask the AI assistant
  • types (array of strings, optional) - Document types to search within

Example Request:

curl -X POST "https://api.docflo.ai/docs/v1/document/ai/ask" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"query": "What is the total amount of all invoices this month?",
"types": ["invoice"]
}'

Logging API​

Get Logs​

Retrieve system logs with optional filtering.

Endpoint: GET /logs/v1/log

Parameters:

  • type (string, optional) - Log type filter
  • area (string, optional) - System area filter
  • subArea (string, optional) - Sub-area filter
  • message (string, optional) - Message content filter
  • metadata (object, optional) - Additional metadata filters

Example Request:

curl -X GET "https://api.docflo.ai/logs/v1/log?type=error&area=document-processing" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key"

Authentication API​

Create Guest Token​

Generate a guest token for temporary access.

Endpoint: POST /auth/v1/guest-token

Example Request:

curl -X POST "https://api.docflo.ai/auth/v1/guest-token" \
-H "x-tenant-id: your-tenant-id" \
-H "apiKey: your-api-key"

Document Types​

The following document types are supported:

  • invoice - Standard business invoices
  • receipt - Purchase receipts
  • contract - Legal contracts and agreements
  • payStub - Employee pay stubs
  • unclassified - Documents without specific classification
  • carLicense - Vehicle license documents
  • idDocument - Identity documents
  • check - Bank checks
  • bankStatement - Bank account statements
  • creditCard - Credit card statements
  • incoInvoice4 - Specific invoice format
  • purchaseOrder - Purchase order documents
  • financialReportIL - Israeli financial reports
  • bankStatement.us - US bank statements
  • freightInvoice - Freight and shipping invoices
  • creditCardStatement - Credit card account statements
  • goodsReceipt - Goods receipt documents
  • deliveryInvoice - Delivery invoices

Error Handling​

The API returns standard HTTP status codes:

  • 200 - Success
  • 201 - Created
  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 500 - Internal Server Error

Error responses include details about what went wrong:

{
"error": {
"code": "INVALID_DOCUMENT_TYPE",
"message": "The specified document type is not supported",
"details": "Supported types: invoice, receipt, contract..."
}
}

Rate Limits​

API requests are subject to rate limiting to ensure fair usage:

  • Standard accounts: 1000 requests per hour
  • Premium accounts: 5000 requests per hour
  • Enterprise accounts: Custom limits

Rate limit information is returned in response headers:

  • X-RateLimit-Limit - Your rate limit ceiling
  • X-RateLimit-Remaining - Number of requests remaining
  • X-RateLimit-Reset - UTC epoch seconds when the rate limit resets

Best Practices​

  1. Authentication: Store API credentials securely and rotate them regularly
  2. Error Handling: Implement retry logic for transient failures
  3. Rate Limiting: Implement backoff strategies when hitting rate limits
  4. File Uploads: Use appropriate timeouts for large file uploads
  5. Pagination: Use skip/top parameters for efficient data retrieval
  6. Filtering: Use specific filters to reduce response sizes and improve performance