Skip to main content
POST
/
v1
/
convert
Basic conversion
curl -X POST https://api.superdoc.dev/v1/convert?from=docx \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@document.docx" \
  -o output.pdf
const formData = new FormData();
formData.append('file', fileInput.files[0]);

const response = await fetch('https://api.superdoc.dev/v1/convert?from=docx', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
body: formData
});

const pdf = await response.blob();
downloadBlob(pdf, 'converted.pdf');
import requests

with open('document.docx', 'rb') as f:
response = requests.post(
'https://api.superdoc.dev/v1/convert?from=docx',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
files={'file': f}
)

with open('converted.pdf', 'wb') as pdf:
pdf.write(response.content)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.superdoc.dev/v1/convert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.superdoc.dev/v1/convert"

req, _ := http.NewRequest("POST", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.superdoc.dev/v1/convert")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.superdoc.dev/v1/convert")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
"<string>"
{
"code": "INVALID_FILE_FORMAT",
"error": "Bad Request",
"message": "File is not a valid DOCX",
"requestId": "req_abc123"
}
{
"code": "INVALID_FILE_FORMAT",
"error": "Bad Request",
"message": "File is not a valid DOCX",
"requestId": "req_abc123"
}
{
"code": "INVALID_FILE_FORMAT",
"error": "Bad Request",
"message": "File is not a valid DOCX",
"requestId": "req_abc123"
}
{
"code": "INVALID_FILE_FORMAT",
"error": "Bad Request",
"message": "File is not a valid DOCX",
"requestId": "req_abc123"
}

Authorizations

Authorization
string
header
required

API key authentication. Keys start with sd_

Query Parameters

from
enum<string>
required

Format of the uploaded file

Available options:
docx,
md,
html
to
enum<string>
default:pdf

Target format for conversion. Defaults to PDF for backward compatibility

Available options:
pdf,
docx

Response

Converted file

The response is of type file.