{
  "openapi": "3.0.1",
  "info": {
    "title": "Supabase Automation Toolkit",
    "description": "Save hours with Supabase automation. Export, cleanup, backup with simple JSON tasks. Schedule daily reports, remove inactive users, free up storage automatically.",
    "version": "1.0",
    "x-build-id": "ClbjnH60aTkoqp44V"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/waxlike_polecat~supabase-automation-toolkit/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-waxlike_polecat-supabase-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~supabase-automation-toolkit/runs": {
      "post": {
        "operationId": "runs-sync-waxlike_polecat-supabase-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~supabase-automation-toolkit/run-sync": {
      "post": {
        "operationId": "run-sync-waxlike_polecat-supabase-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",
          "supabaseUrl",
          "supabaseKey"
        ],
        "properties": {
          "task": {
            "title": "Automation Task",
            "enum": [
              "export_data",
              "query_data",
              "export_users",
              "cleanup_users",
              "cleanup_storage",
              "list_storage",
              "analyze_schema",
              "table_stats",
              "backup_database"
            ],
            "type": "string",
            "description": "Type of automation task to execute"
          },
          "supabaseUrl": {
            "title": "Supabase Project URL",
            "pattern": "^https://[a-zA-Z0-9-]+\\.supabase\\.co$",
            "type": "string",
            "description": "Your Supabase project URL (e.g., https://abcdefghijk.supabase.co)"
          },
          "supabaseKey": {
            "title": "Supabase API Key",
            "type": "string",
            "description": "Your Supabase anon key or service role key. Use service role for admin operations (user management, cleanup)."
          },
          "table": {
            "title": "Table Name",
            "type": "string",
            "description": "Name of the table to operate on (for data export/query tasks)"
          },
          "format": {
            "title": "Export Format",
            "enum": [
              "csv",
              "json",
              "excel"
            ],
            "type": "string",
            "description": "Output format for exported data",
            "default": "csv"
          },
          "columns": {
            "title": "Columns to Export",
            "type": "array",
            "description": "Specific columns to export (leave empty for all columns)",
            "items": {
              "type": "string"
            }
          },
          "filters": {
            "title": "Filters (JSON)",
            "type": "object",
            "description": "Filter criteria as JSON object. Examples: {\"status\": \"active\"}, {\"created_at\": \"last_7_days\"}"
          },
          "orderBy": {
            "title": "Order By Column",
            "type": "string",
            "description": "Column to sort results by"
          },
          "orderDirection": {
            "title": "Order Direction",
            "enum": [
              "asc",
              "desc"
            ],
            "type": "string",
            "description": "Sort direction",
            "default": "desc"
          },
          "limit": {
            "title": "Row Limit",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of rows to export/query (default: 10000)",
            "default": 10000
          },
          "bucket": {
            "title": "Storage Bucket Name",
            "type": "string",
            "description": "Name of the storage bucket (for storage tasks)"
          },
          "path": {
            "title": "Storage Path",
            "type": "string",
            "description": "Path within the storage bucket (optional)"
          },
          "olderThanDays": {
            "title": "Older Than (Days)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "For cleanup tasks: delete/list files older than X days",
            "default": 30
          },
          "dryRun": {
            "title": "Dry Run Mode",
            "type": "boolean",
            "description": "If true, shows what would be deleted without actually deleting. Recommended for first run!",
            "default": true
          },
          "tables": {
            "title": "Tables to Backup",
            "type": "array",
            "description": "List of table names to backup (for backup task)",
            "items": {
              "type": "string"
            }
          },
          "compress": {
            "title": "Compress Output",
            "type": "boolean",
            "description": "Compress exported data (for large datasets)",
            "default": false
          },
          "includeMetadata": {
            "title": "Include Metadata",
            "type": "boolean",
            "description": "Include additional metadata in exports (file sizes, timestamps, etc.)",
            "default": true
          },
          "outputTo": {
            "title": "Output Destination",
            "enum": [
              "dataset",
              "kvstore",
              "both"
            ],
            "type": "string",
            "description": "Where to save results",
            "default": "dataset"
          },
          "webhook": {
            "title": "Webhook URL",
            "type": "string",
            "description": "Optional webhook to notify when task completes"
          },
          "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}