{
  "openapi": "3.1.1",
  "info": {
    "title": "Office to PDF Converter API",
    "version": "1.0.0",
    "summary": "Convert Word, Excel, PowerPoint, OpenDocument, RTF and CSV files to PDF with LibreOffice.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://officetopdfconverter.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Convert Word, Excel, PowerPoint, OpenDocument, RTF and CSV files to PDF with LibreOffice.",
        "description": "Converts DOCX, DOC, ODT, RTF, PPTX, PPT, ODP, XLSX, XLS, ODS and CSV files to PDF (optionally PDF/A-2b) with LibreOffice running headless on our server. Reports the page count and the fonts used in the PDF, so you can spot substituted fonts, and shows a preview of page 1.\n\nMethodology:\n- The file type is detected from the content (OLE2 stream names for DOC/XLS/PPT, the ZIP structure for DOCX/XLSX/PPTX and OpenDocument, the {\\rtf header for RTF). CSV is accepted as UTF-8 text with a .csv/.tsv name; the separator (comma, semicolon or tab) is taken from the first line.\n- LibreOffice converts the file headless with a fresh private profile per job and a 180-second limit. Macros are not executed. Spreadsheets export every sheet with its print ranges and page setup.\n- Fonts not installed on the server are substituted: Liberation fonts stand in for Arial, Times New Roman and Courier New with identical metrics, Carlito/Caladea (if installed) for Calibri/Cambria; other fonts fall back to similar ones, which can change line and page breaks.\n- The font list is read from the produced PDF (qpdf), so you can see exactly which fonts were used. Dates and random IDs are removed so the same input always gives the same PDF.\n\nLayout fidelity is good but not perfect: complex Word/PowerPoint layouts, SmartArt, some charts, embedded objects and missing fonts can render differently from Microsoft Office. Check the PDF before sending it.",
        "tags": [
          "documents"
        ],
        "x-mcp-tool": "office_to_pdf_converter",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OfficeToPdfConverterInput"
              },
              "examples": {
                "example1": {
                  "summary": "RTF letter to PDF",
                  "value": {
                    "file": {
                      "filename": "notes.rtf",
                      "contentType": "application/rtf",
                      "contentBase64": "e1xydGYxXGFuc2lcZGVmZjB7XGZvbnR0Ymx7XGYwIExpYmVyYXRpb24gU2VyaWY7fXtcZjEgQ2FsaWJyaTt9fVxmMFxmczM2IE1lZXRpbmcgbm90ZXNccGFyXGZzMjQgQWdlbmRhOiBidWRnZXQsIHRpbWVsaW5lIGFuZCBuZXh0IHN0ZXBzLlxwYXJcZjEgVGhpcyBsaW5lIGFza3MgZm9yIENhbGlicmksIHdoaWNoIGlzIHJlcGxhY2VkIGJ5IGEgbWV0cmljLWNvbXBhdGlibGUgZm9udC5ccGFyfQ=="
                    }
                  }
                },
                "example2": {
                  "summary": "Semicolon CSV to a PDF table",
                  "value": {
                    "file": {
                      "filename": "prices.csv",
                      "contentType": "text/csv",
                      "contentBase64": "SXRlbTtRdHk7UHJpY2UKQ29mZmVlOzI7My41MApUZWE7MTsyLjgwCg=="
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfficeToPdfConverterResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "OfficeToPdfConverterInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "file": {
            "title": "Office document",
            "description": "Max 100 MB. Macros are never run. Processed on our server and deleted; the PDF can be downloaded for about 2 hours. Upload as {filename, contentType?, contentBase64}. Max 102400 KiB. Accepts .docx,.doc,.odt,.rtf,.pptx,.ppt,.odp,.xlsx,.xls,.ods,.csv,.tsv.",
            "type": "object",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "pdfa": {
            "title": "Create PDF/A-2b (for archiving)",
            "description": "Embeds all fonts and adds archival metadata; files can be slightly larger.",
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "file"
        ]
      },
      "OfficeToPdfConverterResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "inputType",
              "inputBytes",
              "pages",
              "outputBytes",
              "pdfa",
              "fonts",
              "artifact"
            ],
            "properties": {
              "inputType": {
                "type": "string",
                "enum": [
                  "docx",
                  "doc",
                  "odt",
                  "rtf",
                  "pptx",
                  "ppt",
                  "odp",
                  "xlsx",
                  "xls",
                  "ods",
                  "csv"
                ]
              },
              "inputBytes": {
                "type": "integer"
              },
              "pages": {
                "type": "integer"
              },
              "outputBytes": {
                "type": "integer"
              },
              "pdfa": {
                "type": "boolean"
              },
              "fonts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "embedded"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "embedded": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "csvSeparator": {
                "type": "string"
              },
              "artifact": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "preview": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}