{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Batch Suite",
    "description": "Batch PDF automation in one Actor: merge, split, rotate, watermark, compress, page/Bates numbering, metadata sanitize, and password protect/decrypt. Pass a list of PDF URLs or files, pick one operation, get every processed file back with a download link. Self-contained, no external API.",
    "version": "0.2",
    "x-build-id": "4clZEdQDkKpi0twEn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/moonweil~pdf-batch-suite/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-moonweil-pdf-batch-suite",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/moonweil~pdf-batch-suite/runs": {
      "post": {
        "operationId": "runs-sync-moonweil-pdf-batch-suite",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/moonweil~pdf-batch-suite/run-sync": {
      "post": {
        "operationId": "run-sync-moonweil-pdf-batch-suite",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "operation",
          "files"
        ],
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "merge",
              "split",
              "watermark",
              "compress",
              "rotate",
              "pageNumbers",
              "sanitize",
              "protect",
              "decrypt"
            ],
            "type": "string",
            "description": "Which PDF operation to run on every input file in this run.\n\n- **merge** – combine ALL input files into one PDF (order = order of the list)\n- **split** – split each input PDF into multiple PDFs (returned as one ZIP per input)\n- **watermark** – stamp a text watermark onto every page of each input\n- **compress** – reduce the file size of each input PDF\n- **rotate** – rotate every page of each input by 90/180/270°\n- **pageNumbers** – stamp page numbers or Bates numbers onto every page\n- **sanitize** – strip JavaScript, embedded files and hidden metadata before sharing\n- **protect** – add a password / encryption to each input PDF\n- **decrypt** – remove a known password from each input PDF"
          },
          "files": {
            "title": "Input files",
            "minItems": 1,
            "type": "array",
            "description": "PDF files to process. Each item can be:\n- a public **https:// URL** to a PDF\n- a **data URI** `data:application/pdf;base64,...`\n- a bare **`KEY`** for a record in this run's own default key-value store\n- a **key-value store reference** `kvs://STORE_ID/KEY` — only for stores this run can access (its own, or one shared with it in an Apify workflow); for files that live elsewhere use an https:// URL\n\nFor `merge`, all files are combined into a single output (in list order). For every other operation each file is processed independently and produces its own output + dataset row.",
            "items": {
              "type": "string"
            }
          },
          "operationParams": {
            "title": "Operation parameters",
            "type": "object",
            "description": "Options for the selected operation. Same params apply to every file in the batch. Leave empty to use defaults.\n\n- **merge**: `{ \"sortType\": \"orderProvided|byFileName|byDateModified|byDateCreated|byPDFTitle\", \"removeCertSign\": true }`\n- **split**: `{ \"mode\": \"pages\", \"pageNumbers\": \"1,3,5-10\" }` or `{ \"mode\": \"everyN\", \"everyNPages\": 5 }`\n- **watermark**: `{ \"text\": \"CONFIDENTIAL\", \"fontSize\": 30, \"rotation\": 45, \"opacity\": 0.5, \"widthSpacer\": 50, \"heightSpacer\": 50, \"customColor\": \"#d3d3d3\" }` (text is required)\n- **compress**: `{ \"optimizeLevel\": 5, \"expectedOutputSize\": \"2MB\", \"grayscale\": false }` (optimizeLevel 1-9; expectedOutputSize optional)\n- **rotate**: `{ \"angle\": 90 }` (angle is required: 90, 180 or 270; negative = counter-clockwise)\n- **pageNumbers**: `{ \"customText\": \"{n}\", \"position\": 8, \"startingNumber\": 1, \"zeroPad\": 0, \"pagesToNumber\": \"all\", \"fontSize\": 12, \"fontType\": \"helvetica\", \"fontColor\": \"#000000\", \"customMargin\": \"medium\" }` — `customText` supports `{n}` (current page), `{total}` (page count) and `{filename}`; for Bates numbering use e.g. `{ \"customText\": \"ABC-{n}\", \"zeroPad\": 6 }`. `position` 1-9 = top-left … bottom-right.\n- **sanitize**: `{ \"removeJavaScript\": true, \"removeEmbeddedFiles\": true, \"removeXMPMetadata\": true, \"removeMetadata\": true, \"removeLinks\": false, \"removeFonts\": false }` (all default as shown)\n- **protect**: `{ \"password\": \"secret\", \"ownerPassword\": \"\", \"keyLength\": 256, \"preventPrinting\": false, \"preventModify\": false, \"preventExtractContent\": false }` (password is required)\n- **decrypt**: `{ \"password\": \"secret\" }` (password is required)"
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "auto",
              "pdf",
              "zip"
            ],
            "type": "string",
            "description": "Format of the produced file. `auto` = PDF for every operation except `split` (which always returns a ZIP).",
            "default": "auto"
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Input files larger than this are skipped with a failed row (and never charged).",
            "default": 100
          },
          "perFileTimeoutSecs": {
            "title": "Per-file timeout (seconds)",
            "minimum": 10,
            "maximum": 900,
            "type": "integer",
            "description": "Maximum time to wait for the PDF engine to process a single file / operation before marking it failed.",
            "default": 120
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}