Documents API Office to PDF API
Send a Word, Excel or PowerPoint file and get a PDF back, converted on our own servers.
POSThttps://api.pathclue.com/v1/documents/office-to-pdfBetaCall it from your code
Set your key in the TAPCUB_API_KEY environment variable. Base URL: https://api.pathclue.com/v1.
curl -X POST "https://api.pathclue.com/v1/documents/office-to-pdf?landscape=false" \
-H "Authorization: Bearer $TAPCUB_API_KEY" \
-H "Content-Type: application/octet-stream" \
--data-binary @input.docx \
-o result.pdfimport { readFile, writeFile } from 'node:fs/promises';
const res = await fetch('https://api.pathclue.com/v1/documents/office-to-pdf?landscape=false', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TAPCUB_API_KEY}`,
'Content-Type': 'application/octet-stream',
},
body: await readFile('input.docx'),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
await writeFile('result.pdf', Buffer.from(await res.arrayBuffer()));import os
import requests
res = requests.post(
"https://api.pathclue.com/v1/documents/office-to-pdf",
headers={"Authorization": f"Bearer {os.environ['TAPCUB_API_KEY']}", "Content-Type": "application/octet-stream"},
params={
"landscape": False,
},
data=open("input.docx", "rb"),
timeout=120,
)
res.raise_for_status()
with open("result.pdf", "wb") as f:
f.write(res.content)<?php
$ch = curl_init('https://api.pathclue.com/v1/documents/office-to-pdf?landscape=false');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('TAPCUB_API_KEY'),
'Content-Type: application/octet-stream',
],
CURLOPT_POSTFIELDS => file_get_contents('input.docx'),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 300) {
throw new RuntimeException("HTTP $status: $body");
}
file_put_contents('result.pdf', $body);package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body, err := os.ReadFile("input.docx")
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "https://api.pathclue.com/v1/documents/office-to-pdf?landscape=false", bytes.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("TAPCUB_API_KEY"))
req.Header.Set("Content-Type", "application/octet-stream")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode >= 300 {
panic(fmt.Sprintf("HTTP %d: %s", res.StatusCode, out))
}
if err := os.WriteFile("result.pdf", out, 0o644); err != nil {
panic(err)
}
}Send the file itself as the request body and put the options in the query string.
The response body is the file itself. Save it as shown in the examples.
Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
landscape | boolean | No | false | Landscape pages. |
singlePageSheets | boolean | No | false | Excel / spreadsheets: put each sheet on a single page. |
output | enumone of: binary | json | No | "binary" | binary returns the file itself (details in X-… response headers); json returns base64 in file plus the same details (results up to 20 MB). |
Example response
Successful responses carry the X-Credits-Charged and X-Credits-Balance headers. Errors return {"error":{"code","message"}} and are never charged.
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Source-Format: docx
X-Page-Count: 3
<application/pdf …>What it costs
| Price | 5 credits per file |
|---|---|
| In US dollars | about $0.005 · $5 / 1,000 |
| Credits | Paid credits only |
| Rate limit | Free 10 / min · Plus 60 / min · Pro 300 / min |
| Charged | Only on success — errors and timeouts are free |
What people build with it
Contracts and quotes
Turn generated Word files into PDFs before sending them.
Archiving
Store office documents in one long-term format.
Previews
Show any uploaded document in the browser as a PDF.
Frequently asked questions
Still have a question?
Chat with the team behind TapCub — we usually reply within a few hours on business days.
Which formats are supported?
Word, Excel and PowerPoint files in current and older formats, plus OpenDocument files.
Will fonts look the same?
Common fonts are installed. Documents that use fonts we don’t have fall back to similar ones, so embed fonts if exact layout matters.
How much does the Office to PDF API cost?
Each successful call costs 5 credits per file (about $0.005). 1 credit is about $0.001. Failed calls — invalid input, unreachable sites, timeouts or errors on our side — are not charged.
Can I use free credits?
No. Document and image endpoints only use paid credits from a Tools plan or a credit pack. To check the result before you pay, use the matching free tool on tapcub.com.
What are the rate limits?
Free accounts can make 10 calls a minute and 1,000 a day per key; Plus allows 60 a minute and Pro 300. Over the limit you get HTTP 429 with a Retry-After header, and nothing is charged.
How do I get an API key?
Sign in to the TapCub console, verify your email and create a key on the Tools → API page. Keys start with tck_ and are shown once; send them in the Authorization: Bearer header.
Get your API key
Create a key in the console and make your first call in a minute. Light endpoints run on free daily credits.