Skip to main content

Installation

Quick start

Initialization

Config:
  • apiKey (required) – your D3 API key.
  • baseURL (optional) – API base URL, default: https://api.dragdropdo.com.
  • timeout (optional) – request timeout in ms, default: 30000.
  • headers (optional) – additional headers to send with every request.

File upload

Options:
  • file (required) – file path string.
  • fileName (required) – original file name.
  • mimeType (optional) – MIME type (auto‑detected if omitted).
  • parts (optional) – number of upload parts (auto‑calculated).
  • onProgress (optional) – progress callback.
Example:

Supported operations

Options:
  • ext (required) – file extension (e.g. pdf, jpg).
  • action (optional) – specific action (convert, compress, …).
  • parameters (optional) – parameters to validate (e.g. { convert_to: "png" }).
Examples:

Create operations

Options:
  • action (required) – "convert" | "compress" | "merge" | "zip" | "lock" | "unlock" | "reset_password".
  • fileKeys (required) – array of file keys from upload.
  • parameters (optional) – action‑specific parameters.
  • notes (optional) – user metadata.
Examples:

Convenience helpers

The client exposes shorthand helpers:

Status & polling

StatusOptions (used by getStatus):
  • mainTaskId (required) – main task ID from createOperation / convenience helpers.
  • fileKey (optional) – when set, requests status for that specific input file.
PollStatusOptions (extends StatusOptions; used by pollStatus):
  • Same fields as StatusOptions, plus:
  • interval (optional) – milliseconds between polls, default 2000.
  • timeout (optional) – maximum total polling time in milliseconds, default 300000 (5 minutes).
  • onUpdate (optional) – (status: StatusResponse) => void, invoked after each successful status fetch.
Examples:

Complete workflow example