{
  "openapi": "3.1.0",
  "info": {
    "title": "RelayPDF API",
    "version": "1.1.0",
    "description": "Generate, convert, and manipulate documents. Chromium rendering, Office conversion, searchable OCR, PDF/A, native PDF and image tools, email conversion, private uploads, durable jobs, and versioned usage billing."
  },
  "servers": [
    {
      "url": "https://api.relaypdf.com",
      "description": "Production Worker"
    },
    {
      "url": "http://localhost:8787",
      "description": "Local Worker"
    }
  ],
  "paths": {
    "/v1/webhooks/deliveries": {
      "get": {
        "summary": "Latest 100 account webhook delivery statuses",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery status, attempts, HTTP status and retry time"
          }
        }
      }
    },
    "/v1/webhooks/deliveries/{id}/replay": {
      "post": {
        "summary": "Replay a terminally failed account webhook delivery",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Requeued with original event identity"
          },
          "404": {
            "description": "Failed delivery not found"
          }
        }
      }
    },
    "/v1/pdf/ocr": {
      "post": {
        "summary": "Document ocr",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/pdfa": {
      "post": {
        "summary": "Document pdfa",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/crop": {
      "post": {
        "summary": "Document crop",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/resize": {
      "post": {
        "summary": "Document resize",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/repair": {
      "post": {
        "summary": "Document repair",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/optimize": {
      "post": {
        "summary": "Document optimize",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/attachments": {
      "post": {
        "summary": "Document attachments",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/extract-images": {
      "post": {
        "summary": "Document extract-images",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/pdf/compress-advanced": {
      "post": {
        "summary": "Document compress",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/images/convert": {
      "post": {
        "summary": "Document image-convert",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/email": {
      "post": {
        "summary": "Document email",
        "description": "Native processing. Maximum 500 PDF pages and 100 MiB uploaded input; output limited to 32 MiB. Assigned immutable native rate applies: final release $0.0004/job + $0.0005/execution second. Legacy accounts retain their assigned rate. See https://relaypdf.com/docs for operation-specific options and limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response. Same account/key/request reuses job; changed request returns 409."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document bytes or JSON with output URL and billing receipt."
          },
          "202": {
            "description": "Durable job accepted; poll authenticated /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid request or unsupported input."
          },
          "402": {
            "description": "Insufficient balance or spending limit."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Document exceeds processing limits."
          },
          "503": {
            "description": "Required processing, billing, upload or Workflow binding unavailable."
          }
        }
      }
    },
    "/v1/files": {
      "post": {
        "summary": "Upload a private input file",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Content-Length",
            "in": "header",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 104857600
            }
          },
          {
            "name": "X-Filename",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "id, filename, sizeBytes, expiresAt. Private input expires after 24 hours."
          },
          "413": {
            "description": "Input exceeds 100 MiB."
          }
        }
      }
    },
    "/v1/billing/usage": {
      "get": {
        "summary": "Most recent 100 job reservations and receipts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "USD job records with quote, receipt, reservation and actual charge in microdollars."
          }
        }
      }
    },
    "/v1/billing/estimate": {
      "get": {
        "summary": "Current quote and maximum reservation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "responses": {
          "200": {
            "description": "Quote snapshot. Estimate, not a guarantee of exact runtime or wallet availability."
          }
        }
      }
    },
    "/v1/billing/limits": {
      "get": {
        "summary": "Read or update account per-job spending limit",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "maxJobMicrodollars, mode, availableMicrodollars."
          }
        }
      },
      "patch": {
        "summary": "Read or update account per-job spending limit",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "maxJobMicrodollars, mode, availableMicrodollars."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "maxJobMicrodollars"
                ],
                "properties": {
                  "maxJobMicrodollars": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 1000000000
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/redact": {
      "post": {
        "summary": "Redact PDF text and page areas",
        "description": "Replace matched text and selected areas with black pixels and rebuild every page as an image-only PDF without source metadata, attachments, forms, or text objects. Does not modify the input. No OCR. Unmatched terms fail unbilled. Native processing rate applies. See https://relaypdf.com/docs/pdf/redact for coordinates, limits, and review guidance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Requires url or async response."
          },
          {
            "name": "X-RelayPDF-Max-Charge-Microdollars",
            "in": "header",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Maximum authorized USD charge in millionths of a dollar."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedactPdfRequest"
              },
              "example": {
                "url": "https://example.com/input.pdf",
                "response": "url",
                "filename": "redacted.pdf",
                "options": {
                  "texts": [
                    "Account 1234"
                  ],
                  "areas": [
                    {
                      "page": 1,
                      "x": 72,
                      "y": 144,
                      "width": 216,
                      "height": 36
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image-only PDF bytes or JSON with a 24-hour output URL and billing receipt."
          },
          "202": {
            "description": "Async job accepted; poll GET /v1/jobs/:id."
          },
          "400": {
            "description": "Invalid options, unmatched text, invalid area, unsupported input, or processing limit exceeded. Not billed."
          },
          "401": {
            "description": "Invalid or missing API key."
          },
          "402": {
            "description": "Insufficient balance or spending cap exceeded."
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "413": {
            "description": "Input exceeds size limits."
          },
          "429": {
            "description": "Rate limit exceeded."
          },
          "502": {
            "description": "Document processing failed. Not billed."
          }
        }
      }
    },
    "/v1/templates/{id}/publish": {
      "post": {
        "summary": "Publish the active template draft",
        "description": "Authenticated, account-owned template operation. See https://relaypdf.com/docs/templates.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated template record."
          },
          "400": {
            "description": "Invalid request."
          },
          "404": {
            "description": "Template or version not found for this account."
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "comment": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/discard": {
      "post": {
        "summary": "Discard the active draft",
        "description": "Authenticated, account-owned template operation. See https://relaypdf.com/docs/templates.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated template record."
          },
          "400": {
            "description": "Invalid request."
          },
          "404": {
            "description": "Template or version not found for this account."
          }
        }
      }
    },
    "/v1/templates/{id}/duplicate": {
      "post": {
        "summary": "Duplicate a template",
        "description": "Authenticated, account-owned template operation. See https://relaypdf.com/docs/templates.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Updated template record."
          },
          "400": {
            "description": "Invalid request."
          },
          "404": {
            "description": "Template or version not found for this account."
          }
        }
      }
    },
    "/v1/templates/{id}/versions": {
      "get": {
        "summary": "List template version history",
        "description": "Authenticated, account-owned template operation. See https://relaypdf.com/docs/templates.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Version history in a versions array."
          },
          "400": {
            "description": "Invalid request."
          },
          "404": {
            "description": "Template or version not found for this account."
          }
        }
      }
    },
    "/v1/templates/{id}/restore": {
      "post": {
        "summary": "Restore a saved version as the draft",
        "description": "Authenticated, account-owned template operation. See https://relaypdf.com/docs/templates.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated template record."
          },
          "400": {
            "description": "Invalid request."
          },
          "404": {
            "description": "Template or version not found for this account."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "version"
                ],
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/validate": {
      "post": {
        "summary": "Validate Handlebars HTML and sample data",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "html"
                ],
                "properties": {
                  "html": {
                    "type": "string",
                    "minLength": 1
                  },
                  "engine": {
                    "type": "string",
                    "enum": [
                      "handlebars"
                    ],
                    "default": "handlebars"
                  },
                  "sampleData": {
                    "type": "object",
                    "additionalProperties": true,
                    "default": {}
                  },
                  "strict": {
                    "type": "boolean"
                  },
                  "options": {
                    "type": "object",
                    "description": "PDF rendering options; see /docs/options."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation succeeded: {ok: true}. Not billed."
          },
          "400": {
            "description": "Invalid template or request."
          }
        }
      }
    },
    "/v1/templates/preview": {
      "post": {
        "summary": "Render unsaved Handlebars HTML to PDF",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "html"
                ],
                "properties": {
                  "html": {
                    "type": "string",
                    "minLength": 1
                  },
                  "engine": {
                    "type": "string",
                    "enum": [
                      "handlebars"
                    ],
                    "default": "handlebars"
                  },
                  "sampleData": {
                    "type": "object",
                    "additionalProperties": true,
                    "default": {}
                  },
                  "strict": {
                    "type": "boolean"
                  },
                  "options": {
                    "type": "object",
                    "description": "PDF rendering options; see /docs/options."
                  },
                  "filename": {
                    "type": "string",
                    "pattern": "\\.([pP][dD][fF])$"
                  },
                  "response": {
                    "$ref": "#/components/schemas/ResponseMode"
                  },
                  "callbackUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF bytes or temporary URL. Successful preview uses the assigned browser rate."
          },
          "202": {
            "description": "Async preview accepted."
          },
          "400": {
            "description": "Invalid template or request."
          },
          "402": {
            "description": "Insufficient credit or spending cap."
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Liveness",
        "responses": {
          "200": {
            "description": "Service is up",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "service": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "service"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "Streamable HTTP MCP",
        "description": "JSON-RPC MCP (initialize, tools/list, tools/call). Bearer API key or Clerk OAuth. Generating tools return a 24h URL. Same tool names as stdio MCP. Unauthenticated 401 includes WWW-Authenticate resource_metadata.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "id": {},
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result"
          },
          "202": {
            "description": "JSON-RPC notification acknowledged"
          },
          "401": {
            "description": "Missing or invalid API key or OAuth token"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/mcp": {
      "get": {
        "summary": "MCP Protected Resource Metadata",
        "description": "RFC 9728 document for hosted MCP. Public. 404 if Clerk is not configured on the Worker.",
        "responses": {
          "200": {
            "description": "resource, authorization_servers, scopes_supported"
          },
          "404": {
            "description": "MCP OAuth is not configured"
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "summary": "Account and wallet snapshot",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Plan, rate tier, and wallet millicents. Not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string"
                    },
                    "rateTier": {
                      "type": "string",
                      "enum": [
                        "free",
                        "paid"
                      ]
                    },
                    "wallet": {
                      "type": "object",
                      "properties": {
                        "balanceMillicents": {
                          "type": "integer"
                        },
                        "autoReloadEnabled": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "balanceMillicents",
                        "autoReloadEnabled"
                      ]
                    }
                  },
                  "required": [
                    "plan",
                    "rateTier",
                    "wallet"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "summary": "List webhook endpoints",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Endpoints without raw secrets"
          }
        }
      },
      "post": {
        "summary": "Create a webhook endpoint",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created; secret returned once"
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "delete": {
        "summary": "Delete a webhook endpoint",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          }
        }
      }
    },
    "/v1/pdf": {
      "post": {
        "summary": "Create a PDF from HTML, URL, Markdown, or a published template",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF bytes or JSON with a temporary URL",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          },
          "202": {
            "description": "Async job accepted"
          }
        }
      }
    },
    "/v1/images": {
      "post": {
        "summary": "Screenshot HTML or a URL",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image bytes or JSON URL response",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/merge": {
      "post": {
        "summary": "Merge PDFs",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MergePdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Merged PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/extract": {
      "post": {
        "summary": "Extract page ranges from a PDF",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtractPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Extracted PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/protect": {
      "post": {
        "summary": "Password-protect a PDF",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProtectPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Protected PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/bookmarks": {
      "post": {
        "summary": "Add PDF bookmarks",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookmarksPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bookmarked PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/raster": {
      "post": {
        "summary": "Render PDF pages to PNG or JPEG",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RasterPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image, zip, or URL response",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/from-images": {
      "post": {
        "summary": "Combine PNG/JPEG images into a PDF",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FromImagesPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/stamp": {
      "post": {
        "summary": "Stamp text or an image onto a PDF",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StampPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/rotate": {
      "post": {
        "summary": "Rotate PDF pages",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotatePdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/delete-pages": {
      "post": {
        "summary": "Delete PDF pages",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeletePagesPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/compress": {
      "post": {
        "summary": "Lossless-optimize a PDF",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PdfSourceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/info": {
      "post": {
        "summary": "PDF metadata JSON",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PdfSourceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON or URL response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/unlock": {
      "post": {
        "summary": "Remove PDF password",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UnlockPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/text": {
      "post": {
        "summary": "Extract PDF text layer (no OCR)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON or URL response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/data": {
      "post": {
        "summary": "Extract structured PDF data or Markdown",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON or URL response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/form/fields": {
      "post": {
        "summary": "List AcroForm fields",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PdfSourceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON or URL response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pdf/form/fill": {
      "post": {
        "summary": "Fill AcroForm fields",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FormFillPdfRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PDF or URL response",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/barcodes": {
      "post": {
        "summary": "Generate barcode or QR image",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBarcodeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Barcode image or URL response",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/zip": {
      "post": {
        "summary": "Create zip archive",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateZipRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Zip bytes or URL response",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/convert": {
      "post": {
        "summary": "Convert files using LibreOffice or wkhtmltopdf",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Converted bytes or URL response",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUrlResponse"
                }
              }
            }
          },
          "503": {
            "description": "Document worker unavailable"
          }
        }
      }
    },
    "/v1/templates": {
      "get": {
        "summary": "List Handlebars templates",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Template list"
          }
        }
      },
      "post": {
        "summary": "Create a template draft",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Created draft"
          }
        }
      }
    },
    "/v1/templates/gallery": {
      "get": {
        "summary": "List stock Handlebars layouts",
        "responses": {
          "200": {
            "description": "Gallery templates with public hrefs at /pdf-templates/:category/:id"
          }
        }
      }
    },
    "/v1/templates/generate": {
      "post": {
        "summary": "Generate or edit a template with AI",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Generated html, sampleData, and options"
          }
        }
      }
    },
    "/v1/templates/{id}": {
      "get": {
        "summary": "Get a template (draft if present, else published)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Template"
          }
        }
      },
      "patch": {
        "summary": "Update the active draft",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated draft"
          }
        }
      },
      "delete": {
        "summary": "Soft-delete a template",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          }
        }
      }
    },
    "/v1/jobs/{id}": {
      "get": {
        "summary": "Poll an async job",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job status payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobStatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/files/{id}": {
      "delete": {
        "summary": "Delete an owned upload or new output",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "Not found or not owned by account"
          }
        }
      },
      "get": {
        "summary": "Download a temporary file",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File bytes",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Missing or expired file"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "ProcessDocumentRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string",
            "description": "Base64 input, maximum decoded size 15 MiB."
          },
          "fileId": {
            "type": "string",
            "pattern": "^upload_[a-f0-9]{32}$",
            "description": "Private upload returned by POST /v1/files; owned by current account."
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "type": "string",
            "enum": [
              "binary",
              "url",
              "async"
            ],
            "default": "binary"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "options": {
            "type": "object",
            "properties": {
              "password": {
                "type": "string"
              },
              "pages": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                ]
              },
              "language": {
                "type": "string",
                "default": "eng"
              },
              "deskew": {
                "type": "boolean"
              },
              "rotate": {
                "type": "boolean"
              },
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              },
              "width": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 10000
              },
              "height": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 10000
              },
              "preset": {
                "enum": [
                  "lossless",
                  "screen",
                  "ebook",
                  "printer"
                ],
                "default": "lossless"
              },
              "format": {
                "enum": [
                  "png",
                  "jpeg",
                  "webp",
                  "tiff",
                  "pdf"
                ],
                "default": "png"
              },
              "quality": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "sourceFormat": {
                "enum": [
                  "eml",
                  "msg"
                ],
                "default": "eml"
              },
              "attachments": {
                "type": "boolean",
                "default": false
              }
            }
          }
        },
        "oneOf": [
          {
            "required": [
              "url"
            ]
          },
          {
            "required": [
              "file"
            ]
          },
          {
            "required": [
              "fileId"
            ]
          }
        ]
      },
      "RedactPdfRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "options"
        ],
        "oneOf": [
          {
            "required": [
              "url"
            ]
          },
          {
            "required": [
              "file"
            ]
          },
          {
            "required": [
              "fileId"
            ]
          }
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string",
            "minLength": 1,
            "description": "Base64 PDF; maximum 15 MiB decoded."
          },
          "fileId": {
            "type": "string",
            "pattern": "^upload_[a-f0-9]{32}$"
          },
          "filename": {
            "type": "string",
            "maxLength": 255,
            "pattern": "^[^/\\\\\\r\\n]+\\.[pP][dD][fF]$"
          },
          "response": {
            "type": "string",
            "enum": [
              "binary",
              "url",
              "async"
            ],
            "default": "binary"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "description": "HTTPS callback URL."
          },
          "options": {
            "type": "object",
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "texts"
                ],
                "properties": {
                  "texts": {
                    "minItems": 1
                  }
                }
              },
              {
                "required": [
                  "areas"
                ],
                "properties": {
                  "areas": {
                    "minItems": 1
                  }
                }
              }
            ],
            "properties": {
              "texts": {
                "type": "array",
                "maxItems": 100,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500,
                  "pattern": "^(?!.*\\u0000)[\\s\\S]*\\S[\\s\\S]*$"
                },
                "description": "Literal text-layer matches. Every term must match at least once on selected pages. No OCR or regex."
              },
              "areas": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "page",
                    "x",
                    "y",
                    "width",
                    "height"
                  ],
                  "properties": {
                    "page": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 500
                    },
                    "x": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 10000
                    },
                    "y": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 10000
                    },
                    "width": {
                      "type": "number",
                      "exclusiveMinimum": 0,
                      "maximum": 10000
                    },
                    "height": {
                      "type": "number",
                      "exclusiveMinimum": 0,
                      "maximum": 10000
                    }
                  }
                },
                "description": "PDF points from displayed top-left after crop and rotation; must fit within the page."
              },
              "pages": {
                "oneOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                ]
              },
              "password": {
                "type": "string",
                "maxLength": 128
              },
              "matchCase": {
                "type": "boolean",
                "default": false
              },
              "dpi": {
                "type": "integer",
                "minimum": 144,
                "maximum": 300,
                "default": 144
              }
            }
          }
        }
      },
      "ResponseMode": {
        "type": "string",
        "enum": [
          "binary",
          "url",
          "async"
        ],
        "default": "binary"
      },
      "FileSource": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string",
            "description": "Base64 payload, optional data URI prefix"
          }
        }
      },
      "NamedFileSource": {
        "allOf": [
          {
            "$ref": "#/components/schemas/FileSource"
          },
          {
            "type": "object",
            "required": [
              "filename"
            ],
            "properties": {
              "filename": {
                "type": "string"
              }
            }
          }
        ]
      },
      "CreatePdfRequest": {
        "type": "object",
        "properties": {
          "html": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "string"
          },
          "templateId": {
            "type": "string"
          },
          "templateVersion": {
            "type": "integer"
          },
          "templateData": {
            "type": "object"
          },
          "strict": {
            "type": "boolean"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "options": {
            "type": "object",
            "properties": {
              "format": {
                "type": "string"
              },
              "landscape": {
                "type": "boolean"
              },
              "printBackground": {
                "type": "boolean"
              },
              "preferCSSPageSize": {
                "type": "boolean"
              },
              "scale": {
                "type": "number"
              },
              "margin": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "headerTemplate": {
                "type": "string"
              },
              "footerTemplate": {
                "type": "string"
              },
              "pageRanges": {
                "type": "string"
              },
              "width": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "height": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "waitUntil": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              },
              "timeout": {
                "type": "integer"
              },
              "extraHTTPHeaders": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "cookies": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "name",
                    "value"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "domain": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    }
                  }
                }
              },
              "waitForSelector": {
                "type": "string"
              },
              "waitForTimeout": {
                "type": "integer"
              }
            }
          }
        }
      },
      "CreateImageRequest": {
        "type": "object",
        "properties": {
          "html": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "options": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "png",
                  "jpeg",
                  "webp"
                ]
              },
              "fullPage": {
                "type": "boolean"
              },
              "omitBackground": {
                "type": "boolean"
              },
              "captureBeyondViewport": {
                "type": "boolean"
              },
              "quality": {
                "type": "integer"
              },
              "viewport": {
                "type": "object",
                "properties": {
                  "width": {
                    "type": "integer"
                  },
                  "height": {
                    "type": "integer"
                  },
                  "deviceScaleFactor": {
                    "type": "number"
                  }
                }
              },
              "clip": {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  },
                  "width": {
                    "type": "number"
                  },
                  "height": {
                    "type": "number"
                  }
                }
              },
              "waitUntil": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              },
              "timeout": {
                "type": "integer"
              },
              "extraHTTPHeaders": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "cookies": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "name",
                    "value"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "domain": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    }
                  }
                }
              },
              "waitForSelector": {
                "type": "string"
              },
              "waitForTimeout": {
                "type": "integer"
              }
            }
          }
        }
      },
      "MergePdfRequest": {
        "type": "object",
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "minItems": 2,
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/FileSource"
            }
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ExtractPdfRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "pages": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            ]
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ProtectPdfRequest": {
        "type": "object",
        "required": [
          "userPassword"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "userPassword": {
            "type": "string"
          },
          "ownerPassword": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "BookmarksPdfRequest": {
        "type": "object",
        "required": [
          "bookmarks"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "bookmarks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "title",
                "page"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "page": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "PdfSourceRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "RasterPdfRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "pages": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            ],
            "default": "1"
          },
          "type": {
            "type": "string",
            "enum": [
              "png",
              "jpeg"
            ],
            "default": "png"
          },
          "dpi": {
            "type": "integer"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "FromImagesPdfRequest": {
        "type": "object",
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileSource"
            }
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "StampPdfRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "image": {
            "$ref": "#/components/schemas/FileSource"
          },
          "pages": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            ]
          },
          "position": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "center",
                  "top",
                  "bottom",
                  "top-left",
                  "top-right",
                  "bottom-left",
                  "bottom-right"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  }
                }
              }
            ]
          },
          "opacity": {
            "type": "number"
          },
          "fontSize": {
            "type": "number"
          },
          "color": {
            "type": "string"
          },
          "rotate": {
            "type": "number"
          },
          "scale": {
            "type": "number"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "RotatePdfRequest": {
        "type": "object",
        "required": [
          "degrees"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "degrees": {
            "type": "integer",
            "description": "Non-zero multiple of 90 between -270 and 270"
          },
          "pages": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            ]
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "DeletePagesPdfRequest": {
        "type": "object",
        "required": [
          "pages"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "pages": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            ]
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "UnlockPdfRequest": {
        "type": "object",
        "required": [
          "password"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "FormFillPdfRequest": {
        "type": "object",
        "required": [
          "fields"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "fields": {
            "type": "object"
          },
          "flatten": {
            "type": "boolean"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "TextPdfRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "mergePages": {
            "type": "boolean",
            "default": false
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "DataPdfRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "prompt": {
            "type": "string"
          },
          "ocr": {
            "type": "boolean",
            "default": false
          },
          "pages": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            ]
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "CreateBarcodeRequest": {
        "type": "object",
        "required": [
          "type",
          "text"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "qr",
              "code128",
              "code39",
              "ean13",
              "upca",
              "pdf417",
              "datamatrix"
            ]
          },
          "text": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "enum": [
              "svg",
              "png"
            ],
            "default": "png"
          },
          "scale": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "includetext": {
            "type": "boolean"
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "CreateZipRequest": {
        "type": "object",
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "minItems": 1,
            "maxItems": 30,
            "items": {
              "$ref": "#/components/schemas/NamedFileSource"
            }
          },
          "filename": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ConvertRequest": {
        "type": "object",
        "properties": {
          "html": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "file": {
            "type": "string"
          },
          "sourceFilename": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "to": {
            "type": "string",
            "enum": [
              "pdf",
              "docx",
              "xlsx",
              "html",
              "png"
            ],
            "default": "pdf"
          },
          "engine": {
            "type": "string",
            "enum": [
              "libreoffice",
              "wkhtmltopdf"
            ],
            "default": "libreoffice"
          },
          "response": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "options": {
            "type": "object",
            "properties": {
              "toc": {
                "type": "boolean"
              },
              "pageRange": {
                "type": "string"
              },
              "quality": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "losslessImages": {
                "type": "boolean"
              },
              "exportNotes": {
                "type": "boolean"
              },
              "exportNotesPages": {
                "type": "boolean"
              },
              "taggedPdf": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "FileUrlResponse": {
        "type": "object",
        "required": [
          "id",
          "status",
          "url",
          "filename",
          "sizeBytes",
          "expiresAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed"
            ]
          },
          "url": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobStatusResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "completed",
              "failed"
            ]
          },
          "pollUrl": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}