Conversion Examples

Multiple outputs instead of zip

When creating a conversion that generates more than one output file – for example from video to images – the output will be a zip archive containing all the output files.

This behavior can be changed to download each file individually. For this, the allow_multiple_outputs option hasto be specified.

After sending this request, the job information received via callback or polling the status, you will receive a long list of elements inside the output section. In the example mentioned above, this equals one output per frame in the video.

Example Code

>POST /v2/jobs HTTP/1.1
Host: https://api.api2convert.com
X-Oc-Api-Key: <your API key here>
Content-Type: application/json
{
    "input": [{
        "type": "remote",
        "source": "https://example-files.online-convert.com/video/example.avi"
    }],
    "conversion": [{
        "category": "image",
        "target": "jpg",
        "options": {
            "allow_multiple_outputs": true
        }
    }]
}

Getting an image text to a document

This example explains how to convert an image containing text (e.g. a scanned book page) to a text file. For this, an option called OCR (Optical Character Recogniton) is used.

Please note that the language option can be set to specify which language the text is in. This can lead to a better conversion result.

Example Code

POST /v2/jobs HTTP/1.1
Host: api.api2convert.com
x-oc-api-key: <your API key here>
Content-Type: application/json
Cache-Control: no-cache

{
    "input": [{
        "type": "remote",
        "source": "https://example-files.online-convert.com/raster%20image/png/example.png"
    }],
    "conversion": [{
        "category": "document",
        "target": "txt",
        "options": {
            "ocr": true
        }
    }]
}