Introduction

This documentation provides a detailed step-by-step guide on how to do conversions using the Hipdf API. For using the Hipdf API you need your personal API Key, which can be found on your dashboard. For API support please feel free to Contact Us.

The Hipdf API follows the basic standards for REST APIs. All requests and responses are UTF8 encoded JSON.

For doing POST requests to the API the requests have to be formatted as shown:

Example Request

POST

{{ interface.apiHost + interface.convert }}

headers Content-Type: application/json Authorization: your_security_code
{ "file_id": '<your_file_id>', "action": 'pdf_to_doc', "waiting": false }

Example for API Key

Please put the key into the Authorization header. And add Authorization header in every request.

Authorization: gAAAAABcODuFKMEGGoP9HCaGa_V5kXG6ejuf0VcfRWMWUTSPT8W-BdczWvrOv4wVsV9NrouNvHhLhEeCo7Fh1rXniWbJYCde6lG1NIcLNR68opthGcmHfXk=

Upload of the input file

Parameterstyperequireddescription
filefiletrueThe input file stream.

Request

POST

{{ interface.apiHost + interface.upload }}

headers Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryrdienUkAMhJIsQBB Authorization: your_security_code
form/data ------WebKitFormBoundaryrdienUkAMhJIsQBB Content-Disposition: form-data; name="file"; filename="file.pdf" Content-Type: application/pdf ...
------WebKitFormBoundaryrdienUkAMhJIsQBB--

Response

{ "status": 0, "msg": "Successfully.", "data": { "file_id": "0000-bc1d-1683-1ee7-aea", "file_name": "file.pdf", "remote_path": "files/0000-bc1d-1683-1ee7-aea.pdf", "file_size": 26112 } }
Get this file_id: $data.file_id Save this file_id as your_file_id for the next step

Start a conversion

ParametersTypeRequiredDescription
file_idstringtrueThe file ID.
actionstringtrueDefine what kind of conversion you will process. For exemple: pdf_to_doc
waitingboolfalseSet defaut value as "False". "False" means the process is asynchronous. "True" means the process is synchronous.

Request

POST

{{ interface.apiHost + interface.convert }}

headers Content-Type: application/json Authorization: your_security_code
{ "file_id": '<your_file_id>', "action": 'pdf_to_doc', "waiting": false }

Response

If the default value of the parameter "waiting" is "true":

{ "status": 0, "msg": "Successfully.", "data": { "process_id": "2df1034d-6b97-4233-bbe5-be860af900bc" "status": true, "end_time": 1547519083, "create_time": "2019-01-15T10:24:39", "task_id": "0000-f533-1684-c34e-6f2", "operate_type": "pdf_to_xlsx", "return_code": "0", "output_name": "file.xlsx", "download_inc": 0, "start_time": 1547519080, "url": "http://wapi.com/download?task_id=0000-f533-1684-c34e-6f2" } }
Get the download URL:    $.data.url

If the default value of the parameter "waiting" is "false":

{ "status": 0, "msg": "Successfully.", "data": { "process_id": "2df1034d-6b97-4233-bbe5-be860af900bc" } }
Get this process_id: $data.process_id Save this process_id as your_process_id for the next step

Status of a conversion

The conversion is now processing. If it is successful, you can then request to obtain the file stream after the conversion; if it is unsuccessful, poll request every second to check whether the conversion is successful. You can then download the file once the conversion is done.

ParametersTypeRequiredDescription
process_idstringtrueThe processing ID.

Request

GET

{{ interface.apiHost + interface.process }}?process_id=<your_process_id>

headers Content-Type: application/x-www-form-urlencoded Authorization: your_security_code

Response

The following return value represents the status "Waiting for processing" or "Processing".

{ "status": 0, "msg": "Successfully.", "data": { "process_id": "2df1034d-6b97-4233-bbe5-be860af900bc" "status": false } }

The following return value represents the status "Processed".

{ "status": 0, "msg": "Successfully.", "data": { "process_id": "2df1034d-6b97-4233-bbe5-be860af900bc" "status": true "end_time": 1547519083, "create_time": "2019-01-15T10:24:39", "task_id": "0000-f533-1684-c34e-6f2", "operate_type": "pdf_to_xlsx", "return_code": "0", "output_name": "file.xlsx", "download_inc": 0, "start_time": 1547519080, "url": "http://wapi.com/download?task_id=0000-f533-1684-c34e-6f2" } }

Download the output file

Get the converted file, and return the file stream information, one of the parameters process_id, task_id must have a value.

ParametersTypeRequiredDescription
process_idstringfalseThe processing ID.
taskstringfalseThe task ID of a conversion process.

Request

GET

{{ interface.apiHost + interface.download }}?process_id=<your_process_id>

headers Content-Type: application/x-www-form-urlencoded Authorization: your_security_code

Response

Download returned binary files.

Complementary information

Supported conversion types

action_namedescription
pdf_to_docxConvert PDF to DOCX
pdf_to_xlsxConvert PDF to XLSX
pdf_to_pptxConvert PDF to PPTX
doc_to_pdfConvert DOC to PDF
docx_to_pdfConvert DOCX to PDF
ppt_to_pdfConvert PPT to PDF
pptx_to_pdfConvert PPTX to PDF
xls_to_pdfConvert XLS to PDF
xlsx_to_pdfConvert XLSX to PDF

Status codes

statusdescription
3008User Permission Deny
3104Process Not Exists
3105File Not Exists
3152No Message Found
3401invalid header authorization
3999result is not 1