> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parsefy.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SDKs

> Official Parsefy SDKs: Financial Document Infrastructure for Developers

## Official SDKs

We maintain official SDKs for the most popular languages.

<CardGroup cols={2}>
  <Card title="JavaScript / TypeScript" icon="node-js" href="https://github.com/parsefy/parsefy-js">
    Full TypeScript support with Zod schemas
  </Card>

  <Card title="Python" icon="python" href="https://github.com/parsefy/parsefy-py">
    Type-safe extraction with Pydantic models
  </Card>
</CardGroup>

## JavaScript / TypeScript

### Installation

```bash theme={null}
npm install parsefy zod
```

### Requirements

* Node.js 18+
* Zod 3.x

### Quick example

```typescript theme={null}
import { Parsefy } from 'parsefy';
import * as z from 'zod';

const client = new Parsefy();

const schema = z.object({
  // REQUIRED - triggers fallback if below confidence threshold
  invoice_number: z.string().describe('The invoice number'),
  total: z.number().describe('Total amount including tax'),

  // OPTIONAL - won't trigger fallback if missing
  vendor: z.string().optional().describe('Vendor name'),
  due_date: z.string().optional().describe('Payment due date'),
});

const { object, metadata, verification, error } = await client.extract({
  file: './invoice.pdf',
  schema,
  confidenceThreshold: 0.85,
  enableVerification: true, // Enable math verification
});

if (!error && object) {
  console.log(object.invoice_number); // Fully typed!
  
  // Access field-level confidence from _meta
  console.log(`Overall confidence: ${object._meta.confidence_score}`);
  object._meta.field_confidence.forEach((fc) => {
    console.log(`${fc.field}: ${fc.score} (${fc.reason}) - "${fc.text}"`);
  });

  // Check verification results
  if (verification) {
    console.log(`Verification: ${verification.status}`);
  }
}
```

<Warning>
  **All fields are required by default.** Mark fields as `.optional()` if they might be missing in >20% of your documents to avoid triggering the expensive fallback model.
</Warning>

### Links

* [GitHub Repository](https://github.com/parsefy/parsefy-js)
* [npm Package](https://www.npmjs.com/package/parsefy)
* [Quickstart Guide](/quickstart/node/introduction)

***

## Python

### Installation

```bash theme={null}
pip install parsefy
```

### Requirements

* Python 3.10+
* Pydantic 2.0+

### Quick example

```python theme={null}
from parsefy import Parsefy
from pydantic import BaseModel, Field

client = Parsefy()

class Invoice(BaseModel):
    # REQUIRED - triggers fallback if below confidence threshold
    invoice_number: str = Field(description="The invoice number")
    total: float = Field(description="Total amount including tax")

    # OPTIONAL - won't trigger fallback if missing
    vendor: str | None = Field(default=None, description="Vendor name")
    due_date: str | None = Field(default=None, description="Payment due date")

result = client.extract(
    file="invoice.pdf",
    schema=Invoice,
    confidence_threshold=0.85,
    enable_verification=True  # Enable math verification
)

if result.error is None:
    print(result.data.invoice_number)  # Fully typed!
    
    # Access field-level confidence from meta
    if result.meta:
        print(f"Overall confidence: {result.meta.confidence_score}")
        for fc in result.meta.field_confidence:
            print(f"{fc.field}: {fc.score} ({fc.reason}) - '{fc.text}'")
    
    # Check verification results
    if result.verification:
        print(f"Verification: {result.verification.status}")
```

<Warning>
  **All fields are required by default.** Mark fields as `str | None = Field(default=None, ...)` if they might be missing in >20% of your documents to avoid triggering the expensive fallback model.
</Warning>

### Links

* [GitHub Repository](https://github.com/parsefy/parsefy-py)
* [PyPI Package](https://pypi.org/project/parsefy/)
* [Quickstart Guide](/quickstart/python/introduction)

***

## Community SDKs

We welcome community contributions! If you've built an SDK for another language, [let us know](mailto:support@parsefy.org).

### Building your own SDK

The Parsefy API is a simple REST API. Key endpoints:

| Method | Endpoint      | Description                 |
| ------ | ------------- | --------------------------- |
| `POST` | `/v1/extract` | Extract data from documents |
| `GET`  | `/health`     | Health check                |

See the [API Reference](/api-reference/introduction) 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.)
* **Confidence threshold**: Support `confidence_threshold` parameter (default: 0.85)
* **Math verification**: Support `enable_verification` parameter (default: false)
* **Field confidence**: Parse `_meta.field_confidence` array from `object` response
* **Verification**: Parse `verification` object from response when enabled
* **Error handling**: Distinguish HTTP errors from extraction errors
* **Retries**: Implement exponential backoff for rate limits

## Support

Need help with an SDK?

* [GitHub Issues](https://github.com/parsefy): Report bugs or request features
* [Email Support](mailto:support@parsefy.org): Get help from our team
