Convert to PDF
curl --request POST \
--url https://app.dumplingai.com/api/v1/convert-to-pdf \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputMethod": "url",
"file": "https://example.com/brochure.html"
}
'import requests
url = "https://app.dumplingai.com/api/v1/convert-to-pdf"
payload = {
"inputMethod": "url",
"file": "https://example.com/brochure.html"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({inputMethod: 'url', file: 'https://example.com/brochure.html'})
};
fetch('https://app.dumplingai.com/api/v1/convert-to-pdf', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.dumplingai.com/api/v1/convert-to-pdf",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputMethod' => 'url',
'file' => 'https://example.com/brochure.html'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.dumplingai.com/api/v1/convert-to-pdf"
payload := strings.NewReader("{\n \"inputMethod\": \"url\",\n \"file\": \"https://example.com/brochure.html\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.dumplingai.com/api/v1/convert-to-pdf")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputMethod\": \"url\",\n \"file\": \"https://example.com/brochure.html\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/convert-to-pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputMethod\": \"url\",\n \"file\": \"https://example.com/brochure.html\"\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Document Processing
Convert to PDF
Convert URLs or uploads into PDF documents using DumplingAI’s conversion pipeline.
POST
/
api
/
v1
/
convert-to-pdf
Convert to PDF
curl --request POST \
--url https://app.dumplingai.com/api/v1/convert-to-pdf \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputMethod": "url",
"file": "https://example.com/brochure.html"
}
'import requests
url = "https://app.dumplingai.com/api/v1/convert-to-pdf"
payload = {
"inputMethod": "url",
"file": "https://example.com/brochure.html"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({inputMethod: 'url', file: 'https://example.com/brochure.html'})
};
fetch('https://app.dumplingai.com/api/v1/convert-to-pdf', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.dumplingai.com/api/v1/convert-to-pdf",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputMethod' => 'url',
'file' => 'https://example.com/brochure.html'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.dumplingai.com/api/v1/convert-to-pdf"
payload := strings.NewReader("{\n \"inputMethod\": \"url\",\n \"file\": \"https://example.com/brochure.html\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.dumplingai.com/api/v1/convert-to-pdf")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputMethod\": \"url\",\n \"file\": \"https://example.com/brochure.html\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/convert-to-pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputMethod\": \"url\",\n \"file\": \"https://example.com/brochure.html\"\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Description
This endpoint converts various document formats to PDF. It supports a wide range of input formats including office documents, images, and web formats.Endpoint
POST https://app.dumplingai.com/api/v1/convert-to-pdf
Headers
- Content-Type:
application/json - Authorization: Bearer
<API_KEY>(required)
Request Body
{
"inputMethod": "string", // Required. Either "url" or "base64"
"file": "string" // Required. URL or base64-encoded file content
}
Responses
Success (200)
Returns the URL of the converted PDF.{
"url": "string" // URL to the converted PDF file
}
- X-RateLimit-Limit: The rate limit for the user.
- X-RateLimit-Remaining: The remaining number of requests for the user.
Bad Request (400)
Returned if the request is invalid or the file format is unsupported.{
"error": "Error message describing the issue"
}
Internal Server Error (500)
Returned if there’s an error during the conversion process.{
"error": "Failed to convert to PDF: [error details]"
}
Example Request
curl -X POST https://app.dumplingai.com/api/v1/convert-to-pdf \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"inputMethod": "url",
"file": "https://example.com/document.docx"
}'
Notes
- Credit usage: 50 credits per 100MB of output PDF size
- The converted PDF is temporarily stored (24-hour retention)
- You can get a list of supported formats by calling:
GET /api/v1/convert-to-pdf
Supported Formats
“.123”, “.602”, “.abw”, “.bib”, “.bmp”, “.cdr”, “.cgm”, “.cmx”, “.csv”, “.cwk”, “.dbf”, “.dif”, “.doc”, “.docm”, “.docx”, “.dot”, “.dotm”, “.dotx”, “.dxf”, “.emf”, “.eps”, “.epub”, “.fodg”, “.fodp”, “.fods”, “.fodt”, “.fopd”, “.gif”, “.htm”, “.html”, “.hwp”, “.jpeg”, “.jpg”, “.key”, “.ltx”, “.lwp”, “.mcw”, “.met”, “.mml”, “.mw”, “.numbers”, “.odd”, “.odg”, “.odm”, “.odp”, “.ods”, “.odt”, “.otg”, “.oth”, “.otp”, “.ots”, “.ott”, “.pages”, “.pbm”, “.pcd”, “.pct”, “.pcx”, “.pdb”, “.pgm”, “.png”, “.pot”, “.potm”, “.potx”, “.ppm”, “.pps”, “.ppt”, “.pptm”, “.pptx”, “.psd”, “.psw”, “.pub”, “.pwp”, “.pxl”, “.ras”, “.rtf”, “.sda”, “.sdc”, “.sdd”, “.sdp”, “.sdw”, “.sgl”, “.slk”, “.smf”, “.stc”, “.std”, “.sti”, “.stw”, “.svg”, “.svm”, “.swf”, “.sxc”, “.sxd”, “.sxg”, “.sxi”, “.sxm”, “.sxw”, “.tga”, “.tif”, “.tiff”, “.txt”, “.uof”, “.uop”, “.uos”, “.uot”, “.vdx”, “.vor”, “.vsd”, “.vsdm”, “.vsdx”, “.webp”, “.wb2”, “.wk1”, “.wks”, “.wmf”, “.wpd”, “.wpg”, “.wps”, “.xbm”, “.xhtml”, “.xls”, “.xlsb”, “.xlsm”, “.xlsx”, “.xlt”, “.xltm”, “.xltx”, “.xlw”, “.xml”, “.xpm”, “.zabw”,Rate Limiting
Rate limit headers (X-RateLimit-Limit and X-RateLimit-Remaining) are included in the response.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
PDF conversion job accepted.
Temporary download URL for the converted PDF.