{
  "openapi": "3.0.1",
  "info": {
    "title": "Proxy Rotation Manager - Pool Health Check & Rotate",
    "description": "Reliability layer for proxy-backed jobs. Health-checks every proxy in your pool (status, latency, exit IP), ranks the healthy ones, then fetches your targets with round-robin, least-recently-used, or sticky rotation and automatic retry. Credentials are always masked.",
    "version": "1.0",
    "x-build-id": "sy9V6Lom8lcCXEsVn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/apricot_blackberry~proxy-rotation-manager/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-apricot_blackberry-proxy-rotation-manager",
        "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/apricot_blackberry~proxy-rotation-manager/runs": {
      "post": {
        "operationId": "runs-sync-apricot_blackberry-proxy-rotation-manager",
        "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/apricot_blackberry~proxy-rotation-manager/run-sync": {
      "post": {
        "operationId": "run-sync-apricot_blackberry-proxy-rotation-manager",
        "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": {
          "testUrl": {
            "title": "Health-check URL",
            "type": "string",
            "description": "URL each proxy is probed against in the health-check phase. Use an IP-echo endpoint so the response reveals the proxy's exit IP. Defaults to ipify.",
            "default": "https://api.ipify.org?format=json"
          },
          "proxyConfiguration": {
            "title": "Apify Proxy (billed to your account)",
            "type": "object",
            "description": "Apify Proxy configuration. Each rotation is a distinct session, so the pool gets distinct exit IPs. All proxy traffic is billed to YOUR Apify account. Leave the groups empty to use whichever datacenter groups your account has access to (a group you lack, e.g. DATACENTER on some plans, is rejected before the run starts). Leave empty if you supply your own proxyUrls; with no pool at all the run scores Apify Proxy, or the direct connection against built-in public endpoints."
          },
          "proxyUrls": {
            "title": "Bring-your-own proxy URLs",
            "type": "array",
            "description": "Your own proxy endpoints, e.g. http://user:pass@host:port. Used as the pool alongside (or instead of) Apify Proxy. Credentials are never emitted — passwords are masked in every output row and log line.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "poolSize": {
            "title": "Apify Proxy pool size",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many distinct Apify Proxy sessions to spin up as the pool when using proxyConfiguration. Ignored when you supply your own proxyUrls. Each session is one health-checked proxy.",
            "default": 5
          },
          "targetUrls": {
            "title": "Target URLs to fetch",
            "type": "array",
            "description": "Optional. URLs to fetch through the healthy proxy pool in phase 2. Leave empty to run health-check only. Each URL is fetched once, retrying on the next proxy if it fails.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "rotationStrategy": {
            "title": "Rotation strategy",
            "enum": [
              "round-robin",
              "least-recently-used",
              "sticky-per-host"
            ],
            "type": "string",
            "description": "How targets are distributed across the healthy pool. round-robin cycles through proxies in latency order; least-recently-used picks the proxy idle longest; sticky-per-host pins each target host to one proxy (moving on only when it fails).",
            "default": "round-robin"
          },
          "maxRetriesPerTarget": {
            "title": "Max retries per target",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "How many additional proxies to try for a target after the first attempt fails. 2 means up to 3 attempts total, each on a different proxy.",
            "default": 2
          },
          "requestTimeoutMs": {
            "title": "Per-request timeout (ms)",
            "minimum": 1000,
            "maximum": 120000,
            "type": "integer",
            "description": "Timeout for each individual health-check and target request, in milliseconds.",
            "default": 30000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}