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

# API Introduction

> Programmatic access to invoice processing

The VATextractREST API enables you to integrate invoice extraction into your applications.

## Base URL

```
https://vatextract.com/api
```

## Authentication

All API requests require authentication via Clerk. Include your session token in the Authorization header:

```bash theme={null}
Authorization: Bearer YOUR_SESSION_TOKEN
```

<Info>
  For server-to-server integrations, use API keys (coming soon). Contact support for early access.
</Info>

## Request Format

* **Content-Type**: `application/json` for most endpoints
* **File uploads**: `multipart/form-data`

## Response Format

All responses return JSON:

```json theme={null}
{
  "data": { ... },
  "error": null
}
```

### Error Responses

```json theme={null}
{
  "data": null,
  "error": "Unauthorized"
}
```

| Status Code | Description                          |
| ----------- | ------------------------------------ |
| 200         | Success                              |
| 400         | Bad request (invalid parameters)     |
| 401         | Unauthorized (missing/invalid token) |
| 404         | Resource not found                   |
| 500         | Server error                         |

## Rate Limiting

| Tier       | Requests/minute |
| ---------- | --------------- |
| Free       | 60              |
| Pro        | 300             |
| Enterprise | Custom          |

Rate limit headers are included in responses:

```
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 55
X-RateLimit-Reset: 1704067200
```

## Endpoints

<CardGroup cols={2}>
  <Card title="Upload Invoice" icon="upload" href="/docs/api-reference/upload">
    POST /api/upload
  </Card>

  <Card title="List Invoices" icon="list" href="/docs/api-reference/invoices">
    GET /api/invoices
  </Card>

  <Card title="Get Invoice" icon="file-invoice" href="/docs/api-reference/invoice-details">
    GET /api/invoices/:id
  </Card>

  <Card title="Export Data" icon="download" href="/docs/api-reference/export">
    GET /api/invoices/export
  </Card>
</CardGroup>

## SDKs

Official SDKs coming soon. For now, use standard HTTP clients:

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X GET https://vatextract.com/api/invoices \
      -H "Authorization: Bearer YOUR_TOKEN"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch('https://vatextract.com/api/invoices', {
      headers: {
        'Authorization': `Bearer ${token}`
      }
    });
    const data = await response.json();
    ```
  </Tab>
</Tabs>
