{
  "openapi": "3.1.0",
  "info": {
    "title": "PDFit Hosted PDF API",
    "version": "2.0.0",
    "description": "Hosted API for programmatic PDF operations. Files sent to this API are uploaded for server-side processing. The endpoint is free and has no payment step. Uploaded files are parsed in memory for the single request and are never stored; responses are marked Cache-Control: no-store."
  },
  "servers": [
    {
      "url": "https://pdfit-api-production.zachary-matus.workers.dev",
      "description": "Production"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Check API availability, processing model, and limits",
        "responses": {
          "200": {
            "description": "Service is available",
            "content": { "application/json": { "schema": { "type": "object", "required": ["ok", "service", "processing", "storage", "limits"], "properties": { "ok": { "const": true }, "service": { "type": "string", "example": "pdfit-api" }, "processing": { "type": "string", "const": "hosted", "description": "Documents are processed on PDFit's server, not in the browser." }, "storage": { "type": "string", "const": "none", "description": "Uploaded documents are not stored or retained." }, "limits": { "type": "object", "properties": { "maxFiles": { "type": "integer", "example": 10 }, "maxInputBytes": { "type": "integer", "example": 26214400 }, "maxPages": { "type": "integer", "example": 100 } } } } } } }
          }
        }
      }
    },
    "/v1/pdf/merge": {
      "post": {
        "summary": "Assemble PDF pages",
        "description": "Submit two to ten PDFs. Without pageReferences, all pages are merged in submitted document order. To select, reorder, omit, or duplicate pages, send one pageReferences multipart field containing a non-empty JSON array of zero-based fileIndex and pageIndex objects. The endpoint is free with no payment step. Files are uploaded for hosted processing, parsed in memory for this request only, and never stored.",
        "requestBody": {
          "required": true,
          "content": { "multipart/form-data": { "schema": { "type": "object", "required": ["files"], "properties": { "files": { "type": "array", "minItems": 2, "maxItems": 10, "items": { "type": "string", "format": "binary", "contentMediaType": "application/pdf" } }, "pageReferences": { "type": "string", "description": "Optional non-empty JSON array. Each item is { fileIndex, pageIndex }; both are zero-based non-negative integers. The array is the exact output page order and may repeat pages.", "example": "[{\"fileIndex\":1,\"pageIndex\":0},{\"fileIndex\":0,\"pageIndex\":1},{\"fileIndex\":0,\"pageIndex\":1}]" } } } } }
        },
        "responses": {
          "200": { "description": "Merged, validated PDF", "headers": { "X-PDFit-Processing-Mode": { "description": "Reports that the document was processed on PDFit's server", "schema": { "type": "string", "example": "hosted" } }, "X-PDFit-Page-Count": { "description": "Number of pages in the merged PDF", "schema": { "type": "integer" } } }, "content": { "application/pdf": { "schema": { "type": "string", "format": "binary" } } } },
          "400": { "$ref": "#/components/responses/Error" },
          "413": { "$ref": "#/components/responses/Error" },
          "415": { "$ref": "#/components/responses/Error" },
          "422": { "$ref": "#/components/responses/Error" },
          "429": { "description": "Too many merge requests from this client. Retry after the number of seconds in the Retry-After header.", "headers": { "Retry-After": { "description": "Seconds to wait before retrying", "schema": { "type": "integer" } } }, "content": { "application/json": { "schema": { "type": "object", "required": ["error"], "properties": { "error": { "type": "string" } } } } } }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": { "description": "Request could not be processed", "content": { "application/json": { "schema": { "type": "object", "required": ["error"], "properties": { "error": { "type": "string" } } } } } }
    }
  }
}