CDN vs API: This SDK is for the media REST API (convert, compress, trim, jobs, etc.). For on-the-fly image delivery (resize, WebP/AVIF, smart crop, Next.js loader), use
@convertly-sh/image and configure an origin source or Convertly Storage file id first.Create a client
baseUrl:
fetch implementation for testing or middleware:
Convert a file
Blob, ArrayBuffer, Uint8Array, or Buffer.
The synchronous media.convert and media.compress helpers send multipart file bytes to /api/convert and /api/compress. Remote HTTP(S) sourceUrl inputs are supported by media tools, signed transforms, and transfer jobs. Keep API keys on your server, worker, or trusted automation. For browser apps, call your own backend first and let that backend call Convertly.
Conversion options
| Option | Type | Description |
|---|---|---|
format | string | Required. Target format: jpg, png, webp, avif, svg, mp4, webm, mov, mp3, wav, ogg, m4a, flac, pdf, etc. |
compression | string | Image compression preset: high, balanced, ultra. |
resize | string | Resize strategy: fit, fill, cover, contain. |
resizeWidth | number | Target width in pixels. |
resizeHeight | number | Target height in pixels. |
autoOrient | boolean | Auto-rotate based on EXIF. Default true. |
mono | boolean | For SVG tracing: true for monochrome, false to preserve color. |
saveToStorage | boolean | Save the output to Convertly Storage. |
saveToStorage: true only when your app needs Convertly to keep a durable stored-file record.
For raster-to-SVG conversion, color is preserved by default. Set mono: true only for monochrome tracing:
Compress a file
Compression options
| Option | Type | Description |
|---|---|---|
mode | "quality" | "target-size" | quality uses a 1-100 level. target-size aims for a specific byte count. |
quality | number | 1-100 quality level. Higher is better quality, larger file. |
targetBytes | number | Target file size in bytes when mode is target-size. |
lossless | boolean | Use lossless compression where supported. |
stripMetadata | boolean | Remove EXIF and metadata. |
saveToStorage | boolean | Save the output to Convertly Storage. |
saveToStorage: true.
Media tools
All media tools accept the same file input pattern (file, sourceUrl, or string URL) and support async: true for long-running operations.
Background removal
Thumbnails and poster frames
Watermark
PDF tools
Metadata and inspection
Signed transforms
Generate a time-limited signed URL for on-the-fly image transforms without uploading:Full tool list
thumbnailpdfPreviewimageToPdfstripMetadataposterFrameextractAudiowatermarkinspecttrimgifstoryboardtransformremoveBackgroundsignedTransformtransfer
Transfer and download files
Download a remote file through Convertly, optionally extracting archives:destination: "convertly-storage" are queued by default and return a jobId. Poll with convertly.jobs.get(jobId) or wait with convertly.jobs.wait(jobId) to read the stored-file result.
Async jobs
Long-running operations (video conversion, bulk processing, etc.) return a job you can poll.Queue a video trim
Job management
Convertly Storage
List, upload, update, and delete files and folders in Convertly Storage. API keys with storage disabled return403; use a workspace API key or a WordPress site token with isolated storage when needed.
List files and folders
folderId: null or parentId: null for workspace root.
Upload files
The SDK picks a strategy automatically: multipart for files under 8 MiB, presigned direct-to-storage above that threshold.Presigned upload sessions
For resumable or custom upload flows, use the lower-level session API:Update and delete
Video stream lifecycle
Create streams from stored videos, then manage metadata, captions, chapters, posters, and thumbnail candidates.@convertly-sh/player — the SDK covers server-side stream management, not the browser player UI.
Error handling
The SDK throwsConvertlyError on non-2xx responses. The error includes the HTTP status and parsed response body:
Method reference
| Method | Description |
|---|---|
new Convertly(options) | Create a client. Options: apiKey, baseUrl?, fetch?. |
convertly.media.convert(opts) | Convert a file to another format. |
convertly.media.compress(opts) | Compress an image or document. |
convertly.media.thumbnail(opts) | Generate a thumbnail or poster frame. |
convertly.media.removeBackground(opts) | Remove the background from an image. |
convertly.media.watermark(opts) | Add a text or image watermark. |
convertly.media.pdfPreview(opts) | Render a PDF page to an image. |
convertly.media.imageToPdf(opts) | Convert images to a PDF. |
convertly.media.stripMetadata(opts) | Remove EXIF and metadata. |
convertly.media.inspect(opts) | Inspect file properties. |
convertly.media.trim(opts) | Trim video or audio. |
convertly.media.gif(opts) | Create a GIF from video. |
convertly.media.storyboard(opts) | Generate a video storyboard. |
convertly.media.transform(opts) | Apply transforms to an image. |
convertly.media.transfer(opts) | Download or transfer a remote file. |
convertly.media.signedTransform(opts) | Generate a signed transform URL. |
convertly.video.streams.create(opts) | Create an HLS/DASH video streaming asset from a stored video. |
convertly.video.streams.list(opts?) | List video streaming assets. |
convertly.video.streams.get(id) | Get a video streaming asset with renditions, captions, and analytics counts. |
convertly.video.streams.update(id, opts) | Update title, description, tags, or engagement settings. |
convertly.video.streams.delete(id) | Delete a video streaming asset. |
convertly.video.streams.addCaptions(id, track) | Add or replace a WebVTT caption track. |
convertly.video.streams.removeCaption(id, captionId) | Remove a caption track. |
convertly.video.streams.replaceChapters(id, chapters) | Replace chapter markers. |
convertly.video.streams.removeChapter(id, chapterId) | Remove one chapter. |
convertly.video.streams.setPosterFromTime(id, seconds) | Generate a poster frame from the source video. |
convertly.video.streams.uploadPoster(id, file, filename?, contentType?) | Upload a custom poster image. |
convertly.video.streams.listThumbnailCandidates(id) | List generated thumbnail candidates. |
convertly.storage.files.list(opts?) | List Convertly Storage files with pagination. |
convertly.storage.files.get(id) | Fetch file metadata and a short-lived download URL. |
convertly.storage.files.upload(opts) | Upload via multipart or presigned direct-to-storage. |
convertly.storage.files.update(id, opts) | Rename, slug, or update library metadata. |
convertly.storage.files.search(opts?) | Faceted library search with tags, orientation, and facet counts. |
convertly.storage.files.delete(id) | Delete a stored file. |
convertly.ai.tagFile(id, opts?) | AI-generate and persist image tags (Forma AI quota). |
convertly.library.taxonomy.list(opts?) | List taxonomy terms for a locale. |
convertly.library.taxonomy.create(opts) | Create a taxonomy term with optional synonyms. |
convertly.library.taxonomy.update(id, opts) | Update a taxonomy term or replace synonyms. |
convertly.library.taxonomy.delete(id) | Delete a taxonomy term. |
convertly.storage.folders.list(opts?) | List folders. |
convertly.storage.folders.create(opts) | Create a folder. |
convertly.storage.folders.update(id, opts) | Rename or move a folder. |
convertly.storage.folders.delete(id) | Delete a folder and nested contents. |
convertly.storage.uploads.createSession(opts) | Start a presigned upload session. |
convertly.storage.uploads.putObject(session, bytes, contentType?) | PUT bytes to the signed upload URL. |
convertly.storage.uploads.complete(body) | Finalize a presigned upload as a stored file. |
convertly.jobs.get(id) | Get a job by ID. |
convertly.jobs.list() | List recent jobs. |
convertly.jobs.cancel(id) | Cancel a pending job. |
convertly.jobs.wait(id, opts?) | Poll until a job completes or fails. |
Other languages
Convertly ships first-party SDKs for JavaScript/TypeScript and PHP. For Python, Go, Ruby, Java, or .NET, use the REST API with your HTTP client of choice.- OpenAPI spec: openapi.json (also wired into the Mintlify API Reference)
- Generate clients with OpenAPI Generator or your platform’s codegen tooling
- Webhooks, workflows, and CDN configuration remain REST-first — see the API Reference