Upload API documentation

When source file must be converted multiple times, conversion performance can be increased by uploading file once and converting it multiple times without uploading it once again. Uploaded file will be stored in convertapi.com server for 3 hours and will be accessible just by conversion system. In conversion request file can be referred by File ID, which will be given after file upload. Another good side of uploaded file that conversion request can be formed just by URL query (no need for multipart or json formatters).


Request


Example:
POST https://v2.convertapi.com/upload?Secret=XXX

application/json

File data must be encoded with Base64 encoding.

{
    "FileUpload":{
        "FileName": "my_file.doc",
        "FileData": "--Base64 encoded file content--"
    }
}

multipart/form-data

Each request parameter must be in separate part.

Example:
POST /upload?secret=XXXX HTTP/1.1
Host: v2.convertapi.com
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----7MA4YWxkTrZu0gW

------7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="FileData"; filename="my_file.doc"
Content-Type: 

--FILE DATA--
------7MA4YWxkTrZu0gW--

application/octet-stream

Raw file data upload. Most simple and efficient upload type. Must be provided content-disposition header field with the file name.

Example:
POST /upload?secret=XXXX HTTP/1.1
Host: v2.convertapi.com
Content-Disposition: inline; filename="my_file.doc"
Cache-Control: no-cache

--FILE DATA--

Response


application/json

Returning File ID for further reference.

File upload result example:
{
    "FileId": "LCWS8IGD"
}

application/xml

XML scheme is analogous to JSON.

XML result example:
<FileUploadResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <FileId>UULJBJER</FileId>
</FileUploadResult>

text/plain

Response body is uploaded File ID.


Other actions


Upload from remote URL

If file is accessible by the URL, it can be uploaded directly from it's location.

Example:
POST https://v2.convertapi.com/upload-from-url?secret=XXX&url=http://example.com/file.doc&FileName=my_file.doc

Additionally can be provided "HeaderName" and "HeaderValue" parameters, needed for integration with third party systems like Google Drive.

Delete uploaded file

If file is no longer required it can be deleted.

Example for deleting uploaded file UULJBJER:
DELETE https://v2.convertapi.com/upload/UULJBJER 

HTTP Response Codes


200

Upload completed successfully.

500

Internal codes provided in response body:

  • 5007 - Unable to download remote file.