Conversion Workflows

Converted files that are stored on the convertapi.com server can be accessed for further conversion operations. This method allows conversion workflows without increased network load. Example: conversion PDF to JPG produces as many files as there are pages in PDF file. If these files are stored on the server and links to the files are passed to the ZIP converter, the result will be a single ZIP archive with JPG files of each PDF page. The StoreFile=true parameter must be set when calling the conversion endpoint.

The example below converts a PDF to JPG and stores the result on a server for further workflow processing.

Convert PDF to JPG - workflow step #1

[POST]
https://v2.convertapi.com/convert/pdf/to/jpg?Secret=your-api-secret
{
    "Parameters": [
        {
            "Name": "File",
            "FileValue": {
                "Name": "my_file.pdf",
                "Data": "--Base64 encoded file content--"
            }
        },
        {
            "Name": "StoreFile",
            "Value": true
        }
    ]
}
[response]
{
    "ConversionCost": 4,
    "Files": [
        {
            "FileName": "test.jpg",
            "FileSize": 526012,
            "FileId": "d57646acef91155eb7a57376e9cf8d55",
            "Url": "https://v2.convertapi.com/d/d57646acef91155eb7a57376e9cf8d55/test.jpg"
        },
        {
            "FileName": "test-2.jpg",
            "FileSize": 500216,
            "FileId": "dfaca13bc861c529d00d22cfacf71c63",
            "Url": "https://v2.convertapi.com/d/dfaca13bc861c529d00d22cfacf71c63/test-2.jpg"
        },
        {
            "FileName": "test-3.jpg",
            "FileSize": 516911,
            "FileId": "4c78541c67d66045dfe5378dc8852ae5",
            "Url": "https://v2.convertapi.com/d/4c78541c67d66045dfe5378dc8852ae5/test-3.jpg"
        }
    ]
}

Now we can get all result files from the above response and send them to a ZIP endpoint using the example below. To specify the file for further processing, we can either use the converted file's URL, or the FileId returned from the previous conversion.

ZIP all JPG files - workflow step #2

[POST] 
https://v2.convertapi.com/convert/any/to/zip?Secret=your-api-secret
{
    "Parameters": [
        {
            "Name": "Files",
            "FileValues": [
                {
                    "Url": "https://v2.convertapi.com/d/d57646acef91155eb7a57376e9cf8d55/test.jpg"
                },
                {
                    "Url": "https://v2.convertapi.com/d/dfaca13bc861c529d00d22cfacf71c63/test-2.jpg"
                },
                {
                    "Id": "d57646acef91155eb7a57376e9cf8d55"
                },
                {
                    "Id": "4c78541c67d66045dfe5378dc8852ae5"
                }
            ]
        },
        {
            "Name": "StoreFile",
            "Value": true
        }
    ]
}
[response]
{
    "ConversionCost": 1,
    "Files": [
        {
            "FileName": "test.zip",
            "FileSize": 1543732,
            "FileId": "2f742a059ab5ae601f41f4503bb2a7f5",
            "Url": "https://v2.convertapi.com/d/2f742a059ab5ae601f41f4503bb2a7f5/test.zip"
        }
    ]
}