apyhub
Back
▣ FILE CONVERSION

Word to PDF API: Convert DOC, DOCX, ODT, and RTF

Hosted on ApyHub

What it does

The Word to PDF API converts DOC, DOCX, ODT, and RTF documents into PDFs. Send the document as a multipart file upload, a remote url, or a base64 string, and get the PDF back as a binary download or as a signed link in the data field of a JSON response.

The Word to PDF API has six endpoints, one for each input and output pair. Set landscape to true for landscape pages on the upload endpoints, the URL download endpoint, and the base64 download endpoint (it defaults to false). On the upload download endpoint, output sets the PDF filename. Uploads are capped at 100 MB per request.

Teams use this DOCX to PDF API to lock generated contracts, invoices, and reports into a fixed layout before sending them, to archive editable drafts, or to add a PDF export button to a document editor. The base64 endpoints fit serverless functions that already hold the file in memory, and the URL endpoints fit files kept in object storage. Each call returns the converted PDF in the same response.

To go the other way, the Convert PDF to Word API turns a PDF back into an editable DOCX.

Pairs well with: stamp drafts and confidential copies with the PDF Watermark API, or combine several converted files into one document with the Merge Files to PDF API.

▣ ENDPOINT 01 / 06
POST
submit base64: download file
https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/base64/link

QUICKSTART

GUIDE

Quickstart

Upload a Base64-encoded file and get back a PDF download link.

curl -X POST "https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/base64/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "base64": "JVBERi0xLjQKJcfs...example-base64-content..."
  }'

Replace the example base64 value with the Base64-encoded content of your file.

What you'll get back

Returns a JSON object with a data string field containing the download URL for the generated PDF.

{
  "data": "https://example.com/output.pdf"
}
TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Base64-encoded file bytes.

About this endpoint

What it does

Converts a base64-encoded Word document into a PDF and returns a signed link to the generated PDF. The request sends the file bytes as a base64 string, and the response contains the resulting PDF URL.

Request Body

ParameterTypeDescription
base64StringBase64-encoded file bytes.

Response

Returns a JSON object with a data string field containing a URI to the generated PDF. Success responses are represented by a 200-level response with this object shape.

ParameterTypeDescription
dataStringURI of the signed link to the generated PDF.
▣ ENDPOINT 02 / 06
POST
Upload file: download file
https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/file/download

QUICKSTART

GUIDE

Quickstart

Upload a Word document to convert it to PDF.

curl -X POST "https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/file/download?output=output.pdf" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/document.docx"

What you'll get back

Returns a binary file - the converted PDF document.

TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
.doc, .docx, .odt, or .rtf

About this endpoint

What it does

Converts an uploaded Word document to a PDF and returns the generated PDF as a binary response. The request sends the source file in the body and can optionally control the output filename and page orientation via query parameters.

Query Parameter(s)

AttributeTypeDescription
outputStringOutput filename for the generated PDF.
landscapeBooleanPage orientation flag. Default: false.

Request Body

ParameterTypeDescription
fileBinaryUploaded document file in binary form. Supported formats: .doc, .docx, .odt, or .rtf.

Response

Returns a binary file response containing the converted PDF.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 03 / 06
POST
upload file: generated url
https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/file/link

QUICKSTART

GUIDE

Quickstart

Upload a Word file to convert it into a PDF.

curl -X POST "https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/file/link?landscape=false" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/document.docx"

What you'll get back

Returns a JSON object with a data string field containing the generated PDF URL.

{
  "data": "https://example.com/file.pdf"
}
TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*

About this endpoint

What it does

Converts an uploaded Word document to a PDF and returns a signed link to the generated PDF. The request sends the source file, and the response returns the resulting PDF URL as a string.

Query Parameter(s)

AttributeTypeDescription
landscapeBooleanOptional page orientation flag. Default: false.

Request Body

ParameterTypeDescription
fileBinaryWord document file to convert. Format: binary.

Response

Returns a JSON object with a data string field containing a URI to the generated PDF signed link. Success response: 200.

ParameterTypeDescription
dataStringSigned link to the converted PDF. Format: URI.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 04 / 06
POST
submit url : download file
https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/url/download

QUICKSTART

GUIDE

Quickstart

Convert a Word document from a public URL into a PDF. The url goes in the JSON body, and the optional landscape flag is sent as a query parameter if needed.

curl -X POST "https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/url/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://assets.apyhub.com/samples/sample.docx"
  }' \
  -o converted.pdf

What you'll get back

Returns the converted PDF as a binary file response.

The example above saves the downloaded file locally as converted.pdf.

TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Converts a remote Word document at the provided URL into a PDF and returns the PDF as a binary download. You can also request landscape output through an optional query parameter.

Query Parameter(s)

AttributeTypeDescription
landscapeBooleanSet to true to generate the PDF in landscape orientation. Default: false.

Request Body

ParameterTypeDescription
urlStringThe remote Word document URL to convert. Must be a valid URI.

Response

Returns a binary PDF download.

▣ ENDPOINT 05 / 06
POST
submit url: generated url
https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/url/link

QUICKSTART

GUIDE

Quickstart

Convert a Word document from a URL into a PDF by sending the document link in the request body.

curl -X POST "https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/url/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://assets.apyhub.com/samples/sample.docx"
  }'

What you'll get back

Returns a JSON object with a data string field containing the generated PDF file URL.

{
  "data": "https://assets.apyhub.com/files/output.pdf"
}
TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Converts a remote Word document available at a URL into a PDF and returns a signed PDF link. The request accepts the source document URL in the body, and the response returns the resulting PDF URL as a string.

Request Body

ParameterTypeDescription
urlStringRemote Word document URL to convert. Must be a valid URI.

Response

Returns a JSON object with a data string field — a signed PDF URL returned after conversion.

ParameterTypeDescription
dataStringSigned PDF URL. Must be a valid URI.
▣ ENDPOINT 06 / 06
POST
submit base64: download file
https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/base64/download

QUICKSTART

GUIDE

Quickstart

Convert a Base64-encoded Word file into a downloadable PDF.

curl -X POST "https://api.eu.apyhub.com/apyhub/convert-word-to-pdf/base64/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "base64": "JVBERi0xLjQKJ...example-base64-content..."
  }' \
  -o converted.pdf

Replace the example base64 value with the Base64-encoded content of your Word document.

What you'll get back

Returns the generated PDF as a binary file response.

The example above saves the downloaded file locally as converted.pdf.

TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Base64-encoded file bytes.

About this endpoint

What it does

Converts a base64-encoded Word document to a PDF and returns the PDF as a binary download. The request sends the document content in the body and can optionally request landscape output via a query parameter.

Query Parameter(s)

AttributeTypeDescription
landscapeBooleanSet to true to generate the PDF in landscape orientation. Default: false.

Request Body

ParameterTypeDescription
base64StringBase64-encoded file bytes.

Response

Returns a binary string representing the generated PDF file.

ParameterTypeDescription
binaryStringThe PDF file content returned as binary data.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.