{
  "openapi": "3.0.1",
  "info": {
    "title": "Agoda Flights Scraper — Fares, OTA Offers & Price API",
    "description": "Scrape Agoda Flights fares by route and date. One-way and round-trip itineraries with airlines, flight numbers, segments, durations, stops and 14+ OTA booking offers per flight (provider prices, booking URLs, baggage rules). Flight price tracker and airfare data API for fare monitoring.",
    "version": "1.0",
    "x-build-id": "PANmtTSXKtyZdejfq"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sian.agency~agoda-flight-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sian.agency-agoda-flight-scraper",
        "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/sian.agency~agoda-flight-scraper/runs": {
      "post": {
        "operationId": "runs-sync-sian.agency-agoda-flight-scraper",
        "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/sian.agency~agoda-flight-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-sian.agency-agoda-flight-scraper",
        "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": {
          "searchMode": {
            "title": "🧭 Mode",
            "enum": [
              "search",
              "details"
            ],
            "type": "string",
            "description": "What to fetch.\n\n• **search** — one-way or round-trip fare search by route + date (paginated, 30 itineraries/page)\n• **details** — re-fetch specific itineraries by shareable flight URL or searchId + resultId (live re-priced booking offers)",
            "default": "search"
          },
          "origin": {
            "title": "🛫 Origin airport (IATA)",
            "type": "string",
            "description": "3-letter IATA code of the departure airport. Examples: **JFK** (New York), **BKK** (Bangkok), **SIN** (Singapore), **LHR** (London Heathrow).",
            "default": "JFK"
          },
          "destination": {
            "title": "🛬 Destination airport (IATA)",
            "type": "string",
            "description": "3-letter IATA code of the arrival airport. Examples: **LAX** (Los Angeles), **SIN** (Singapore), **DXB** (Dubai).",
            "default": "LAX"
          },
          "date": {
            "title": "📅 Departure date",
            "type": "string",
            "description": "Departure date in **YYYY-MM-DD** format. Must be in the future.\n\n💡 **TIP:** Leave empty to automatically search 30 days from today — handy for scheduled fare-tracking runs."
          },
          "returnDate": {
            "title": "🔁 Return date (optional)",
            "type": "string",
            "description": "Return date in **YYYY-MM-DD** format. When set, the search becomes **round-trip** and every itinerary carries both legs. Leave empty for one-way."
          },
          "adults": {
            "title": "🧑 Adults",
            "minimum": 1,
            "maximum": 9,
            "type": "integer",
            "description": "Adult passengers (12+). Default: 1.",
            "default": 1
          },
          "children": {
            "title": "🧒 Children",
            "minimum": 0,
            "maximum": 8,
            "type": "integer",
            "description": "Child passengers (ages 2–11). Default: 0.",
            "default": 0
          },
          "infants": {
            "title": "👶 Infants",
            "minimum": 0,
            "maximum": 4,
            "type": "integer",
            "description": "Infant passengers (under 2). Default: 0.",
            "default": 0
          },
          "cabin": {
            "title": "💺 Cabin class",
            "enum": [
              "Economy",
              "Premium_Economy",
              "Business",
              "First"
            ],
            "type": "string",
            "description": "Cabin class for the search. **Economy** is the most reliable; premium cabins depend on availability for the route and may return no results.",
            "default": "Economy"
          },
          "sortOrder": {
            "title": "↕️ Sort order",
            "enum": [
              "best",
              "price",
              "duration"
            ],
            "type": "string",
            "description": "How upstream ranks itineraries.\n\n• **best** — balance of price + duration + stops\n• **price** — cheapest first\n• **duration** — shortest first",
            "default": "best"
          },
          "routes": {
            "title": "🚀 Bulk routes (multiple searches)",
            "type": "array",
            "description": "🚀 **BULK PROCESSING:** Search many routes in one run. Each object needs `origin` and `destination`; `date` and `returnDate` are optional (empty date = 30 days from today).\n\n```json\n[\n  { \"origin\": \"JFK\", \"destination\": \"LAX\", \"date\": \"2026-08-10\" },\n  { \"origin\": \"BKK\", \"destination\": \"SIN\", \"date\": \"2026-08-10\", \"returnDate\": \"2026-08-17\" }\n]\n```\n\n📊 **TIER-BASED LIMITS:**\n- **FREE users:** 1 route per run\n- **PAID users:** Unlimited routes\n\n💡 When provided, this overrides the single origin/destination fields above."
          },
          "maxResults": {
            "title": "🔢 Max itineraries per route",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum itineraries to collect per route (30 per page upstream). FREE tier is capped at 25 itineraries per run.",
            "default": 30
          },
          "flightUrls": {
            "title": "🔗 Shareable flight URLs",
            "uniqueItems": true,
            "type": "array",
            "description": "🎫 **DETAILS MODE:** Shareable Agoda Flights URLs from a previous search run (every search row includes one in `shareableUrl`). Each URL is re-fetched live with its full booking-offer ladder.\n\nFormat: `https://flights.agoda.com/flights/JFK-LAX/2026-08-10/details/<resultId>?searchId=<searchId>`\n\n📊 **TIER-BASED LIMITS:**\n- **FREE users:** 1 itinerary per run\n- **PAID users:** Unlimited",
            "items": {
              "type": "string"
            }
          },
          "flightRefs": {
            "title": "🆔 Search/result references",
            "type": "array",
            "description": "🎫 **DETAILS MODE (alternative input):** Explicit references from a previous search — each object needs the search row's `searchId` and `resultId`.\n\n```json\n[\n  { \"searchId\": \"0HDiFhsesx\", \"resultId\": \"c0b8fae339ab097af3a2c41dad49c563\" }\n]\n```"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}