{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Tools - Merge, Split, Compress, Rotate & Extract in Bulk",
    "description": "Merge PDFs, split them into pages or ranges, extract or rotate pages, compress and read PDF info, from links or another Actor's dataset. Results are files with public links. Built for n8n, Make, Zapier and AI agents.",
    "version": "0.1",
    "x-build-id": "IMWyJMywBDjNtEb4M"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/northbell~pdf-tools/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-northbell-pdf-tools",
        "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/northbell~pdf-tools/runs": {
      "post": {
        "operationId": "runs-sync-northbell-pdf-tools",
        "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/northbell~pdf-tools/run-sync": {
      "post": {
        "operationId": "run-sync-northbell-pdf-tools",
        "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",
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "split",
              "merge",
              "extract",
              "rotate",
              "compress",
              "info"
            ],
            "type": "string",
            "description": "What to do with the PDFs. Merge makes one file from all links in the order given; every other operation works on each link separately.",
            "default": "split"
          },
          "pdfUrls": {
            "title": "PDF links",
            "type": "array",
            "description": "Direct links to PDF files. Or leave empty and give a Dataset ID. For merge, the order here is the order in the merged file (dataset links come after these).",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset ID",
            "type": "string",
            "description": "Read PDF links from this Apify dataset (e.g. the dataset of a scraper or downloader run). Use {{resource.defaultDatasetId}} when you connect this Actor as an integration after another Actor."
          },
          "urlField": {
            "title": "Link field in the dataset",
            "type": "string",
            "description": "Name of the field that holds the PDF link. A dotted path works (files.url). The field may hold one link or a list of links; every link is used.",
            "default": "url"
          },
          "ranges": {
            "title": "Page ranges (split)",
            "type": "string",
            "description": "Split only: one output file per range, for example 1-3,5,7- (pages start at 1; 7- means page 7 to the end). Empty: use Every N pages, or one file per page."
          },
          "everyN": {
            "title": "Every N pages (split)",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Split only, when Page ranges is empty: one file per N pages (for example 10). Empty: one file per page. At most 1,000 files from one PDF."
          },
          "pages": {
            "title": "Pages (extract, rotate)",
            "type": "string",
            "description": "Extract: the pages to keep, in the order written, for example 1-3,5,7-. Rotate: the pages to turn (empty means all pages)."
          },
          "rotateDegrees": {
            "title": "Rotate by (degrees)",
            "enum": [
              "90",
              "180",
              "270"
            ],
            "type": "string",
            "description": "Rotate only. Added to the rotation the page already has.",
            "default": "90"
          },
          "compressLevel": {
            "title": "Compress level",
            "enum": [
              "ebook",
              "screen",
              "printer",
              "none"
            ],
            "type": "string",
            "description": "Compress only. Images are downsampled with Ghostscript at this level. If the result is not smaller, the original is kept and nothing is charged.",
            "default": "ebook"
          },
          "outputName": {
            "title": "Output file name",
            "type": "string",
            "description": "Optional name for the result files (without .pdf). Merge: the merged file is called this (default merged.pdf). Other operations: used instead of the input's file name."
          },
          "onlyNew": {
            "title": "Only new files",
            "type": "boolean",
            "description": "Skip links this Actor already handled with the same operation and settings in an earlier run (kept in a key-value store named pdf-tools-seen in your account). Use it for scheduled runs. Skipped files are free.",
            "default": false
          },
          "maxItems": {
            "title": "Max files per run",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Cap on input PDFs per run, counting the links above and the dataset together (files skipped by Only new files do not count). Files over the cap are left for the next run.",
            "default": 200
          },
          "maxFileMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 300,
            "type": "integer",
            "description": "Larger inputs, and results larger than this, come back as errors, free. Hard cap 300.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}