Document Converter API

Convert Between All Major Document, Image, and Office Formats.

hero banner

Code Examples in Popular Languages

Integrate our Document Converter API easily into your apps with comprehensive code examples in popular languages to get started quickly.

CURL Request
curl --location 'https://theonlineconverter.com/api/v1/document-converter' \
--header 'Content-Type: application/json' \
--header 'x-api-key: enter_your_api_key' \
--form 'from="enter_supported_document_fromat"' \
--form 'to="enter_supported_document_fromat"' \
--form 'file=@"/D:/data/Document/pdf/file.pdf"'
JavaScript Fetch
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "enter_your_api_key");

const formdata = new FormData();
formdata.append("from", "enter_supported_document_fromat");
formdata.append("to", "enter_supported_document_fromat");
formdata.append("file", fileInput.files[0], "/D:/data/Document/pdf/file.pdf");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://theonlineconverter.com/api/v1/document-converter", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
Ruby Net::HTTP
import requests
import json

url = "https://theonlineconverter.com/api/v1/document-converter"

payload = {'from': 'enter_supported_document_fromat',
'to': 'enter_supported_document_fromat'}
files=[
  ('file',('file.pdf',open('/D:/data/Document/pdf/file.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
Python Requests
import requests
import json

url = "https://theonlineconverter.com/api/v1/document-converter"

payload = {'from': 'enter_supported_document_fromat',
'to': 'enter_supported_document_fromat'}
files=[
  ('file',('file.pdf',open('/D:/data/Document/pdf/file.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
PHP Guzzle
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'x-api-key' => 'enter_your_api_key'
];
$options = [
  'multipart' => [
    [
      'name' => 'from',
      'contents' => 'enter_supported_document_fromat'
    ],
    [
      'name' => 'to',
      'contents' => 'enter_supported_document_fromat'
    ],
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/data/Document/pdf/file.pdf', 'r'),
      'filename' => '/D:/data/Document/pdf/file.pdf',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ]
]];
$request = new Request('POST', 'https://theonlineconverter.com/api/v1/document-converter', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Java HttpURLConnection
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("from","enter_supported_document_fromat")
  .addFormDataPart("to","enter_supported_document_fromat")
  .addFormDataPart("file","/D:/data/Document/pdf/file.pdf",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/data/Document/pdf/file.pdf")))
  .build();
Request request = new Request.Builder()
  .url("https://theonlineconverter.com/api/v1/document-converter")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("x-api-key", "enter_your_api_key")
  .build();
Response response = client.newCall(request).execute();
Go net/http
package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "net/http"
  "io"
)

func main() {

  url := "https://theonlineconverter.com/api/v1/document-converter"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  _ = writer.WriteField("from", "enter_supported_document_fromat")
  _ = writer.WriteField("to", "enter_supported_document_fromat")
  file, errFile3 := os.Open("/D:/data/Document/pdf/file.pdf")
  defer file.Close()
  part3,
         errFile3 := writer.CreateFormFile("file",filepath.Base("/D:/data/Document/pdf/file.pdf"))
  _, errFile3 = io.Copy(part3, file)
  if errFile3 != nil {
    fmt.Println(errFile3)
    return
  }
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-api-key", "enter_your_api_key")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
C# HttpClient
var options = new RestClientOptions("https://theonlineconverter.com")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/v1/document-converter", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "enter_your_api_key");
request.AlwaysMultipartFormData = true;
request.AddParameter("from", "enter_supported_document_fromat");
request.AddParameter("to", "enter_supported_document_fromat");
request.AddFile("file", "/D:/data/Document/pdf/file.pdf");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Key Features & Capabilities

Our unified API is engineered for maximum format compatibility, fidelity, and performance.

Simple User Interface

Comprehensive Format Support

Convert between all major formats, including Microsoft Office (Word, Excel, PowerPoint), PDF, HTML, TXT, and a wide range of image types (JPG, PNG, TIFF).

Simple Data Format

High-Fidelity Conversions

Our advanced rendering engine ensures that the original layout, formatting, fonts, images, and charts are preserved with the highest possible accuracy.

Time

Create Universal PDFs

Reliably convert any supported document or image into a professional, universally compatible PDF, perfect for archiving, sharing, or printing.

Secure Data

Image to Editable Document

Leverage our powerful integrated OCR to convert scanned images (JPG, PNG, TIFF) into fully editable and searchable Word (.docx) or text (.txt) documents.

Universal Access

Integrated OCR Engine

Automatically detect and process scanned images and PDFs, extracting text and converting them into editable formats without an extra step.

Freedom

Secure & Confidential

All files are processed over encrypted connections. We guarantee confidentiality with a strict data privacy policy and do not store your files.

Frequently Asked Questions

Find answers to common questions about our Document Converter API to understand its full range of capabilities.

The Document Converter API is our all-encompassing "any-to-any" solution. The PDF Converter API is a specialized subset of this, focusing on tasks that start or end with a PDF. This API is the most powerful choice if you need to handle a wide variety of file formats.

Yes. When you set the output format to `.docx` from an image input, our API automatically engages its OCR engine to read the text in the image and structure it into an editable Word file.

Our conversion engine acts like a virtual printer, rendering the document with high fidelity. It preserves cell structures, charts, images, and page layouts to ensure the PDF looks exactly like the original Excel file would when printed.

Yes. You can provide a URL as the input source and set the output format to `pdf`. Our API will render the webpage and convert it into a multi-page PDF document.

We support all common formats, including DOC, DOCX, XLS, XLSX, PPT, PPTX, PDF, HTML, RTF, TXT, JPG, PNG, BMP, GIF, TIFF, and many more. Please see our documentation for a complete list.

Conversions are very fast, typically completing in a few seconds. The exact time depends on the size and complexity of the source file, but our infrastructure is built for high-speed, high-volume processing.

Absolutely. We use end-to-end TLS encryption for all data transfers. Your files are processed securely and are permanently deleted from our servers immediately after the job is complete.