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

# Operations

> Create file operations such as convert, compress, merge, zip, and PDF utilities.

Operations are created via:

```http theme={null}
POST /api/v1/do
Authorization: Bearer <your-api-key>
Content-Type: application/json
```

## Request schema (`ExternalDoRequest`)

```json theme={null}
{
  "action": "convert",
  "file_keys": ["file_key_1", "file_key_2"],
  "parameters": {
    "convert_to": "png"
  },
  "notes": {
    "user_id": "user-123",
    "source": "api"
  }
}
```

* `action` (**required**) – the operation to perform:
  * `"convert"`
  * `"compress"`
  * `"merge"`
  * `"zip"`
  * `"lock"`
  * `"unlock"`
  * `"reset_password"`
* `file_keys` (**required**) – array of one or more file keys returned by upload.
* `parameters` (optional) – action‑specific parameters (see below).
* `notes` (optional) – arbitrary key‑value metadata persisted alongside the external operation.

**Response (`ExternalDoResponse`):**

```json theme={null}
{
  "main_task_id": "task_abc123"
}
```

Use `main_task_id` for status polling and correlating webhook notifications.

## Create an operation

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "convert",
      "file_keys": ["file_key_1"],
      "parameters": {
        "convert_to": "png"
      },
      "notes": {
        "user_id": "user-123",
        "source": "api"
      }
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Using convenience method
  const operation = await client.convert(["file_key_1"], "png", {
    user_id: "user-123",
    source: "api",
  });

  // Or using createOperation
  const operation = await client.createOperation({
    action: "convert",
    fileKeys: ["file_key_1"],
    parameters: {
      convert_to: "png",
    },
    notes: {
      user_id: "user-123",
      source: "api",
    },
  });

  console.log("Main task ID:", operation.mainTaskId);
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Using convenience method
  operation = client.convert(
      file_keys=["file_key_1"],
      convert_to="png",
      notes={"user_id": "user-123", "source": "api"}
  )

  # Or using create_operation
  operation = client.create_operation(
      action="convert",
      file_keys=["file_key_1"],
      parameters={"convert_to": "png"},
      notes={"user_id": "user-123", "source": "api"}
  )

  print("Main task ID:", operation.main_task_id)
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Using convenience method
  $operation = $client->convert(
      ['file_key_1'],
      'png',
      ['user_id' => 'user-123', 'source' => 'api']
  );

  // Or using createOperation
  $operation = $client->createOperation([
      'action' => 'convert',
      'file_keys' => ['file_key_1'],
      'parameters' => ['convert_to' => 'png'],
      'notes' => ['user_id' => 'user-123', 'source' => 'api'],
  ]);

  echo "Main task ID: " . $operation['main_task_id'] . "\n";
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Using convenience method
  operation = client.convert(
    file_keys: ['file_key_1'],
    convert_to: 'png',
    notes: { user_id: 'user-123', source: 'api' }
  )

  # Or using create_operation
  operation = client.create_operation(
    action: 'convert',
    file_keys: ['file_key_1'],
    parameters: { convert_to: 'png' },
    notes: { user_id: 'user-123', source: 'api' }
  )

  puts "Main task ID: #{operation[:main_task_id]}"
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Using convenience method
  operation, _ := client.Convert(
      []string{"file_key_1"},
      "png",
      map[string]string{"user_id": "user-123", "source": "api"},
  );

  // Or using CreateOperation
  operation, _ := client.CreateOperation(d3.OperationOptions{
      Action:   "convert",
      FileKeys: []string{"file_key_1"},
      Parameters: map[string]interface{}{
          "convert_to": "png",
      },
      Notes: map[string]string{"user_id": "user-123", "source": "api"},
  });

  fmt.Printf("Main task ID: %s\n", operation.MainTaskID)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import com.dragdropdo.sdk.models.*;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Using convenience method
  OperationResponse operation = client.convert(
      List.of("file_key_1"),
      "png",
      Map.of("user_id", "user-123", "source", "api")
  );

  // Or using createOperation
  operation = client.createOperation(new OperationOptions(
      "convert",
      List.of("file_key_1"),
      Map.of("convert_to", "png"),
      Map.of("user_id", "user-123", "source", "api")
  ));

  System.out.println("Main task ID: " + operation.getMainTaskId());
  ```
</CodeGroup>

## Supported operations

Before creating an operation, you can validate that a given extension and action are supported:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/supported-operation \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "ext":"jpg",
      "action": "CONVERT",
      "parameters": {
          "convert_to": "png"
      }
    }'
  ```

  ```text theme={null}
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Using convenience method
  const operation = await client.convert(["file_key_1"], "png", {
    user_id: "user-123",
    source: "api",
  });

  // Or using createOperation
  const operation = await client.createOperation({
    action: "convert",
    fileKeys: ["file_key_1"],
    parameters: {
      convert_to: "png",
    },
    notes: {
      user_id: "user-123",
      source: "api",
    },
  });

  console.log("Main task ID:", operation.mainTaskId);
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Using convenience method
  operation = client.convert(
      file_keys=["file_key_1"],
      convert_to="png",
      notes={"user_id": "user-123", "source": "api"}
  )

  # Or using create_operation
  operation = client.create_operation(
      action="convert",
      file_keys=["file_key_1"],
      parameters={"convert_to": "png"},
      notes={"user_id": "user-123", "source": "api"}
  )

  print("Main task ID:", operation.main_task_id)
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Using convenience method
  $operation = $client->convert(
      ['file_key_1'],
      'png',
      ['user_id' => 'user-123', 'source' => 'api']
  );

  // Or using createOperation
  $operation = $client->createOperation([
      'action' => 'convert',
      'file_keys' => ['file_key_1'],
      'parameters' => ['convert_to' => 'png'],
      'notes' => ['user_id' => 'user-123', 'source' => 'api'],
  ]);

  echo "Main task ID: " . $operation['main_task_id'] . "\n";
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Using convenience method
  operation = client.convert(
    file_keys: ['file_key_1'],
    convert_to: 'png',
    notes: { user_id: 'user-123', source: 'api' }
  )

  # Or using create_operation
  operation = client.create_operation(
    action: 'convert',
    file_keys: ['file_key_1'],
    parameters: { convert_to: 'png' },
    notes: { user_id: 'user-123', source: 'api' }
  )

  puts "Main task ID: #{operation[:main_task_id]}"
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Using convenience method
  operation, _ := client.Convert(
      []string{"file_key_1"},
      "png",
      map[string]string{"user_id": "user-123", "source": "api"},
  );

  // Or using CreateOperation
  operation, _ := client.CreateOperation(d3.OperationOptions{
      Action:   "convert",
      FileKeys: []string{"file_key_1"},
      Parameters: map[string]interface{}{
          "convert_to": "png",
      },
      Notes: map[string]string{"user_id": "user-123", "source": "api"},
  });

  fmt.Printf("Main task ID: %s\n", operation.MainTaskID)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import com.dragdropdo.sdk.models.*;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Using convenience method
  OperationResponse operation = client.convert(
      List.of("file_key_1"),
      "png",
      Map.of("user_id", "user-123", "source", "api")
  );

  // Or using createOperation
  operation = client.createOperation(new OperationOptions(
      "convert",
      List.of("file_key_1"),
      Map.of("convert_to", "png"),
      Map.of("user_id", "user-123", "source", "api")
  ));

  System.out.println("Main task ID: " + operation.getMainTaskId());
  ```
</CodeGroup>

Server‑side this is backed by `SupportedOperationRequest` / `SupportedOperationResponse`:

```ts theme={null}
type SupportedOperationRequest = {
  ext: string;
  action?: string;
  parameters?: Record<string, unknown>;
};

type SupportedOperationResponse = {
  supported: boolean;
  ext: string;
  action?: string;
  available_actions?: string[];
  parameters?: Record<string, unknown>;
};
```

Example responses:

* **Only `ext` provided** – returns `available_actions` for that extension.
* **`ext` + `action`** – returns `supported` + `parameters` metadata, such as:
  * valid `convert_to` targets for `convert`
  * valid `compression_value` options for `compress`

## Action‑specific parameters

### Convert

* `convert_to` (**required**) – target format (e.g. `pdf`, `png`, `docx`).

Common use cases:

* Document: `docx → pdf`, `pdf → docx`, `pptx → pdf`.
* Image: `jpg → png`, `png → webp`.
* Media: `mp4 → mp3`, `wav → mp3`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "convert",
      "file_keys": ["file_key_1"],
      "parameters": {
        "convert_to": "pdf"
      }
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Convert PDF to PNG
  const operation = await client.convert(["file_key_1"], "png");

  // Convert DOCX to PDF
  const operation = await client.convert(["file_key_1"], "pdf");
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Convert PDF to PNG
  operation = client.convert(["file_key_1"], "png")

  # Convert DOCX to PDF
  operation = client.convert(["file_key_1"], "pdf")
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Convert PDF to PNG
  $operation = $client->convert(['file_key_1'], 'png');

  // Convert DOCX to PDF
  $operation = $client->convert(['file_key_1'], 'pdf');
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Convert PDF to PNG
  operation = client.convert(file_keys: ['file_key_1'], convert_to: 'png')

  # Convert DOCX to PDF
  operation = client.convert(file_keys: ['file_key_1'], convert_to: 'pdf')
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Convert PDF to PNG
  operation, _ := client.Convert([]string{"file_key_1"}, "png", nil)

  // Convert DOCX to PDF
  operation, _ := client.Convert([]string{"file_key_1"}, "pdf", nil)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Convert PDF to PNG
  OperationResponse operation = client.convert(List.of("file_key_1"), "png", null);

  // Convert DOCX to PDF
  operation = client.convert(List.of("file_key_1"), "pdf", null);
  ```
</CodeGroup>

### Compress

* `compression_value` – compression level such as `recommended_compression`, `extreme_compression`, or `less_compression` (see supported‑operation metadata).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "compress",
      "file_keys": ["file_key_1"],
      "parameters": {
        "compression_value": "recommended_compression"
      }
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Compress with recommended level
  const operation = await client.compress(["file_key_1"], "recommended");
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Compress with recommended level
  operation = client.compress(["file_key_1"], "recommended")
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Compress with recommended level
  $operation = $client->compress(['file_key_1'], 'recommended');
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Compress with recommended level
  operation = client.compress(file_keys: ['file_key_1'], compression_value: 'recommended')
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Compress with recommended level
  operation, _ := client.Compress([]string{"file_key_1"}, "recommended", nil)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Compress with recommended level
  OperationResponse operation = client.compress(List.of("file_key_1"), "recommended", null);
  ```
</CodeGroup>

### Merge

Merges multiple compatible files (typically PDFs) into a single output file.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "merge",
      "file_keys": ["file_key_1", "file_key_2"]
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Merge multiple PDFs
  const operation = await client.merge(["file_key_1", "file_key_2"]);
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Merge multiple PDFs
  operation = client.merge(["file_key_1", "file_key_2"])
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Merge multiple PDFs
  $operation = $client->merge(['file_key_1', 'file_key_2']);
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Merge multiple PDFs
  operation = client.merge(file_keys: ['file_key_1', 'file_key_2'])
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Merge multiple PDFs
  operation, _ := client.Merge([]string{"file_key_1", "file_key_2"}, nil)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Merge multiple PDFs
  OperationResponse operation = client.merge(List.of("file_key_1", "file_key_2"), null);
  ```
</CodeGroup>

### Zip

Creates a zip archive containing the given files.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "zip",
      "file_keys": ["file_key_1", "file_key_2"]
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Create zip archive
  const operation = await client.zip(["file_key_1", "file_key_2"]);
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Create zip archive
  operation = client.zip(["file_key_1", "file_key_2"])
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Create zip archive
  $operation = $client->zip(['file_key_1', 'file_key_2']);
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Create zip archive
  operation = client.zip(file_keys: ['file_key_1', 'file_key_2'])
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Create zip archive
  operation, _ := client.Zip([]string{"file_key_1", "file_key_2"}, nil)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Create zip archive
  OperationResponse operation = client.zip(List.of("file_key_1", "file_key_2"), null);
  ```
</CodeGroup>

### Lock PDF

Protects PDFs with a password.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "lock",
      "file_keys": ["file_key_1"],
      "parameters": {
        "password": "secure-password"
      }
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Lock PDF with password
  const operation = await client.lockPdf(["file_key_1"], "secure-password");
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Lock PDF with password
  operation = client.lock_pdf(["file_key_1"], "secure-password")
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Lock PDF with password
  $operation = $client->lockPdf(['file_key_1'], 'secure-password');
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Lock PDF with password
  operation = client.lock_pdf(file_keys: ['file_key_1'], password: 'secure-password')
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Lock PDF with password
  operation, _ := client.LockPdf([]string{"file_key_1"}, "secure-password", nil)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Lock PDF with password
  OperationResponse operation = client.lockPdf(List.of("file_key_1"), "secure-password", null);
  ```
</CodeGroup>

### Unlock PDF

Removes password protection from PDFs.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "unlock",
      "file_keys": ["file_key_1"],
      "parameters": {
        "password": "current-password"
      }
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Unlock PDF
  const operation = await client.unlockPdf(["file_key_1"], "current-password");
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Unlock PDF
  operation = client.unlock_pdf(["file_key_1"], "current-password")
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Unlock PDF
  $operation = $client->unlockPdf(['file_key_1'], 'current-password');
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Unlock PDF
  operation = client.unlock_pdf(file_keys: ['file_key_1'], password: 'current-password')
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Unlock PDF
  operation, _ := client.UnlockPdf([]string{"file_key_1"}, "current-password", nil)
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Unlock PDF
  OperationResponse operation = client.unlockPdf(List.of("file_key_1"), "current-password", null);
  ```
</CodeGroup>

### Reset PDF password

Changes the password on password‑protected PDFs.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dragdropdo.com/api/v1/do \
    -H "Authorization: Bearer your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "reset_password",
      "file_keys": ["file_key_1"],
      "parameters": {
        "old_password": "old",
        "new_password": "new"
      }
    }'
  ```

  ```ts NODE theme={null}
  import { Dragdropdo } from "dragdropdo-sdk";

  const client = new Dragdropdo({
    apiKey: "your-api-key",
    baseURL: "https://api.dragdropdo.com",
  });

  // Reset PDF password
  const operation = await client.resetPdfPassword(
    ["file_key_1"],
    "old-password",
    "new-password"
  );
  ```

  ```python PYTHON theme={null}
  from dragdropdo_sdk import Dragdropdo, D3ClientConfig

  client = Dragdropdo(
      api_key="your-api-key",
      base_url="https://api.dragdropdo.com"
  )

  # Reset PDF password
  operation = client.reset_pdf_password(
      ["file_key_1"],
      "old-password",
      "new-password"
  )
  ```

  ```php PHP theme={null}
  use DragdropdoSdk\Dragdropdo;

  $client = new Dragdropdo([
      'api_key' => 'your-api-key',
      'base_url' => 'https://api.dragdropdo.com',
  ]);

  // Reset PDF password
  $operation = $client->resetPdfPassword(['file_key_1'], 'old-password', 'new-password');
  ```

  ```ruby RUBY theme={null}
  require 'dragdropdo_sdk'

  client = DragdropdoSdk::Dragdropdo.new(
    api_key: 'your-api-key',
    base_url: 'https://api.dragdropdo.com'
  )

  # Reset PDF password
  operation = client.reset_pdf_password(
    file_keys: ['file_key_1'],
    old_password: 'old-password',
    new_password: 'new-password'
  )
  ```

  ```go GO theme={null}
  import "github.com/d3/dragdropdo-sdk-go"

  client, _ := d3.NewDragdropdo(d3.Config{
      APIKey:  "your-api-key",
      BaseURL: "https://api.dragdropdo.com",
  });

  // Reset PDF password
  operation, _ := client.ResetPdfPassword(
      []string{"file_key_1"},
      "old-password",
      "new-password",
      nil,
  )
  ```

  ```java JAVA theme={null}
  import com.dragdropdo.sdk.Dragdropdo;
  import com.dragdropdo.sdk.DragdropdoConfig;
  import java.util.*;

  Dragdropdo client = new Dragdropdo(
      new DragdropdoConfig("your-api-key")
          .setBaseUrl("https://api.dragdropdo.com")
  );

  // Reset PDF password
  OperationResponse operation = client.resetPdfPassword(
      List.of("file_key_1"),
      "old-password",
      "new-password",
      null
  );
  ```
</CodeGroup>
