Skip to main content

Overview

Robust error handling is essential for production applications. This guide covers error types, handling strategies, and best practices for building reliable integrations with Documind.

HTTP Status Codes

Documind uses standard HTTP status codes to indicate success or failure:

Error Response Format

All errors return a consistent JSON structure:
Some errors include additional context:

Common Errors and Solutions

401 Unauthorized

Cause: Missing or invalid API key
Solution:

402 Payment Required

Cause: Insufficient credits
Solution:

400 Bad Request

Cause: Invalid request parameters Common scenarios:

Invalid UUID Format

Solution: Validate UUIDs before making requests

Invalid Schema

Solution: Validate schema structure

Invalid Model Name

Solution: Use constants for model names

404 Not Found

Cause: Document or extraction doesn’t exist
Solution: Verify IDs and handle missing resources

429 Too Many Requests

Cause: Rate limit exceeded
Solution: Implement exponential backoff

500 Internal Server Error

Cause: Unexpected server error
Solution: Implement retry logic with logging

Retry Strategies

Exponential Backoff

Best for rate limits and temporary server issues:

Circuit Breaker

Prevent cascading failures:

Timeout Handling

Set Appropriate Timeouts

Handle Timeout Errors

Validation Errors

Pre-Request Validation

Catch errors before making API calls:

Logging and Monitoring

Structured Logging

Error Tracking

Complete Error Handling Example

Next Steps

Automation Pipeline

Build resilient document automation workflows

API Reference

Explore all API endpoints and error responses

Batch Processing Tutorial

Handle errors in batch processing workflows

Core Concepts

Understand the extraction workflow