ToolYourToolYourAPI Docs

Documents

Document format conversion APIs — REST and TypeScript SDK.

TypeScript SDK

Namespace: ty.documents. Slug docx-to-pdfty.documents.docxToPdf({ file }). Full table: SDK Tool Map → Documents.

import { ToolYour } from "@toolyour/sdk";
const ty = ToolYour({ apiKey: process.env.TOOLYOUR_API_KEY! });

await ty.documents.pdfToDocx({ file: pdfBlob });
await ty.documents.docxToPdf({ file: docxBlob });

Base path: /api/v1/documents

All endpoints are POST with multipart/form-data:

  • file (required) — document to convert
  • X-Api-Key (required)
curl -X POST "https://api.toolyour.com/api/v1/documents/pdf-to-docx" \
  -H "X-Api-Key: $API_KEY" \
  -F "[email protected]"

Response (default)

Returns ToolFileResponse JSON with a presigned downloadUrl (not binary in the POST body):

{
  "status": true,
  "code": 200,
  "message": "Conversion successful",
  "result": {
    "fileId": "…",
    "downloadUrl": "https://…",
    "expiresAt": "2026-06-20T20:00:00.000Z",
    "fileName": "report.docx",
    "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "sizeBytes": 51200
  }
}
curl -L -o report.docx "$DOWNLOAD_URL_FROM_RESULT"

Optional query: ?delivery=binary for legacy direct file bytes (deprecated).

PDF generation routes

These support optional PDF options (page_size, orientation, margin):

  • docx-to-pdf, txt-to-pdf, rtf-to-pdf, md-to-pdf, html-to-pdf

Common conversions

Examples
Officedocx-to-pdf, pdf-to-docx, txt-to-docx
Textpdf-to-txt, docx-to-txt, html-to-txt
Webhtml-to-pdf, pdf-to-html, md-to-html

25 document endpoints are listed under the Documents tag in the API reference.

Limits

  • Max output size: 100 MB (temp storage contract)
  • downloadUrl expires in 1 hour

On this page