{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Toolkit: Merge, Split, Compress, Watermark, Protect, Unlock",
    "description": "Merge, split, extract or remove pages, rotate, compress, watermark, number, password-protect or unlock PDFs from a list of links. One result row per PDF, files in the key-value store. USD 0.01 per PDF (0.015 to compress); failures are free.",
    "version": "0.1",
    "x-build-id": "8sLrdRHYbtt11mvFW"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tanod~pdf-toolkit/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tanod-pdf-toolkit",
        "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/tanod~pdf-toolkit/runs": {
      "post": {
        "operationId": "runs-sync-tanod-pdf-toolkit",
        "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/tanod~pdf-toolkit/run-sync": {
      "post": {
        "operationId": "run-sync-tanod-pdf-toolkit",
        "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",
          "urls"
        ],
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "merge",
              "split",
              "extract-pages",
              "remove-pages",
              "rotate",
              "compress",
              "watermark",
              "page-numbers",
              "protect",
              "unlock"
            ],
            "type": "string",
            "description": "What to do. The options below apply to the operation they are named after and are ignored otherwise. Merge combines all the links into ONE PDF; every other operation runs once per link.",
            "default": "compress"
          },
          "urls": {
            "title": "PDF links",
            "type": "array",
            "description": "Public http(s) links to the PDFs (at most 20 MB each, at most 200 per run; merge takes 2 to 20, in the order to merge them). Private, internal and IP-address hosts are refused.",
            "items": {
              "type": "string"
            }
          },
          "pages": {
            "title": "Pages",
            "type": "string",
            "description": "Extract / remove pages (required), rotate, watermark and page numbers (optional, default all pages): 1-based, comma separated, each part N, N-M, N-, -M or last, e.g. 1-3,7 or 2-."
          },
          "splitMode": {
            "title": "Split: mode",
            "enum": [
              "ranges",
              "every"
            ],
            "type": "string",
            "description": "Split: by page ranges, or a new file every N pages.",
            "default": "ranges"
          },
          "splitRanges": {
            "title": "Split: ranges",
            "type": "string",
            "description": "Split (mode ranges): one file per comma-separated part, e.g. 1-3,4-6,7- (at most 50 files)."
          },
          "splitEvery": {
            "title": "Split: pages per file",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Split (mode every): pages in each file."
          },
          "angle": {
            "title": "Rotate: angle",
            "enum": [
              "90",
              "180",
              "270",
              "-90"
            ],
            "type": "string",
            "description": "Rotate: degrees clockwise, added to each page's current rotation.",
            "default": "90"
          },
          "compressionLevel": {
            "title": "Compress: level",
            "enum": [
              "lossless",
              "recommended",
              "extreme"
            ],
            "type": "string",
            "description": "Compress: lossless (structure only), recommended (images at JPEG q75, 150 dpi at most) or extreme (q50, 96 dpi). A PDF that cannot be made smaller is returned unchanged.",
            "default": "recommended"
          },
          "imageQuality": {
            "title": "Compress: image quality",
            "minimum": 10,
            "maximum": 95,
            "type": "integer",
            "description": "Compress: JPEG quality for images, overriding the level."
          },
          "maxImageDpi": {
            "title": "Compress: max image dpi",
            "minimum": 50,
            "maximum": 600,
            "type": "integer",
            "description": "Compress: downsample images above this resolution, overriding the level."
          },
          "watermarkText": {
            "title": "Watermark: text",
            "type": "string",
            "description": "Watermark: Latin text to stamp (1 to 200 characters), e.g. DRAFT."
          },
          "watermarkPosition": {
            "title": "Watermark: position",
            "enum": [
              "center",
              "top-left",
              "top-center",
              "top-right",
              "middle-left",
              "middle-right",
              "bottom-left",
              "bottom-center",
              "bottom-right"
            ],
            "type": "string",
            "description": "Watermark: where on the page.",
            "default": "center"
          },
          "watermarkOpacity": {
            "title": "Watermark: opacity",
            "minimum": 0.05,
            "maximum": 1,
            "type": "number",
            "description": "Watermark: 0.05 to 1.",
            "default": 0.3
          },
          "watermarkFontSize": {
            "title": "Watermark: font size",
            "minimum": 6,
            "maximum": 300,
            "type": "number",
            "description": "Watermark: size in points.",
            "default": 48
          },
          "watermarkAngle": {
            "title": "Watermark: angle",
            "minimum": -360,
            "maximum": 360,
            "type": "number",
            "description": "Watermark: rotation in degrees.",
            "default": 45
          },
          "watermarkColor": {
            "title": "Watermark: colour",
            "type": "string",
            "description": "Watermark: colour as #rrggbb.",
            "default": "#808080"
          },
          "watermarkLayer": {
            "title": "Watermark: layer",
            "enum": [
              "over",
              "under"
            ],
            "type": "string",
            "description": "Watermark: over or under the page content.",
            "default": "over"
          },
          "numberFormat": {
            "title": "Page numbers: format",
            "type": "string",
            "description": "Page numbers: text with {n} (this page's number) and {N} (total pages), e.g. Page {n} of {N}.",
            "default": "{n} / {N}"
          },
          "numberPosition": {
            "title": "Page numbers: position",
            "enum": [
              "top-left",
              "top-center",
              "top-right",
              "bottom-left",
              "bottom-center",
              "bottom-right"
            ],
            "type": "string",
            "description": "Page numbers: where on the page.",
            "default": "bottom-center"
          },
          "startNumber": {
            "title": "Page numbers: first number",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Page numbers: the number printed on the first selected page.",
            "default": 1
          },
          "userPassword": {
            "title": "Protect: password to open",
            "type": "string",
            "description": "Protect (required): the password needed to open the PDF (AES-256). Stored encrypted by Apify and never written to results or logs."
          },
          "ownerPassword": {
            "title": "Protect: owner password",
            "type": "string",
            "description": "Protect (optional): the password that lifts the restrictions below. If empty, a random one nobody knows is used."
          },
          "denyPermissions": {
            "title": "Protect: deny permissions",
            "type": "array",
            "description": "Protect (optional): actions a user-password holder may NOT do, from: print, modify, copy_text, annotate, fill_forms, accessibility, assemble, print_high_quality.",
            "items": {
              "type": "string"
            }
          },
          "password": {
            "title": "Unlock: password",
            "type": "string",
            "description": "Unlock: the user or owner password that opens the PDFs. Leave empty for a PDF that is restricted by an owner password only. Stored encrypted by Apify and never written to results or logs."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}