{
  "openapi": "3.1.0",
  "info": {
    "title": "RelayPDF API",
    "version": "1.0.0",
    "description": "Generate, convert, and manipulate documents. Chromium PDF/screenshots, PDF tools, barcodes, markdown, zip, and Office conversion."
  },
  "servers": [
    {
      "url": "https://api.relaypdf.com",
      "description": "Production Worker"
    },
    {
      "url": "http://localhost:8787",
      "description": "Local Worker"
    }
  ],
  "paths": {
    "/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 auth. Generating tools return a 24h URL. Same tool names as stdio MCP.",
        "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"
          }
        }
      }
    },
    "/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/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}": {
      "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": {
      "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"
          }
        }
      },
      "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"
              }
            }
          }
        }
      },
      "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"
              }
            }
          }
        }
      }
    }
  }
}