4 min read

SDKs & Libraries

Official client libraries and integration guides

DocuRift provides official SDKs and detailed guides to help you integrate our API into your applications. Our client libraries handle authentication, file uploads, error handling, and retry logic, so you can focus on building your document processing workflows rather than managing HTTP requests.

Whether you're building a Python-based data pipeline, a Node.js backend service, or integrating directly with cURL scripts, we have the tools and documentation to get you started quickly. Each SDK is designed to provide a consistent, idiomatic experience for developers in that language.

Choosing the Right Integration

Before diving into the SDKs, consider your use case:

  • Python SDK: Best for data science workflows, backend services, and scripts. Supports both synchronous and asynchronous operations with full type hints.
  • JavaScript/TypeScript SDK: Ideal for Node.js backends, serverless functions, and modern web applications. Fully typed with TypeScript support.
  • REST API: Perfect when you need maximum control, are using an unsupported language, or want to understand the underlying API calls.

Official SDKs

Quick Comparison

Each integration option has its strengths. Here's how they compare across key features:

| Feature | Python | JavaScript | REST | |---------|--------|------------|------| | Async Support | Yes | Yes | N/A | | Type Safety | Optional | TypeScript | N/A | | File Upload | Simplified | Simplified | Manual | | Error Handling | Built-in | Built-in | Manual | | Retry Logic | Built-in | Built-in | Manual | | Streaming | Yes | Yes | Yes | | Batch Processing | Helper methods | Helper methods | Manual |

Installation

Getting started takes just one command. Install the SDK for your preferred language:

Python

pip install requests python-dotenv

The Python SDK requires Python 3.8 or later. We recommend using a virtual environment to manage dependencies.

JavaScript/TypeScript

npm install docurift
# or
pnpm add docurift

The JavaScript SDK works with Node.js 16+, modern browsers, and edge runtimes like Cloudflare Workers and Vercel Edge Functions.

Basic Usage

Here's how to process your first document with each SDK. Both examples authenticate with your API key and process an invoice:

Python

from docurift import DocuRiftClient

client = DocuRiftClient(api_key="your_api_key")
result = client.process("invoice.pdf", document_type="invoice")
print(result.data)

JavaScript

import { DocuRift } from 'docurift';

const client = new DocuRift({ apiKey: 'your_api_key' });
const result = await client.process('invoice.pdf', { type: 'invoice' });
console.log(result.data);

Both SDKs handle multipart file uploads, JSON parsing, and error handling automatically. They also implement automatic retry logic with exponential backoff for transient errors.

Best Practices

When integrating DocuRift into your applications, we recommend:

  1. Store API keys securely: Use environment variables, never commit keys to source control
  2. Handle errors gracefully: Implement proper error handling for all API calls
  3. Use async for high volume: For processing many documents, use async methods to improve throughput
  4. Implement webhooks: For production workloads, use webhooks instead of polling for results
  5. Monitor credit usage: Track your credit consumption to avoid unexpected processing stops

Community SDKs

We welcome community-contributed SDKs! If you've built an SDK for another language, let us know and we'll list it here. Community contributions help make DocuRift accessible to developers across all platforms and languages.

Need a Different Language?

Our REST API works with any language that can make HTTP requests. Whether you're using Go, Ruby, PHP, Java, or any other language, check the REST/cURL guide for examples you can adapt to your preferred programming language.