> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://idpdocs.runautomat.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://idpdocs.runautomat.com/_mcp/server.

# Quickstart

## Prerequisites

Before you begin, you'll need:

* An Automat account ([sign up here](https://idp.runautomat.com/signup))
* An API key ([see Authentication](/guides/authentication))
* An extractor configured in your dashboard

## Step 1: Create an Extractor

#### Go to Extractors

Navigate to your project in the [Automat Dashboard](https://idp.runautomat.com) and click **Create Extractor**

#### Define Your Schema

Use the visual editor to define what fields you want to extract. For example, for an invoice:

```json
{
  "invoice_number": "string",
  "date": "string",
  "total_amount": "number",
  "vendor_name": "string",
  "line_items": [{
    "description": "string",
    "quantity": "number",
    "unit_price": "number"
  }]
}
```

#### Test in Playground

Upload a sample document to test your extractor before using the API

#### Copy Extractor ID

Once satisfied, copy the extractor ID (e.g., `ext_abc123`) for API use

## Step 2: Make Your First API Request

### Using cURL

```bash
curl -X POST https://inference.runautomat.com/api/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "extractorId=YOUR_EXTRACTOR_ID" \
  -F "file=@path/to/your/document.pdf"
```

### Using the TypeScript SDK

```bash
npm install @automat/sdk
```

```typescript
import { AutomatClient } from '@automat/sdk';
import fs from 'fs';

const client = new AutomatClient({
  apiKey: process.env.AUTOMAT_API_KEY,
});

async function extractDocument() {
  const result = await client.extract({
    extractorId: 'ext_abc123',
    file: fs.createReadStream('invoice.pdf'),
  });

  if (result.success) {
    console.log('Extracted data:', result.data);
  } else {
    console.error('Extraction failed:', result.error);
  }
}

extractDocument();
```

### Using the Python SDK

```bash
pip install automat-sdk
```

```python
from automat import AutomatClient
import os

client = AutomatClient(api_key=os.environ["AUTOMAT_API_KEY"])

with open("invoice.pdf", "rb") as f:
    result = client.extract(
        extractor_id="ext_abc123",
        file=f,
    )

if result.success:
    print("Extracted data:", result.data)
else:
    print("Extraction failed:", result.error)
```

## Step 3: Handle the Response

A successful response looks like:

```json
{
  "success": true,
  "data": {
    "invoice_number": "INV-2024-001",
    "date": "2024-01-15",
    "total_amount": 1250.00,
    "vendor_name": "Acme Corp",
    "line_items": [
      {
        "description": "Widget A",
        "quantity": 10,
        "unit_price": 100.00
      },
      {
        "description": "Widget B", 
        "quantity": 5,
        "unit_price": 50.00
      }
    ]
  }
}
```

The `data` field contains the extracted information matching your extractor's schema.

## Alternative Input Methods

### Extract from URL

If your document is publicly accessible, you can pass a URL instead of uploading:

```bash
curl -X POST https://inference.runautomat.com/api/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "extractorId=ext_abc123" \
  -F "file=https://example.com/invoice.pdf" \
  -F "mimeType=application/pdf"
```

> **Note**
>
> When using a URL, you must also provide the `mimeType` field.

### Extract from Base64

For base64-encoded documents:

```typescript
const result = await client.extract({
  extractorId: 'ext_abc123',
  file: base64EncodedDocument,
  mimeType: 'application/pdf',
});
```

## Error Handling

Always handle potential errors in your integration:

```typescript
try {
  const result = await client.extract({
    extractorId: 'ext_abc123',
    file: fs.createReadStream('document.pdf'),
  });
  
  if (!result.success) {
    // Handle extraction error (e.g., invalid document)
    console.error('Extraction error:', result.error);
    return;
  }
  
  // Process successful extraction
  processData(result.data);
  
} catch (error) {
  // Handle network/authentication errors
  if (error.statusCode === 401) {
    console.error('Invalid API key');
  } else if (error.statusCode === 400) {
    console.error('Bad request:', error.message);
  } else {
    console.error('Unexpected error:', error);
  }
}
```

## Next Steps

#### [Extractors](/guides/extractors)

Learn more about creating and managing extractors

#### [Schemas](/guides/schemas)

Advanced schema configuration options

#### [API Reference](/api-reference)

Complete API documentation

#### [Error Codes](/api-reference/errors)

Full list of error codes and handling