{
  "openapi": "3.1.0",
  "info": {
    "title": "BrightData Web Archive API",
    "version": "1.0.0",
    "description": "API to search and retrieve archived web pages."
  },
  "servers": [
    {
      "url": "https://api.brightdata.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/webarchive/search": {
      "post": {
        "summary": "Run a search",
        "description": "To initiate a search of our Archive, use the following `/search` endpoint.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filters": {
                    "type": "object",
                    "description": "The filters used for this search (echoed back)",
                    "properties": {
                      "max_age": {
                        "type": "string",
                        "description": "Limits results to records collected within a specified time range. \n\n> **Mandatory**:  Either use `max_age` OR a combination of `min_date` + `max_date`"
                      },
                      "min_date": {
                        "description": "Returns records collected on or after the specified date. \n\n> **Mandatory**:  Either use `max_age` OR a combination of `min_date` + `max_date`",
                        "type": "string",
                        "format": "date"
                      },
                      "max_date": {
                        "description": "Returns records collected on or before the specified date. \n\n> **Mandatory**:  Either use `max_age` OR a combination of `min_date` + `max_date`",
                        "type": "string",
                        "format": "date"
                      },
                      "domain_whitelist": {
                        "description": "Includes results only from listed domains. \n\n> **Tip**:  Either use `domain_whitelist` OR `domain_blacklist` for best results.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "domain_blacklist": {
                        "description": "Excludes results from listed domains. \n\n> **Tip**:  Either use `domain_whitelist` OR `domain_blacklist` for best results.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "domain_regex_whitelist": {
                        "description": "Includes results only matching the specified domain regex pattern.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "domain_regex_blacklist": {
                        "description": "Excludes results matching the specified domain regex pattern.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "domain_like_whitelist": {
                        "description": "Includes domains matching LIKE pattern (% = any chars, _ = single char). Case-insensitive.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "domain_like_blacklist": {
                        "description": "Excludes domains matching LIKE pattern. Case-insensitive.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "category_whitelist": {
                        "description": "Includes results only from specified categories.",
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "Ads",
                            "Application Stores",
                            "Artificial Intelligence",
                            "Auctions",
                            "Business and Economy",
                            "Computer and Internet Info",
                            "Content Delivery Networks",
                            "Cryptocurrency News",
                            "Entertainment and Arts",
                            "Events/Tickets",
                            "Financial Services",
                            "Health and Medicine",
                            "Home and Garden",
                            "Internet Communications and Telephony",
                            "Internet Portals",
                            "Job Search",
                            "Motor Vehicles",
                            "News",
                            "Personal Sites and Blogs",
                            "Philosophy and Political Advocacy",
                            "Real Estate",
                            "Reference and Research",
                            "Search Engines",
                            "Shopping",
                            "Social Networking",
                            "Society",
                            "Tracking Sites",
                            "Travel",
                            "Weapons",
                            "Web Hosting",
                            "Web Management Services"
                          ]
                        }
                      },
                      "category_blacklist": {
                        "description": "Excludes results from specified categories.",
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "Ads",
                            "Application Stores",
                            "Artificial Intelligence",
                            "Auctions",
                            "Business and Economy",
                            "Computer and Internet Info",
                            "Content Delivery Networks",
                            "Cryptocurrency News",
                            "Entertainment and Arts",
                            "Events/Tickets",
                            "Financial Services",
                            "Health and Medicine",
                            "Home and Garden",
                            "Internet Communications and Telephony",
                            "Internet Portals",
                            "Job Search",
                            "Motor Vehicles",
                            "News",
                            "Personal Sites and Blogs",
                            "Philosophy and Political Advocacy",
                            "Real Estate",
                            "Reference and Research",
                            "Search Engines",
                            "Shopping",
                            "Social Networking",
                            "Society",
                            "Tracking Sites",
                            "Travel",
                            "Weapons",
                            "Web Hosting",
                            "Web Management Services"
                          ]
                        }
                      },
                      "url_regex_whitelist": {
                        "description": "Includes results only matching the specified URL regex pattern.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "url_regex_blacklist": {
                        "description": "Excludes results matching the specified URL regex pattern.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "url_like_whitelist": {
                        "description": "Includes URLs matching LIKE pattern (% = any chars, _ = single char). Case-insensitive.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "url_like_blacklist": {
                        "description": "Excludes URLs matching LIKE pattern. Case-insensitive.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "language_whitelist": {
                        "description": "Includes results only for specific language codes (ISO 639-3).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "language_blacklist": {
                        "description": "Excludes results for specific language codes.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "ip_country_whitelist": {
                        "description": "Includes results collected through IPs or peers only from specified countries.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "ip_country_blacklist": {
                        "description": "Excludes results collected through IPs or peers from specified countries.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "captcha": {
                        "description": "Return only results with captcha triggered",
                        "type": "boolean"
                      },
                      "robots_block": {
                        "description": "Return only results with robots block",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "max_age"
                    ]
                  }
                },
                "example": {
                  "filters": {
                    "max_age": "24h",
                    "min_date": "YYYY-MM-DD",
                    "max_date": "YYYY-MM-DD",
                    "domain_whitelist": [
                      "example.com"
                    ],
                    "domain_blacklist": [
                      "example.com"
                    ],
                    "domain_regex_whitelist": [
                      ".*example..*"
                    ],
                    "domain_regex_blacklist": [
                      ".*example..*"
                    ],
                    "domain_like_whitelist": [
                      "%.example.%",
                      "example%"
                    ],
                    "domain_like_blacklist": [
                      "%.example.ca"
                    ],
                    "category_whitelist": [
                      "Motor Vehicles"
                    ],
                    "category_blacklist": [
                      "Motor Vehicles"
                    ],
                    "url_regex_whitelist": [
                      ".*/products/.*"
                    ],
                    "url_regex_blacklist": [
                      ".*/products/.*"
                    ],
                    "url_like_whitelist": [
                      "%/products/%",
                      "%/search%"
                    ],
                    "url_like_blacklist": [
                      "%/review/%"
                    ],
                    "language_whitelist": [
                      "eng"
                    ],
                    "language_blacklist": [
                      "eng"
                    ],
                    "ip_country_whitelist": [
                      "us",
                      "ie",
                      "in"
                    ],
                    "ip_country_blacklist": [
                      "mx",
                      "ae",
                      "ca"
                    ],
                    "captcha": true,
                    "robots_block": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search initiated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "title": "Async (Still Running)",
                      "type": "object",
                      "properties": {
                        "search_id": {
                          "type": "string",
                          "description": "Returned if search is async",
                          "example": "ucd_abc123xyz"
                        }
                      },
                      "example": {
                        "search_id": "ucd_abc123xyz"
                      }
                    },
                    {
                      "title": "Completed within 30s",
                      "type": "object",
                      "properties": {
                        "search_id": {
                          "type": "string",
                          "description": "Unique identifier for the search"
                        },
                        "status": {
                          "type": "string",
                          "description": "Current status: `in_progress`, `done`, or `failed`"
                        },
                        "filters": {
                          "type": "object",
                          "description": "The filters used for this search (echoed back)"
                        },
                        "files_count": {
                          "type": "integer",
                          "description": "Total number of matching files found"
                        },
                        "estimate_batch_count": {
                          "type": "integer",
                          "description": "Estimated number of batches for the dump"
                        },
                        "estimate_batch_size": {
                          "type": "integer",
                          "description": "Estimated total size in bytes"
                        },
                        "dump_cost_usd": {
                          "type": "number",
                          "description": "Estimated total cost to create a dump"
                        },
                        "cost_breakdown": {
                          "type": "object",
                          "description": "Breakdown of costs between cache and archive pages",
                          "properties": {
                            "archive_pages_count": {
                              "type": "integer"
                            },
                            "archive_pages_cost": {
                              "type": "number"
                            },
                            "cache_pages_count": {
                              "type": "integer"
                            },
                            "cache_pages_cost": {
                              "type": "number"
                            }
                          }
                        },
                        "estimate_dump_duration_sec": {
                          "type": "integer",
                          "description": "Estimated time to complete the dump in seconds"
                        },
                        "duration": {
                          "type": "string",
                          "description": "How long the search took to complete"
                        },
                        "error": {
                          "type": "string",
                          "description": "Error message (only present when status is `failed`)"
                        }
                      },
                      "example": {
                        "search_id": "ucd_abc123xyz",
                        "status": "done",
                        "filters": {
                          "domain_whitelist": [
                            "example.com",
                            "www.example.com"
                          ],
                          "max_age": "1d",
                          "min_date": "2026-02-05T10:00:00.000Z"
                        },
                        "files_count": 12341294,
                        "estimate_batch_count": 130,
                        "estimate_batch_size": 1073679195,
                        "dump_cost_usd": 2468.26,
                        "cost_breakdown": {
                          "archive_pages_count": 0,
                          "archive_pages_cost": 0,
                          "cache_pages_count": 12341294,
                          "cache_pages_cost": 2468.26
                        },
                        "estimate_dump_duration_sec": 13000,
                        "duration": "4s210ms"
                      }
                    }
                  ]
                },
                "examples": {
                  "Async (Still Running)": {
                    "summary": "200 OK (async, search still running)",
                    "value": {
                      "search_id": "ucd_abc123xyz"
                    }
                  },
                  "Completed within 30s": {
                    "summary": "200 OK (completed within 30s)",
                    "value": {
                      "search_id": "ucd_abc123xyz",
                      "status": "done",
                      "filters": {
                        "domain_whitelist": [
                          "example.com",
                          "www.example.com"
                        ],
                        "max_age": "1d",
                        "min_date": "2026-02-05T10:00:00.000Z"
                      },
                      "files_count": 12341294,
                      "estimate_batch_count": 130,
                      "estimate_batch_size": 1073679195,
                      "dump_cost_usd": 2468.26,
                      "cost_breakdown": {
                        "archive_pages_count": 0,
                        "archive_pages_cost": 0,
                        "cache_pages_count": 12341294,
                        "cache_pages_cost": 2468.26
                      },
                      "estimate_dump_duration_sec": 13000,
                      "duration": "4s210ms"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "domain_blacklist cannot be used along with domain_whitelist"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webarchive/search/{search_id}": {
      "get": {
        "summary": "Get search status",
        "description": "Check the status and results of a previously submitted web archive search query.",
        "parameters": [
          {
            "name": "search_id",
            "in": "path",
            "required": true,
            "description": "Unique identifier for the search",
            "schema": {
              "type": "string",
              "example": "ucd_abc123xyz"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search status response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "title": "Success",
                      "type": "object",
                      "properties": {
                        "search_id": {
                          "type": "string",
                          "description": "Unique identifier for the search"
                        },
                        "status": {
                          "type": "string",
                          "description": "Current status: `in_progress`, `done`, or `failed`",
                          "enum": [
                            "done"
                          ]
                        },
                        "filters": {
                          "type": "object",
                          "description": "The filters used for this search (echoed back)"
                        },
                        "files_count": {
                          "type": "integer",
                          "description": "Total number of matching files found"
                        },
                        "estimate_batch_count": {
                          "type": "integer",
                          "description": "Estimated number of batches for the dump"
                        },
                        "estimate_batch_size": {
                          "type": "integer",
                          "description": "Estimated total size in bytes"
                        },
                        "dump_cost_usd": {
                          "type": "number",
                          "description": "Estimated total cost to create a dump"
                        },
                        "cost_breakdown": {
                          "type": "object",
                          "description": "Breakdown of costs between cache and archive pages",
                          "properties": {
                            "archive_pages_count": {
                              "type": "integer"
                            },
                            "archive_pages_cost": {
                              "type": "number"
                            },
                            "cache_pages_count": {
                              "type": "integer"
                            },
                            "cache_pages_cost": {
                              "type": "number"
                            }
                          }
                        },
                        "estimate_dump_duration_sec": {
                          "type": "integer",
                          "description": "Estimated time to complete the dump in seconds"
                        },
                        "duration": {
                          "type": "string",
                          "description": "How long the search took to complete"
                        },
                        "error": {
                          "type": "string",
                          "description": "Error message (only present when status is `failed`)"
                        }
                      },
                      "example": {
                        "search_id": "ucd_abc123xyz",
                        "status": "done",
                        "filters": {
                          "domain_whitelist": [
                            "example.com",
                            "www.example.com"
                          ],
                          "max_age": "1d",
                          "min_date": "2026-02-05T10:00:00.000Z"
                        },
                        "files_count": 12341294,
                        "estimate_batch_count": 130,
                        "estimate_batch_size": 1073679195,
                        "dump_cost_usd": 2468.26,
                        "cost_breakdown": {
                          "archive_pages_count": 0,
                          "archive_pages_cost": 0,
                          "cache_pages_count": 12341294,
                          "cache_pages_cost": 2468.26
                        },
                        "estimate_dump_duration_sec": 13000,
                        "duration": "4s210ms"
                      }
                    },
                    {
                      "title": "Pending",
                      "type": "object",
                      "properties": {
                        "search_id": {
                          "type": "string",
                          "description": "Unique identifier for the search",
                          "example": "ucd_abc123xyz"
                        },
                        "status": {
                          "type": "string",
                          "description": "Current status: `in_progress`, `done`, or `failed`",
                          "enum": [
                            "in_progress"
                          ]
                        }
                      },
                      "example": {
                        "search_id": "ucd_abc123xyz",
                        "status": "in_progress"
                      }
                    },
                    {
                      "title": "Failed",
                      "type": "object",
                      "properties": {
                        "search_id": {
                          "type": "string",
                          "description": "Unique identifier for the search",
                          "example": "ucd_abc123xyz"
                        },
                        "status": {
                          "type": "string",
                          "description": "Current status: `in_progress`, `done`, or `failed`",
                          "enum": [
                            "failed"
                          ]
                        },
                        "error": {
                          "type": "string",
                          "description": "Error message explaining the failure",
                          "example": "Path regex filter caused non-retryable error"
                        }
                      },
                      "example": {
                        "search_id": "ucd_abc123xyz",
                        "status": "failed",
                        "error": "Path regex filter caused non-retryable error"
                      }
                    }
                  ]
                },
                "examples": {
                  "Pending": {
                    "summary": "Search is still running",
                    "value": {
                      "search_id": "ucd_abc123xyz",
                      "status": "in_progress"
                    }
                  },
                  "Success": {
                    "summary": "Search completed successfully",
                    "value": {
                      "search_id": "ucd_abc123xyz",
                      "status": "done",
                      "filters": {
                        "max_age": "1d",
                        "domain_whitelist": [
                          "example.com"
                        ],
                        "min_date": "2026-02-05T11:00:00.000Z"
                      },
                      "files_count": 2885,
                      "estimate_batch_count": 1,
                      "estimate_batch_size": 1132300,
                      "dump_cost_usd": 0.58,
                      "cost_breakdown": {
                        "archive_pages_count": 0,
                        "archive_pages_cost": 0,
                        "cache_pages_count": 2885,
                        "cache_pages_cost": 0.58
                      },
                      "estimate_dump_duration_sec": 38,
                      "duration": "2s425ms"
                    }
                  },
                  "Failed": {
                    "summary": "Search failed",
                    "value": {
                      "search_id": "ucd_abc123xyz",
                      "status": "failed",
                      "error": "Path regex filter caused non-retryable error"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "example": "Unauthorized"
              }
            }
          },
          "404": {
            "description": "Search ID not found",
            "content": {
              "application/json": {
                "example": "Search ID not found"
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "example": "Internal server error"
              }
            }
          }
        }
      }
    },
    "/webarchive/searches": {
      "get": {
        "summary": "Get all search statuses",
        "description": "Retrieve the status and metadata of all current web archive searches.",
        "responses": {
          "200": {
            "description": "List of search statuses",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "title": "Pending",
                        "$ref": "#/components/schemas/SearchStatusPending"
                      },
                      {
                        "title": "Success",
                        "$ref": "#/components/schemas/SearchStatusSuccess"
                      },
                      {
                        "title": "Failed",
                        "$ref": "#/components/schemas/SearchStatusFailed"
                      }
                    ]
                  }
                },
                "examples": {
                  "MixedStatuses": {
                    "summary": "List containing multiple search statuses",
                    "value": [
                      {
                        "search_id": "ucd_abc123xyz",
                        "status": "in_progress"
                      },
                      {
                        "search_id": "ucd_def456xyz",
                        "status": "done",
                        "filters": {
                          "max_age": "1d",
                          "domain_whitelist": [
                            "example.com"
                          ],
                          "min_date": "2026-02-05T11:00:00.000Z"
                        },
                        "files_count": 2885,
                        "estimate_batch_count": 1,
                        "estimate_batch_size": 1132300,
                        "dump_cost_usd": 0.58,
                        "cost_breakdown": {
                          "archive_pages_count": 0,
                          "archive_pages_cost": 0,
                          "cache_pages_count": 2885,
                          "cache_pages_cost": 0.58
                        },
                        "estimate_dump_duration_sec": 38,
                        "duration": "2s425ms"
                      },
                      {
                        "search_id": "ucd_ghi789xyz",
                        "status": "failed",
                        "error": "Path regex filter caused non-retryable error"
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "example": "Unauthorized"
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "example": "Internal server error"
              }
            }
          }
        }
      }
    },
    "/webarchive/dump": {
      "post": {
        "summary": "Deliver a snapshot to Amazon S3, Azure Blob Storage or a Webhook",
        "description": "Delivers a snapshot from a completed search to cloud storage using the specified delivery strategy.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DumpCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dump created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DumpCreateResponse"
                },
                "examples": {
                  "Success": {
                    "summary": "Dump created successfully",
                    "value": {
                      "dump_id": "ucd_abc123-1234567890"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webarchive/dump/{dump_id}": {
      "get": {
        "summary": "Get data snapshot (dump) status",
        "description": "Check the status and progress of a specific data snapshot (dump) using the `dump_id`.",
        "parameters": [
          {
            "name": "dump_id",
            "in": "path",
            "required": true,
            "description": "Unique identifier for the data snapshot (dump)",
            "schema": {
              "type": "string",
              "example": "ucd_abc123-1234567890"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dump status response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DumpStatus"
                },
                "examples": {
                  "InProgress": {
                    "summary": "Dump is currently in progress",
                    "value": {
                      "dump_id": "ucd_abc123-1234567890",
                      "id": "ucd_abc123-1234567890",
                      "status": "in_progress",
                      "created": "2026-02-05T07:57:50.947Z",
                      "search_id": "ucd_xyz789",
                      "readiness": "22.31%",
                      "batches_total": 130,
                      "batches_uploaded": 28,
                      "files_total": 1241241251,
                      "files_uploaded": 345234234
                    }
                  },
                  "Finished": {
                    "summary": "Dump completed successfully",
                    "value": {
                      "dump_id": "ucd_abc123-1234567890",
                      "id": "ucd_abc123-1234567890",
                      "status": "done",
                      "created": "2026-02-05T07:57:50.947Z",
                      "done": "2026-02-05T08:21:55.245Z",
                      "readiness": "100.00%",
                      "search_id": "ucd_xyz789",
                      "batches_total": 130,
                      "batches_uploaded": 130,
                      "files_total": 1241241251,
                      "files_uploaded": 1241241251
                    }
                  },
                  "Failed": {
                    "summary": "Dump failed",
                    "value": {
                      "dump_id": "ucd_abc123-1234567890",
                      "id": "ucd_abc123-1234567890",
                      "status": "failed",
                      "created": "2026-02-05T07:57:50.947Z",
                      "search_id": "ucd_xyz789",
                      "error": "Designated delivery path not responding"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "example": "Unauthorized"
              }
            }
          },
          "404": {
            "description": "Dump ID not found",
            "content": {
              "application/json": {
                "example": "Dump ID not found"
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "example": "Internal server error"
              }
            }
          }
        }
      }
    },
    "/webarchive/dumps": {
      "get": {
        "summary": "Get all data snapshot statuses",
        "description": "Retrieve the status and metadata of all data snapshots (dumps).",
        "responses": {
          "200": {
            "description": "List of data snapshot statuses",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DumpStatus"
                  }
                },
                "examples": {
                  "MixedDumpStatuses": {
                    "summary": "List containing multiple dump statuses",
                    "value": [
                      {
                        "dump_id": "ucd_abc123-1234567890",
                        "id": "ucd_abc123-1234567890",
                        "status": "done",
                        "created": "2026-02-05T07:57:50.947Z",
                        "done": "2026-02-05T08:21:55.245Z",
                        "readiness": "100.00%",
                        "search_id": "ucd_xyz789",
                        "filters": {
                          "max_age": "2h",
                          "min_date": "2026-02-05T05:00:00.000Z"
                        },
                        "batches_total": 1,
                        "batches_uploaded": 1,
                        "files_total": 10,
                        "files_uploaded": 10
                      },
                      {
                        "dump_id": "ucd_def456-9876543210",
                        "id": "ucd_def456-9876543210",
                        "status": "in_progress",
                        "created": "2026-02-04T13:35:54.607Z",
                        "readiness": "50.00%",
                        "search_id": "ucd_qwe321",
                        "filters": {
                          "max_age": "1d",
                          "domain_whitelist": [
                            "example.com"
                          ]
                        },
                        "batches_total": 10,
                        "batches_uploaded": 5,
                        "files_total": 1000,
                        "files_uploaded": 500
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SearchStatusBase": {
        "type": "object",
        "required": [
          "search_id",
          "status"
        ],
        "properties": {
          "search_id": {
            "type": "string",
            "description": "Unique identifier for the search"
          },
          "status": {
            "type": "string",
            "enum": [
              "in_progress",
              "done",
              "failed"
            ]
          }
        }
      },
      "SearchStatusPending": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SearchStatusBase"
          },
          {
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "in_progress"
                ]
              }
            }
          }
        ]
      },
      "SearchStatusSuccess": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SearchStatusBase"
          },
          {
            "required": [
              "filters",
              "files_count",
              "estimate_batch_count",
              "estimate_batch_size",
              "dump_cost_usd",
              "cost_breakdown",
              "estimate_dump_duration_sec",
              "duration"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "done"
                ]
              },
              "filters": {
                "type": "object",
                "description": "Filters used for the search (echoed back)",
                "additionalProperties": true
              },
              "files_count": {
                "type": "integer",
                "description": "Total number of matching files found"
              },
              "estimate_batch_count": {
                "type": "integer",
                "description": "Estimated number of batches for the dump"
              },
              "estimate_batch_size": {
                "type": "integer",
                "description": "Estimated total size in bytes"
              },
              "dump_cost_usd": {
                "type": "number",
                "format": "float",
                "description": "Estimated total cost to create a dump"
              },
              "cost_breakdown": {
                "type": "object",
                "required": [
                  "archive_pages_count",
                  "archive_pages_cost",
                  "cache_pages_count",
                  "cache_pages_cost"
                ],
                "properties": {
                  "archive_pages_count": {
                    "type": "integer"
                  },
                  "archive_pages_cost": {
                    "type": "number",
                    "format": "float"
                  },
                  "cache_pages_count": {
                    "type": "integer"
                  },
                  "cache_pages_cost": {
                    "type": "number",
                    "format": "float"
                  }
                }
              },
              "estimate_dump_duration_sec": {
                "type": "number",
                "format": "float",
                "description": "Estimated time to complete the dump in seconds"
              },
              "duration": {
                "type": "string",
                "description": "How long the search took to complete"
              }
            }
          }
        ]
      },
      "SearchStatusFailed": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SearchStatusBase"
          },
          {
            "required": [
              "error"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "failed"
                ]
              },
              "error": {
                "type": "string",
                "description": "Error message explaining the failure"
              }
            }
          }
        ]
      },
      "DumpStatus": {
        "oneOf": [
          {
            "title": "In Progress",
            "$ref": "#/components/schemas/DumpStatusInProgress"
          },
          {
            "title": "Finished",
            "$ref": "#/components/schemas/DumpStatusDone"
          },
          {
            "title": "Failed",
            "$ref": "#/components/schemas/DumpStatusFailed"
          }
        ]
      },
      "DumpStatusBase": {
        "type": "object",
        "required": [
          "dump_id",
          "id",
          "status",
          "created",
          "search_id"
        ],
        "properties": {
          "dump_id": {
            "type": "string",
            "description": "Unique identifier for the dump"
          },
          "id": {
            "type": "string",
            "description": "Same as dump_id (included for compatibility)"
          },
          "status": {
            "type": "string",
            "enum": [
              "in_progress",
              "done",
              "failed",
              "canceled"
            ],
            "description": "Current status of the dump"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the dump was created"
          },
          "search_id": {
            "type": "string",
            "description": "ID of the search this dump is based on"
          },
          "filters": {
            "type": "object",
            "description": "Filters used to create the dump (present in list endpoint)",
            "additionalProperties": true
          }
        }
      },
      "DumpStatusInProgress": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DumpStatusBase"
          },
          {
            "required": [
              "readiness",
              "batches_total",
              "batches_uploaded",
              "files_total",
              "files_uploaded"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "in_progress"
                ],
                "description": "Current status of the dump"
              },
              "readiness": {
                "type": "string",
                "description": "Percentage of completion (e.g., \"22.31%\")"
              },
              "batches_total": {
                "type": "integer",
                "description": "Total number of batches to process"
              },
              "batches_uploaded": {
                "type": "integer",
                "description": "Number of batches uploaded so far"
              },
              "files_total": {
                "type": "integer",
                "description": "Total number of files in the dump"
              },
              "files_uploaded": {
                "type": "integer",
                "description": "Number of files uploaded so far"
              }
            }
          }
        ]
      },
      "DumpStatusDone": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DumpStatusBase"
          },
          {
            "required": [
              "status",
              "done",
              "readiness",
              "batches_total",
              "batches_uploaded",
              "files_total",
              "files_uploaded"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "done"
                ],
                "description": "Current status of the dump"
              },
              "done": {
                "type": "string",
                "format": "date-time",
                "description": "Timestamp when the dump completed"
              },
              "readiness": {
                "type": "string",
                "example": "100.00%",
                "description": "Percentage of completion (e.g., \"100.00%\")"
              },
              "batches_total": {
                "type": "integer",
                "description": "Total number of batches processed"
              },
              "batches_uploaded": {
                "type": "integer",
                "description": "Number of batches uploaded"
              },
              "files_total": {
                "type": "integer",
                "description": "Total number of files in the dump"
              },
              "files_uploaded": {
                "type": "integer",
                "description": "Number of files uploaded"
              }
            }
          }
        ]
      },
      "DumpStatusFailed": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DumpStatusBase"
          },
          {
            "required": [
              "error"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "failed"
                ],
                "description": "Current status of the dump"
              },
              "error": {
                "type": "string",
                "description": "Error message (only present when status is failed)"
              }
            }
          }
        ]
      },
      "DumpCreateRequest": {
        "type": "object",
        "required": [
          "search_id",
          "delivery"
        ],
        "properties": {
          "search_id": {
            "type": "string",
            "description": "Search ID from a completed search"
          },
          "max_entries": {
            "type": "integer",
            "description": "Maximum number of files to include in the dump"
          },
          "delivery": {
            "$ref": "#/components/schemas/DumpDelivery"
          }
        }
      },
      "DumpDelivery": {
        "oneOf": [
          {
            "title": "Amazon S3",
            "$ref": "#/components/schemas/S3Delivery"
          },
          {
            "title": "Azure Blob",
            "$ref": "#/components/schemas/AzureDelivery"
          },
          {
            "title": "Google Cloud Storage",
            "$ref": "#/components/schemas/GcpDelivery"
          },
          {
            "title": "Webhook",
            "$ref": "#/components/schemas/WebhookDelivery"
          }
        ]
      },
      "S3Delivery": {
        "type": "object",
        "required": [
          "strategy",
          "settings"
        ],
        "properties": {
          "strategy": {
            "type": "string",
            "enum": [
              "s3"
            ]
          },
          "settings": {
            "$ref": "#/components/schemas/S3DeliverySettings"
          }
        }
      },
      "S3DeliverySettings": {
        "type": "object",
        "required": [
          "bucket",
          "assume_role"
        ],
        "properties": {
          "bucket": {
            "type": "string",
            "description": "Target S3 bucket name"
          },
          "prefix": {
            "type": "string",
            "description": "Optional prefix path inside the bucket"
          },
          "assume_role": {
            "$ref": "#/components/schemas/S3AssumeRole"
          }
        }
      },
      "S3AssumeRole": {
        "type": "object",
        "required": [
          "role_arn"
        ],
        "properties": {
          "role_arn": {
            "type": "string",
            "description": "AWS IAM role ARN to assume for delivery"
          }
        }
      },
      "AzureDelivery": {
        "type": "object",
        "required": [
          "strategy",
          "settings"
        ],
        "properties": {
          "strategy": {
            "type": "string",
            "enum": [
              "azure"
            ]
          },
          "settings": {
            "$ref": "#/components/schemas/AzureDeliverySettings"
          }
        }
      },
      "GcpDelivery": {
        "type": "object",
        "required": [
          "strategy",
          "settings"
        ],
        "properties": {
          "strategy": {
            "type": "string",
            "enum": [
              "gcp"
            ]
          },
          "settings": {
            "type": "object",
            "required": [
              "bucket"
            ],
            "properties": {
              "bucket": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              }
            }
          }
        }
      },
      "WebhookDelivery": {
        "type": "object",
        "required": [
          "strategy",
          "settings"
        ],
        "properties": {
          "strategy": {
            "type": "string",
            "enum": [
              "webhook"
            ]
          },
          "settings": {
            "$ref": "#/components/schemas/WebhookDeliverySettings"
          }
        }
      },
      "AzureDeliverySettings": {
        "type": "object",
        "required": [
          "container",
          "credentials"
        ],
        "properties": {
          "container": {
            "type": "string",
            "description": "Azure Blob Storage container name"
          },
          "prefix": {
            "type": "string",
            "description": "Optional prefix path inside the container"
          },
          "credentials": {
            "$ref": "#/components/schemas/AzureCredentials"
          }
        }
      },
      "WebhookDeliverySettings": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "Webhook URL to receive notifications about dump delivery status"
          },
          "auth": {
            "type": "string",
            "description": "Bearer your-optional-auth-token"
          }
        }
      },
      "AzureCredentials": {
        "type": "object",
        "required": [
          "account",
          "key"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Azure storage account name"
          },
          "key": {
            "type": "string",
            "description": "Azure storage account access key"
          }
        }
      },
      "DumpCreateResponse": {
        "type": "object",
        "required": [
          "dump_id"
        ],
        "properties": {
          "dump_id": {
            "type": "string",
            "description": "ID of the created dump",
            "example": "ucd_abc123-1234567890"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Use your Bright Data API Key as a Bearer token in the Authorization header.\n\n**How to authenticate:**\n1. Obtain your API Key from the Bright Data account settings at https://brightdata.com/cp/setting/users\n2. Include the API Key in the Authorization header of your requests\n3. Format: `Authorization: Bearer YOUR_API_KEY`\n\n**Example:**\n```\nAuthorization: Bearer b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df\n```\n\nLearn how to get your Bright Data API key: https://docs.brightdata.com/api-reference/authentication",
        "bearerFormat": "API Key"
      }
    }
  }
}