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

# Edit

> Fill PDF forms and modify DOCX documents using the JavaScript SDK

The `edit.run()` method fills PDF forms and modifies DOCX documents programmatically.

***

## Basic Usage

```javascript theme={null}
import Reducto from 'reductoai';
import fs from 'fs';

const client = new Reducto();

// Upload a form
const upload = await client.upload({ 
  file: fs.createReadStream("application.pdf") 
});

// Fill the form with instructions
const result = await client.edit.run({
  document_url: upload.file_id,
  edit_instructions: "Fill in the form with: name='John Doe', email='john@example.com', date='12/25/2024'"
});

// Download the filled form
const filledPdfUrl = result.document_url;
```

***

## Method Signatures

### Synchronous Edit

```typescript theme={null}
edit.run(params: {
  document_url: string | Upload;
  edit_instructions: string;
  edit_options?: {
    color?: string;
    enable_overflow_pages?: boolean;
    llm_provider_preference?: "openai" | "anthropic" | "google" | null;
  };
  form_schema?: Array<{
    bbox: BoundingBox;
    description: string;
    type: "text" | "checkbox" | "dropdown" | "barcode";
    fill?: boolean;
    value?: string | null;
  }> | null;
  priority?: boolean;
}, options?: RequestOptions): Promise<EditResponse>
```

### Asynchronous Edit

```typescript theme={null}
edit.runJob(params: {
  document_url: string | Upload;
  edit_instructions: string;
  edit_options?: {
    color?: string;
    enable_overflow_pages?: boolean;
    llm_provider_preference?: "openai" | "anthropic" | "google" | null;
  };
  form_schema?: Array<{
    bbox: BoundingBox;
    description: string;
    type: "text" | "checkbox" | "dropdown" | "barcode";
    fill?: boolean;
    value?: string | null;
  }> | null;
  priority?: boolean;
  webhook?: WebhookConfigNew;
}, options?: RequestOptions): Promise<EditRunJobResponse>
```

***

## Form Schema

For PDF forms, you can provide a schema with bounding boxes:

```javascript theme={null}
const result = await client.edit.run({
  document_url: upload.file_id,
  edit_instructions: "Fill the form with the provided data",
  form_schema: [
    {
      bbox: { left: 100, top: 200, width: 200, height: 30, page: 1 },
      description: "Name field",
      type: "text",
      value: "John Doe"
    },
    {
      bbox: { left: 100, top: 250, width: 200, height: 30, page: 1 },
      description: "Email field",
      type: "text",
      value: "john@example.com"
    }
  ]
});
```

***

## Next Steps

* Learn about [form schema design](/configs/edit/form-schema)
* Check out the [edit overview](/editing/edit-overview) for more details
