{
  "openapi": "3.1.0",
  "info": {
    "title": "MostlyPDF API",
    "version": "1.0.0",
    "description": "Run any MostlyPDF tool programmatically. One flat, metered per-operation rate — no credit currency, no hidden calculator. Authenticate with your `sk_` API key.\n\n### Quickstart\nCreate a key in your [dashboard](/#/keys), then call the API with it as a Bearer token. Files go in and out base64-encoded:\n\n```bash\ncurl https://mostly-pdf.web.app/v1/process \\\n  -H \"Authorization: Bearer sk_live_your_key\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"tool\": \"rotate-pdf\",\n    \"options\": { \"degrees\": 90 },\n    \"files\": [\"JVBERi0xLjQK...\"]\n  }'\n```\n\nThe response is `{ \"outputs\": [\"<base64-pdf>\"], \"filenames\": [...], \"contentType\": \"application/pdf\" }`. Each call is one billable operation. The key is also accepted as the `x-api-key` header.\n\n### Tools\n- `merge-pdf` — Merge PDF (free)\n- `split-pdf` — Split PDF (free)\n- `remove-pages` — Remove Pages (free)\n- `extract-pages` — Extract Pages (free)\n- `organize-pdf` — Organize PDF (free)\n- `rotate-pdf` — Rotate PDF (free)\n- `page-numbers` — Add Page Numbers (free)\n- `watermark-pdf` — Watermark PDF (free)\n- `crop-pdf` — Crop PDF (free)\n- `fill-pdf-form` — Fill PDF Form (free)\n- `jpg-to-pdf` — JPG to PDF (free)\n- `compress-pdf` — Compress PDF (free)\n- `pdf-to-word` — PDF to Word (paid)\n- `pdf-to-jpg` — PDF to JPG (free)\n- `word-to-pdf` — Word to PDF (free)\n- `ocr-pdf` — OCR PDF (paid)\n- `excel-to-pdf` — Excel to PDF (free)\n- `powerpoint-to-pdf` — PowerPoint to PDF (free)\n- `pdf-to-excel` — PDF to Excel (paid)\n- `pdf-to-powerpoint` — PDF to PowerPoint (paid)\n- `pdf-to-pdfa` — PDF to PDF/A (free)\n- `repair-pdf` — Repair PDF (free)\n- `compare-pdf` — Compare PDF (free)\n- `redact-pdf` — Redact PDF (paid)\n- `txt-to-pdf` — TXT to PDF (free)\n- `rtf-to-pdf` — RTF to PDF (free)\n- `odt-to-pdf` — ODT to PDF (free)\n- `html-to-pdf` — HTML to PDF (free)\n- `url-to-pdf` — Webpage to PDF (free)\n- `markdown-to-pdf` — Markdown to PDF (free)\n- `email-to-pdf` — Email to PDF (free)\n- `protect-pdf` — Protect PDF (free)\n- `unlock-pdf` — Unlock PDF (free)\n- `sign-pdf` — Sign PDF (paid)\n- `sign-pdf-certified` — Certify PDF (digital signature) (paid)\n- `request-signature` — Request Signature (paid)\n- `chat-with-pdf` — Chat with PDF (paid)\n- `summarize-pdf` — Summarize PDF (paid)"
  },
  "servers": [
    {
      "url": "https://mostly-pdf.web.app"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your `sk_` API key (also accepted as the `x-api-key` header)."
      }
    },
    "schemas": {
      "ProcessRequest": {
        "type": "object",
        "required": [
          "tool",
          "files"
        ],
        "properties": {
          "tool": {
            "type": "string",
            "enum": [
              "merge-pdf",
              "split-pdf",
              "remove-pages",
              "extract-pages",
              "organize-pdf",
              "rotate-pdf",
              "page-numbers",
              "watermark-pdf",
              "crop-pdf",
              "fill-pdf-form",
              "jpg-to-pdf",
              "compress-pdf",
              "pdf-to-word",
              "pdf-to-jpg",
              "word-to-pdf",
              "ocr-pdf",
              "excel-to-pdf",
              "powerpoint-to-pdf",
              "pdf-to-excel",
              "pdf-to-powerpoint",
              "pdf-to-pdfa",
              "repair-pdf",
              "compare-pdf",
              "redact-pdf",
              "txt-to-pdf",
              "rtf-to-pdf",
              "odt-to-pdf",
              "html-to-pdf",
              "url-to-pdf",
              "markdown-to-pdf",
              "email-to-pdf",
              "protect-pdf",
              "unlock-pdf",
              "sign-pdf",
              "sign-pdf-certified",
              "request-signature",
              "chat-with-pdf",
              "summarize-pdf"
            ],
            "description": "The tool to run."
          },
          "options": {
            "type": "object",
            "additionalProperties": true,
            "description": "Tool-specific options (e.g. `{ \"degrees\": 90 }`, `{ \"ranges\": [\"1-3\",\"5\"] }`, `{ \"text\": \"DRAFT\", \"opacity\": 0.2 }`)."
          },
          "files": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "byte"
            },
            "description": "Input file(s), base64-encoded. Multi-file tools (merge, jpg-to-pdf) accept several."
          }
        }
      },
      "ProcessResponse": {
        "type": "object",
        "properties": {
          "outputs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "byte"
            },
            "description": "Result file(s), base64-encoded."
          },
          "filenames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "contentType": {
            "type": "string",
            "example": "application/pdf"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        }
      }
    }
  },
  "paths": {
    "/v1/process": {
      "post": {
        "operationId": "process",
        "summary": "Run a PDF tool",
        "description": "Run one tool over the supplied file(s) and return the result(s). Metered: one billable operation per call.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tool",
                  "files"
                ],
                "properties": {
                  "tool": {
                    "type": "string",
                    "enum": [
                      "merge-pdf",
                      "split-pdf",
                      "remove-pages",
                      "extract-pages",
                      "organize-pdf",
                      "rotate-pdf",
                      "page-numbers",
                      "watermark-pdf",
                      "crop-pdf",
                      "fill-pdf-form",
                      "jpg-to-pdf",
                      "compress-pdf",
                      "pdf-to-word",
                      "pdf-to-jpg",
                      "word-to-pdf",
                      "ocr-pdf",
                      "excel-to-pdf",
                      "powerpoint-to-pdf",
                      "pdf-to-excel",
                      "pdf-to-powerpoint",
                      "pdf-to-pdfa",
                      "repair-pdf",
                      "compare-pdf",
                      "redact-pdf",
                      "txt-to-pdf",
                      "rtf-to-pdf",
                      "odt-to-pdf",
                      "html-to-pdf",
                      "url-to-pdf",
                      "markdown-to-pdf",
                      "email-to-pdf",
                      "protect-pdf",
                      "unlock-pdf",
                      "sign-pdf",
                      "sign-pdf-certified",
                      "request-signature",
                      "chat-with-pdf",
                      "summarize-pdf"
                    ],
                    "description": "The tool to run."
                  },
                  "options": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Tool-specific options (e.g. `{ \"degrees\": 90 }`, `{ \"ranges\": [\"1-3\",\"5\"] }`, `{ \"text\": \"DRAFT\", \"opacity\": 0.2 }`)."
                  },
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "byte"
                    },
                    "description": "Input file(s), base64-encoded. Multi-file tools (merge, jpg-to-pdf) accept several."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Processed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid argument",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Key lacks scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Tool needs the conversion service (not enabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}
