Skip to main content

Official SDKs

We maintain official SDKs for the most popular languages.

JavaScript / TypeScript

Installation

npm install parsefy zod

Requirements

  • Node.js 18+
  • Zod 3.x

Quick example

import { Parsefy } from 'parsefy';
import * as z from 'zod';

const client = new Parsefy();

const schema = z.object({
  invoice_number: z.string().describe('The invoice number'),
  total: z.number().describe('Total amount'),
});

const { object, error } = await client.extract({
  file: './invoice.pdf',
  schema,
});

if (!error) {
  console.log(object.invoice_number); // Fully typed!
}

Python

Installation

pip install parsefy

Requirements

  • Python 3.10+
  • Pydantic 2.0+

Quick example

from parsefy import Parsefy
from pydantic import BaseModel, Field

client = Parsefy()

class Invoice(BaseModel):
    invoice_number: str = Field(description="The invoice number")
    total: float = Field(description="Total amount")

result = client.extract(file="invoice.pdf", schema=Invoice)

if result.error is None:
    print(result.data.invoice_number)  # Fully typed!

Community SDKs

We welcome community contributions! If you’ve built an SDK for another language, let us know.

Building your own SDK

The Parsefy API is a simple REST API. Key endpoints:
MethodEndpointDescription
POST/v1/extractExtract data from documents
GET/healthHealth check
See the API Reference for full documentation.

SDK requirements

If you’re building an SDK, we recommend:
  • Authentication: Support PARSEFY_API_KEY environment variable
  • File handling: Accept file paths, bytes, and file objects
  • Type safety: Use native schema libraries (Zod, Pydantic, etc.)
  • Error handling: Distinguish HTTP errors from extraction errors
  • Retries: Implement exponential backoff for rate limits

Support

Need help with an SDK?