{
  "openapi": "3.0.1",
  "info": {
    "title": "Notion Automation Toolkit",
    "description": "Automate your Notion workspace - Export, backup, migrate, and manage your Notion content at scale with 9 powerful automation tasks.",
    "version": "1.0",
    "x-build-id": "Wot4DYMU1w0a12X8u"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/waxlike_polecat~notion-automation-toolkit/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-waxlike_polecat-notion-automation-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/waxlike_polecat~notion-automation-toolkit/runs": {
      "post": {
        "operationId": "runs-sync-waxlike_polecat-notion-automation-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/waxlike_polecat~notion-automation-toolkit/run-sync": {
      "post": {
        "operationId": "run-sync-waxlike_polecat-notion-automation-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": [
          "task",
          "notionApiKey"
        ],
        "properties": {
          "task": {
            "title": "Automation Task",
            "enum": [
              "export_workspace",
              "backup_database",
              "database_to_csv",
              "bulk_page_creation",
              "content_migration",
              "search_and_export",
              "export_relations",
              "workspace_analytics",
              "duplicate_pages"
            ],
            "type": "string",
            "description": "Select the automation task to perform",
            "default": "export_workspace"
          },
          "notionApiKey": {
            "title": "Notion API Key",
            "type": "string",
            "description": "Your Notion integration API key (starts with 'secret_' or 'ntn_'). Create one at: https://www.notion.so/my-integrations"
          },
          "databaseId": {
            "title": "Database ID or URL",
            "type": "string",
            "description": "Notion database ID or full URL (required for database operations)"
          },
          "pageId": {
            "title": "Page ID or URL",
            "type": "string",
            "description": "Notion page ID or full URL (required for page operations)"
          },
          "targetDatabaseId": {
            "title": "Target Database ID",
            "type": "string",
            "description": "Target database ID for migration tasks"
          },
          "format": {
            "title": "Export Format",
            "enum": [
              "json",
              "markdown",
              "csv",
              "html"
            ],
            "type": "string",
            "description": "Format for exported data",
            "default": "json"
          },
          "includeArchived": {
            "title": "Include Archived",
            "type": "boolean",
            "description": "Include archived pages/databases in export",
            "default": false
          },
          "includeChildren": {
            "title": "Include Children",
            "type": "boolean",
            "description": "Include child blocks/pages in export",
            "default": true
          },
          "maxDepth": {
            "title": "Maximum Depth",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum depth for nested content (1-10)",
            "default": 3
          },
          "filters": {
            "title": "Filters (JSON)",
            "type": "object",
            "description": "Notion API filters in JSON format. Example: {\"property\": \"Status\", \"select\": {\"equals\": \"Done\"}}"
          },
          "sorts": {
            "title": "Sorts (JSON Array)",
            "type": "array",
            "description": "Notion API sorts. Example: [{\"property\": \"Name\", \"direction\": \"ascending\"}]"
          },
          "limit": {
            "title": "Record Limit",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of records to process"
          },
          "properties": {
            "title": "Properties (JSON)",
            "type": "object",
            "description": "Properties for bulk operations in JSON format. For bulk page creation, provide an array of page properties."
          },
          "sourceFormat": {
            "title": "Source Format",
            "enum": [
              "markdown",
              "html",
              "notion"
            ],
            "type": "string",
            "description": "Source content format for migration",
            "default": "markdown"
          },
          "dryRun": {
            "title": "Dry Run Mode",
            "type": "boolean",
            "description": "Preview changes without actually executing them",
            "default": false
          },
          "outputTo": {
            "title": "Output Destination",
            "enum": [
              "dataset",
              "kvstore",
              "both"
            ],
            "type": "string",
            "description": "Where to store the results",
            "default": "dataset"
          },
          "webhook": {
            "title": "Webhook URL",
            "type": "string",
            "description": "HTTP endpoint to receive completion notification"
          },
          "notifyOnComplete": {
            "title": "Notify on Complete",
            "type": "boolean",
            "description": "Send webhook notification when task completes",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}