This is the API v2 documentation. API v2 is currently in preview state and not recommended for production use! Read more about API v2 in our blog post.

Optimize Files

Create optimize tasks

Create a task to optimize and compress a file. Currently supported formats are PDF, PNG and JPG.

Arguments
input string or array, required The ID of the input task for the conversion, normally the import task. Multiple task IDs can be provided as an array.
input_format string, optional The current format of the file, e.g. pdf. If not set, the extension of the input file is used as input format.
engine string, optional Use a specific engine for the conversion.
engine_version string, optional Use a specific engine version for the conversion.
filename string, optional Choose a filename (including extension) for the output file.
... optional Conversion and engine specific options. Depends on input_format.
Select the output format above to show additional conversion options.
{{ option.name }} optional, {{ option.type }} Defaults to {{ option.default }}. Possible values: , .
web Optimization for the web (Default profile)
  • Remove redundant and unnecessary data for the web
  • Down-sample, clip, and intelligently compress images
  • Merge and subset fonts
  • Convert colors to RGB
print Optimization for print
  • Remove redundant and unnecessary data for printing
  • Down-sample, clip, and intelligently compress images
  • Merge and subset fonts
  • Convert colors to CMYK
archive Optimization for archiving purposes
  • Remove redundant and unnecessary data for archiving
  • Intelligently compress images
  • Merge and subset fonts
mrc Optimization for scanned images
  • Profile optimized for PDFs that mainly consist of raster images
  • Compress the images without significantly reducing the visual quality
max Optimization for maximal size reduction
  • Use the maximal possible compression
  • Might reduce the visual quality

Returns

The created task. You can find details about the task model response in the documentation about the show tasks endpoint.

Endpoint

POST https://api.cloudconvert.com/v2/optimize

Example Request

$ curl -X POST "https://api.cloudconvert.com/v2/optimize" \
       -H "Authorization: Bearer API_KEY" \
       -H "Content-type: application/json" \
       -d '{
  "input": "73df1e16-fd8b-47a1-a156-f197babde91a",
  "input_format": "pdf",
  "profile": "web"
}'

Example Response

{
  "data": {
    "id": "c85f3ca9-164c-4e89-8ae2-c08192a7cb08",
    "operation": "optimize",
    "status": "processing",
    "message": null,
    "created_at": "2018-09-19T14:42:58+00:00",
    "started_at": "2018-09-19T14:42:58+00:00",
    "ended_at": null,
    "depends_on_tasks": {},
    "engine": "3heights",
    "engine_version": "4.12",
    "payload": {
      "input": "73df1e16-fd8b-47a1-a156-f197babde91a",
      "input_format": "pdf",
      "profile": "web"
    },
    "result": null
  }
}