cloudconvert-sdk
Async Rust SDK primitives for the CloudConvert API v2.
The crate is built for Tokio applications that need to create CloudConvert jobs,
upload files, wait for results, download export/url outputs, inspect operation
metadata, verify webhooks, or use OAuth access tokens without hand-building
every request.
This is an unofficial library. For service behavior, scopes, formats, engines, regions, sandbox usage, and operation-specific options, use the official CloudConvert API documentation and the CloudConvert Job Builder.
Installation
[]
= "0.1"
= { = "1", = ["macros", "rt-multi-thread"] }
The crate is a library only. It does not install a binary.
Quick Start
Create an API key in the CloudConvert dashboard and export it:
Then build a job, wait for it, and download the export/url result:
use ;
async
For production workflows, prefer CloudConvert webhooks or Socket.io waits over long blocking waits.
Job Builders
CloudConvert jobs serialize tasks as an object keyed by task name. The SDK generates those names unless you choose to provide explicit names.
Linear Jobs
Use JobCreateRequest::linear() when every task feeds into the next task:
use ;
let request = linear
.import_url
.convert
.export_url
.build;
Use *_with(...) methods when a task needs options but the job is still
serial:
let request = linear
.import_url_with
.convert_with
.export_url_with
.build;
Graph Jobs
Use JobCreateRequest::graph(|job| ...) when a job branches, joins multiple
inputs, or needs to reference a non-adjacent task. Each graph method returns a
TaskName handle.
use ;
let request = graph
.tag
.build;
TaskName handles also work for multi-input operations such as merge,
watermarks that use an imported image file, and export/url tasks that archive
multiple outputs:
use ;
let request = graph
.tag
.build;
When the task name itself matters, use JobBuilder::task(...),
JobBuilder::add_named_task(...), or JobGraphBuilder::add_named_task(...).
For operations not yet typed by the SDK, use TaskRequest::custom(...).
File Extensions
Use FileExtension for known CloudConvert format tokens:
use ;
let task = new
.input_format;
Format setters still accept strings for forward compatibility. Strings are
normalized by trimming leading dots and lowercasing ASCII, so .PDF and PDF
serialize as pdf.
Uploads And Downloads
Use import/upload when your application already has the input file locally.
The job creation response contains the signed upload form; the SDK handles the
multipart upload helper.
use Path;
use ;
async
Download helpers never attach CloudConvert bearer credentials to signed storage URLs. Upload helpers submit to the signed form action returned by CloudConvert.
API Overview
The crate exports typed resource clients from CloudConvertClient:
jobs()creates, lists, fetches, waits for, redirects, and deletes jobs.tasks()creates standalone tasks, lists, fetches, waits for, cancels, retries, and deletes tasks.operations()lists operation metadata, options, engine versions, and can validate task payloads against returned metadata.users()reads the authenticated user.webhooks()creates, lists, and deletes webhooks.
Useful helpers:
download(...),download_stream(...), anddownload_to_path(...).upload_bytes(...),upload_body(...),upload_stream(...), andupload_path(...).sign_payload(...)andverify_signature(...)for webhook signatures.sign_job_url(...)for signed job-template URLs.socket_base_url(...),SocketChannel,JobSocketEvent, andTaskSocketEventfor Socket.io payloads.
Client setup supports API keys, OAuth access tokens, sandbox mode, custom
regions, custom base URLs, custom reqwest clients, transport timeouts, and the
optional retry and socket features.
OAuth 2.0
Use API keys for server-side integrations owned by one CloudConvert account. Use OAuth when your app acts on behalf of CloudConvert users.
use ;
async
OAuthAccessToken, OAuthRefreshToken, and OAuthClientSecret redact debug
output. OAuth-backed clients use the same SDK resources and Socket.io helpers as
API-key clients.
Operation Metadata
For metadata-driven integrations, call operations().list(...) with
include_options() or include_options_and_engine_versions():
use ;
async
Use option(...) builder methods, extra maps, or TaskRequest::custom(...)
for operation-specific options that are not yet typed by this SDK.
Retry
Automatic retry is off by default. Enable the optional feature and set a policy:
= { = "0.1", = ["retry"] }
use Duration;
use ;
let client = builder
.transport_config
.retry_policy
.build?;
Retry covers CloudConvert API and synchronous API requests for transient
statuses 429, 500, 502, 503, and 504, plus connect and timeout
errors. Signed import/upload form submissions and export/url downloads stay
outside that retry boundary.
Socket.io Waits
Enable the optional feature when an async application wants lower-latency completion than polling and does not expose a public webhook receiver:
= { = "0.1", = ["socket"] }
use ;
async
The managed wait helpers subscribe, check the current resource state to avoid missing fast completions, wait for a terminal Socket.io event, and disconnect. Use webhooks when CloudConvert can call your service directly.
For streams, use client.socket(...) with SocketChannel,
jobs().task_events_socket(job_id), or users().events_socket().
Runnable Examples
These examples build request payloads and print JSON. They do not call the live CloudConvert API, so they are safe to run without credentials:
Build Tasks
CI also generates an llvm-cov HTML coverage artifact and enforces the current
coverage threshold.
Live API Tests
Live CloudConvert tests are ignored by default so normal CI and cargo test do
not consume API credits.
Put a real key in .env or the process environment:
CLOUDCONVERT_API_KEY=...
Run the live group explicitly:
The live group keeps API usage small. It creates and deletes live tasks/jobs,
including a watermark job shape, and has one ignored upload/convert/export flow
with a tiny generated text file. It needs task/job scopes, not user.read.