{
  "openapi": "3.1.0",
  "info": {
    "title": "CleanedWeb public API catalog",
    "version": "1.1.0",
    "summary": "Read the published web data APIs, then run one.",
    "description": "Reading the catalog needs no credential. Running an API needs a CleanedWeb account and an API key with the `run` scope, and uses the credits of that workspace.\n\nSend an `Idempotency-Key` header with every run and save it before you send. A run that does not end within `wait_seconds` answers 202; read `/result` with the same key.\n\nA saved sample on a listing shows what records look like. It is a saved sample, not a live run.\n\nVersions. A listing can have versions: majors you pin and minors inside them. Pin a major with \"version\": N in the run body (an integer). Leave it out and the call runs on the latest major. A sunset major runs on the latest major and the response says rerouted. An unknown major answers 404 catalog_version_not_found and lists the available majors. A call pinned to a deprecated or sunset major carries Deprecation, Sunset and Link headers on its answer.",
    "termsOfService": "https://cleanedweb.com/legal/terms/"
  },
  "externalDocs": {
    "description": "Published catalog APIs and Run a catalog API",
    "url": "https://cleanedweb.com/docs/catalog-apis/"
  },
  "servers": [
    {
      "url": "https://app.cleanedweb.com",
      "description": "CleanedWeb catalog (read-only routes)"
    }
  ],
  "tags": [
    {
      "name": "Catalog",
      "description": "Anonymous, read-only."
    },
    {
      "name": "Run",
      "description": "Needs an API key with the run scope."
    }
  ],
  "paths": {
    "/api/catalog/apis": {
      "get": {
        "operationId": "listCatalogApis",
        "tags": [
          "Catalog"
        ],
        "summary": "List the published APIs",
        "description": "Anonymous. `q` and `category` apply to the whole published inventory before paging. Answers are not cached.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Query"
          },
          {
            "$ref": "#/components/parameters/Category"
          },
          {
            "$ref": "#/components/parameters/Sort"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of APIs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogApiList"
                }
              }
            }
          },
          "422": {
            "description": "invalid_catalog_query: an unknown parameter, a repeated one, or a value out of range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/catalog/apis/{api_id}": {
      "get": {
        "operationId": "getCatalogApi",
        "tags": [
          "Catalog"
        ],
        "summary": "Read one API",
        "description": "Anonymous. Adds each endpoint's active_version to the list item.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          }
        ],
        "responses": {
          "200": {
            "description": "The API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogApi"
                }
              }
            }
          },
          "404": {
            "description": "No such published API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/catalog/apis/{api_id}/endpoints/{endpoint_id}/contract": {
      "get": {
        "operationId": "getCatalogContract",
        "tags": [
          "Catalog"
        ],
        "summary": "Read an endpoint's contract",
        "description": "Anonymous. The contract is generated from the exact saved definition that runs. `?version=` reads the contract of a major; without it you read the latest. On a listing that has versions the contract also carries `version`, `versions` and `changelog`.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "$ref": "#/components/parameters/EndpointId"
          },
          {
            "$ref": "#/components/parameters/ContractVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The contract.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contract"
                }
              }
            }
          },
          "404": {
            "description": "No such published API or endpoint, or catalog_version_not_found: the API has no such major. `available` lists the majors that answer, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "catalog_version_invalid: `version` is not a whole number of at least 1.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/catalog/public/apis/{api_id}/endpoints/{endpoint_id}/run": {
      "servers": [
        {
          "url": "https://api.cleanedweb.com",
          "description": "CleanedWeb API"
        }
      ],
      "post": {
        "operationId": "runCatalogApi",
        "tags": [
          "Run"
        ],
        "summary": "Run an endpoint",
        "description": "Runs the endpoint's latest major, or the major the body pins with `version`. Pin a major with \"version\": N in the run body (an integer). Leave it out and the call runs on the latest major. A sunset major runs on the latest major and the response says rerouted. An unknown major answers 404 catalog_version_not_found and lists the available majors. You cannot choose the source or the owner. Start with a small `max_items` while you check the shape of the records.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "$ref": "#/components/parameters/EndpointId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The run ended within wait_seconds, or the result is final. Records, summary, metadata, run and delivery. On a listing that has versions, `version` names the version that ran.",
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunResult"
                }
              }
            }
          },
          "202": {
            "description": "The run is queued or still running. Do not send the POST again; read /result with the same key after Retry-After seconds.",
            "headers": {
              "Location": {
                "description": "/v1/runs/{run_id}",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before reading the result.",
                "schema": {
                  "type": "integer"
                }
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "insufficient_units: the balance cannot fund the run. The error shows `required` and `available`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          },
          "403": {
            "description": "The credential is not tied to a workspace account, or lacks the run scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API, endpoint or delivery not found, or catalog_version_not_found: the API has no such major. `available` lists the majors that answer, oldest first. The API may be unpublished.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "usage_budget_exceeded, or delivery_identity_conflict: the key was reused for another endpoint, version or request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          },
          "422": {
            "description": "An input the contract does not accept, run_option_invalid, or catalog_version_invalid: `version` is not a whole number of at least 1 and nothing ran.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          },
          "503": {
            "description": "Billing could not be confirmed, or execution or storage is unavailable. Retry later with the same key. A 503 is never an empty result set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          }
        }
      }
    },
    "/v1/catalog/public/apis/{api_id}/endpoints/{endpoint_id}/result": {
      "servers": [
        {
          "url": "https://api.cleanedweb.com",
          "description": "CleanedWeb API"
        }
      ],
      "get": {
        "operationId": "getCatalogRunResult",
        "tags": [
          "Run"
        ],
        "summary": "Read a run's result",
        "description": "Send the same API key and the same Idempotency-Key as the run. Reading a result never collects the website again. It works after the API is unpublished or its version changes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiId"
          },
          {
            "$ref": "#/components/parameters/EndpointId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The run ended within wait_seconds, or the result is final. Records, summary, metadata, run and delivery. On a listing that has versions, `version` names the version that ran.",
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunResult"
                }
              }
            }
          },
          "202": {
            "description": "The run is queued or still running. Do not send the POST again; read /result with the same key after Retry-After seconds.",
            "headers": {
              "Location": {
                "description": "/v1/runs/{run_id}",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before reading the result.",
                "schema": {
                  "type": "integer"
                }
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "insufficient_units: the balance cannot fund the run. The error shows `required` and `available`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          },
          "403": {
            "description": "The credential is not tied to a workspace account, or lacks the run scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API, endpoint or delivery not found. The API may be unpublished.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "usage_budget_exceeded, or delivery_identity_conflict: the key was reused for another endpoint, version or request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          },
          "422": {
            "description": "An input the contract does not accept, or run_option_invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          },
          "503": {
            "description": "Billing could not be confirmed, or execution or storage is unavailable. Retry later with the same key. A 503 is never an empty result set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A CleanedWeb API key with the `run` scope. Keep it on your server."
      }
    },
    "parameters": {
      "ApiId": {
        "name": "api_id",
        "in": "path",
        "required": true,
        "description": "The API's api_id, from the list.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]+$"
        }
      },
      "EndpointId": {
        "name": "endpoint_id",
        "in": "path",
        "required": true,
        "description": "The endpoint's endpoint_id, from the API.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]+$"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Required. A key you generate and save before you send. Reuse it only to retry the same request, and read the result with the same key. 1-200 characters: letters, numbers, `.`, `_`, `:`, `-`.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9._:-]+$"
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Page size.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        }
      },
      "Offset": {
        "name": "offset",
        "in": "query",
        "required": false,
        "description": "Where the page starts. Offset paging reflects current content and is not a snapshot across requests.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        }
      },
      "Query": {
        "name": "q",
        "in": "query",
        "required": false,
        "description": "Searches the published inventory before paging.",
        "schema": {
          "type": "string",
          "maxLength": 200
        }
      },
      "Category": {
        "name": "category",
        "in": "query",
        "required": false,
        "description": "Only APIs in this category.",
        "schema": {
          "type": "string",
          "enum": [
            "commerce",
            "real_estate",
            "jobs",
            "businesses_places",
            "news_content",
            "social_communities",
            "travel",
            "public_data",
            "web_search",
            "uncategorized"
          ]
        }
      },
      "ContractVersion": {
        "name": "version",
        "in": "query",
        "required": false,
        "description": "Read the contract of this major (an integer of at least 1) instead of the latest. A major that never existed answers 404 `catalog_version_not_found` with the majors that do; a value that is not a whole number of at least 1 answers 422 `catalog_version_invalid`. A listing that has no versions ignores it.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "Sort": {
        "name": "sort",
        "in": "query",
        "required": false,
        "description": "Order of the list: most recently updated first, or by name.",
        "schema": {
          "type": "string",
          "enum": [
            "updated",
            "name"
          ]
        }
      }
    },
    "headers": {
      "Deprecation": {
        "description": "Present when the major you pinned is deprecated, or was sunset and the call was rerouted. `@` and the Unix epoch seconds (UTC) at which the major was deprecated (RFC 9745), for example `@1767225600`.",
        "schema": {
          "type": "string",
          "pattern": "^@[0-9]+$"
        }
      },
      "Sunset": {
        "description": "When the major stops answering, as an HTTP date, for example `Sun, 17 Jan 2027 00:00:00 GMT`. Left out when the major has no sunset date.",
        "schema": {
          "type": "string"
        }
      },
      "Link": {
        "description": "The listing's changelog: `<https://cleanedweb.com/catalog/API_ID#changelog>; rel=\"deprecation\"`.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "No credential, or not signed in.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Every error carries `detail`. A failed run's detail names the run.",
        "properties": {
          "detail": {
            "$ref": "#/components/schemas/ErrorDetail"
          }
        },
        "required": [
          "detail"
        ]
      },
      "ErrorDetail": {
        "description": "Text, or an object with a `code` and `message`.",
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "For example invalid_catalog_query, insufficient_units, usage_budget_exceeded, delivery_identity_conflict, run_option_invalid, catalog_version_not_found, catalog_version_invalid."
              },
              "message": {
                "type": "string"
              },
              "run_id": {
                "type": "string",
                "description": "The failed run, when the error is a failed run's."
              },
              "error_code": {
                "type": "string",
                "enum": [
                  "run_failed",
                  "failed_run_replayed"
                ],
                "description": "Marks a failed run. `failed_run_replayed` answers a replay of the same key."
              },
              "replayed": {
                "type": "boolean",
                "description": "Whether this answer replays the key."
              },
              "required": {
                "description": "Units the run needs, on insufficient_units."
              },
              "available": {
                "description": "On insufficient_units, the units the balance has. On catalog_version_not_found, the majors that answer, oldest first, as a list of integers."
              }
            }
          }
        ]
      },
      "CatalogSite": {
        "type": "object",
        "description": "The website the API reads.",
        "properties": {
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "icon_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "domain"
        ]
      },
      "CatalogEndpointSummary": {
        "type": "object",
        "properties": {
          "endpoint_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "`available` when you can run it."
          },
          "acquisition": {
            "type": "string"
          },
          "active_version": {
            "type": "string",
            "description": "The 64-character version a run uses. Only on a single API's answer."
          }
        },
        "required": [
          "endpoint_id",
          "name",
          "status"
        ]
      },
      "CatalogReliability": {
        "type": "object",
        "description": "Run outcome counts for the last window_days days.",
        "properties": {
          "window_days": {
            "type": "integer"
          },
          "runs": {
            "type": "integer"
          },
          "succeeded": {
            "type": "integer"
          },
          "last_run_at": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "CatalogApi": {
        "type": "object",
        "properties": {
          "api_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "short_description": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "commerce",
              "real_estate",
              "jobs",
              "businesses_places",
              "news_content",
              "social_communities",
              "travel",
              "public_data",
              "web_search",
              "uncategorized"
            ]
          },
          "record_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Empty means the coverage is unspecified, not worldwide."
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Empty means the coverage is unspecified."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Read these before you rely on an API for a whole site."
          },
          "site": {
            "$ref": "#/components/schemas/CatalogSite"
          },
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogEndpointSummary"
            }
          },
          "updated_at": {
            "type": "number",
            "description": "Unix epoch seconds (UTC)."
          },
          "health": {
            "type": "string",
            "description": "`unknown` until a health contract reports evidence."
          },
          "last_verified_at": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unix epoch seconds (UTC), or null."
          },
          "reliability": {
            "$ref": "#/components/schemas/CatalogReliability"
          }
        },
        "required": [
          "api_id",
          "name",
          "short_description",
          "category",
          "site",
          "endpoints"
        ]
      },
      "CatalogApiList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogApi"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "Contract": {
        "type": "object",
        "description": "The contract of one endpoint, generated from the saved definition that runs.",
        "properties": {
          "endpoint_id": {
            "type": "string"
          },
          "definition_version": {
            "type": "string",
            "description": "The immutable 64-character version a run of the contract's version uses. You select a major with `version`, not this."
          },
          "updated_at": {
            "type": "number",
            "description": "Unix epoch seconds (UTC)."
          },
          "method": {
            "type": "string",
            "enum": [
              "POST"
            ]
          },
          "path": {
            "type": "string",
            "description": "The run request. Send it to the API origin plus this path."
          },
          "operation_type": {
            "type": "string"
          },
          "acquisition": {
            "type": "string"
          },
          "input_schema": {
            "type": "object",
            "description": "JSON Schema for `input`. Its `required` array lists the inputs you must send.",
            "additionalProperties": true
          },
          "output_schema": {
            "type": "object",
            "description": "JSON Schema for each record.",
            "additionalProperties": true
          },
          "parameters": {
            "type": "array",
            "description": "The same inputs as a list with location, required, type, default, enum and a description.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "examples": {
            "type": "array",
            "description": "Saved samples. They are not a live run.",
            "items": {
              "$ref": "#/components/schemas/SavedExample"
            }
          },
          "authentication": {
            "type": "string",
            "description": "The credential the run needs."
          },
          "limits": {
            "description": "Build-time metadata. It is not the bounds of a run."
          },
          "pagination": {
            "description": "Build-time metadata. Can be null."
          },
          "billing": {
            "description": "Can be null. Billing for a run follows Units and failure behavior."
          },
          "api_origin": {
            "type": "string",
            "description": "The origin to send runs to: https://api.cleanedweb.com. The console's contract names it; when it is absent, use https://api.cleanedweb.com."
          },
          "version": {
            "type": "string",
            "description": "The version of this contract: the major and its newest minor, for example `2.3`. Only on a listing that has versions. Pin a major with \"version\": N in the run body (an integer). Leave it out and the call runs on the latest major. A sunset major runs on the latest major and the response says rerouted. An unknown major answers 404 catalog_version_not_found and lists the available majors."
          },
          "versions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VersionRow"
            },
            "description": "Each major that may have been pinned, its newest minor, its status and its sunset date."
          },
          "changelog": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChangelogEntry"
            },
            "description": "Changes by version, newest first, with major entries marked."
          },
          "version_requested": {
            "type": "integer",
            "description": "The major you asked for with `?version=`. Only when it was sunset and the contract shown is the latest major's."
          },
          "rerouted": {
            "type": "string",
            "enum": [
              "sunset"
            ],
            "description": "Only when `?version=` named a sunset major and the contract shown is the latest major's."
          }
        },
        "required": [
          "endpoint_id",
          "definition_version",
          "method",
          "path",
          "input_schema",
          "output_schema"
        ]
      },
      "VersionRow": {
        "type": "object",
        "description": "One major of the listing.",
        "properties": {
          "major": {
            "type": "integer",
            "minimum": 1,
            "description": "The number you send as `version`."
          },
          "latest_minor": {
            "type": "string",
            "description": "The newest minor, for example `2.3`. It is what a call pinned to this major runs."
          },
          "status": {
            "type": "string",
            "enum": [
              "current",
              "deprecated",
              "sunset"
            ],
            "description": "A deprecated major keeps answering until its sunset date; a call pinned to a sunset major runs on the latest major."
          },
          "sunset_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the major stops answering, as ISO 8601 UTC. Null when it has no sunset date."
          }
        },
        "required": [
          "major",
          "status"
        ]
      },
      "ChangelogEntry": {
        "type": "object",
        "description": "One released version.",
        "properties": {
          "version": {
            "type": "string",
            "description": "For example `2.3`."
          },
          "date": {
            "type": "string",
            "description": "When it was released."
          },
          "kind": {
            "type": "string",
            "description": "`major` for a new major; otherwise a minor."
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "What changed, each with a code and a summary."
          }
        },
        "additionalProperties": true
      },
      "SavedExample": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "examples": [
              "saved_validation_records"
            ]
          },
          "definition_version": {
            "type": "string"
          },
          "saved_at": {
            "type": "number",
            "description": "When the sample was saved, as Unix epoch seconds (UTC)."
          },
          "request": {
            "type": "object",
            "properties": {
              "input": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "live_verified": {
            "type": "boolean"
          }
        }
      },
      "RunRequest": {
        "type": "object",
        "description": "Only the fields listed here are accepted; any other field is rejected.",
        "properties": {
          "input": {
            "type": "object",
            "description": "The inputs from the contract. Unknown fields are rejected.",
            "additionalProperties": true
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "description": "The major to run. Pin a major with \"version\": N in the run body (an integer). Leave it out and the call runs on the latest major. A sunset major runs on the latest major and the response says rerouted. An unknown major answers 404 catalog_version_not_found and lists the available majors. A value that is not a whole number of at least 1 answers 422 catalog_version_invalid and nothing runs."
          },
          "max_items": {
            "type": "integer",
            "minimum": 1,
            "description": "Stop after this many de-duplicated records."
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "default": 10800,
            "description": "The run's own time budget, counted from when it starts running."
          },
          "wait_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 90,
            "description": "How long this request waits for the run to end before answering 202. It does not change the run."
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "uniqueItems": true,
            "description": "Return only these published output fields; required and identity fields are always kept."
          },
          "nulls": {
            "type": "boolean",
            "default": false,
            "description": "Send every published field, with absent values as null."
          }
        }
      },
      "RunProgress": {
        "type": "object",
        "properties": {
          "pages": {
            "type": "integer"
          },
          "items": {
            "type": "integer",
            "description": "Committed records."
          },
          "duplicates": {
            "type": "integer",
            "description": "Repeated records dropped."
          }
        }
      },
      "RunLinks": {
        "type": "object",
        "properties": {
          "self": {
            "type": "string"
          },
          "items": {
            "type": "string"
          },
          "result": {
            "type": "string"
          },
          "abort": {
            "type": "string"
          }
        }
      },
      "Run": {
        "type": "object",
        "description": "The run object.",
        "properties": {
          "run_id": {
            "type": "string",
            "description": "32 lowercase hexadecimal characters."
          },
          "surface": {
            "type": "string"
          },
          "source_id": {
            "type": "string"
          },
          "definition_version": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "finished",
              "failed",
              "aborted"
            ]
          },
          "stop_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "source_exhausted",
              "scope_end",
              "series_unfilled",
              "end_not_confirmed",
              "max_items",
              "timeout",
              "budget_exhausted",
              "aborted",
              "blocked",
              "error",
              null
            ],
            "description": "Why the run ended; null while it runs."
          },
          "created_at": {
            "description": "A timestamp. Null until the run reaches it."
          },
          "started_at": {
            "description": "A timestamp. Null until the run reaches it."
          },
          "finished_at": {
            "description": "A timestamp. Null until the run reaches it."
          },
          "limits": {
            "type": "object",
            "description": "`max_items` and `timeout_seconds` applied to the run.",
            "additionalProperties": true
          },
          "progress": {
            "$ref": "#/components/schemas/RunProgress"
          },
          "units_charged": {
            "type": "number",
            "description": "Units charged so far."
          },
          "abort_requested": {
            "type": "boolean"
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "description": "On failure: code, status, detail and an optional retry_after.",
            "additionalProperties": true
          },
          "poll_after_seconds": {
            "type": "number",
            "description": "Present while the run is queued or running."
          },
          "links": {
            "$ref": "#/components/schemas/RunLinks"
          },
          "version": {
            "type": "string",
            "description": "The version that ran: the major and its newest minor, for example `2.3`."
          },
          "version_requested": {
            "type": "integer",
            "description": "The major you pinned. Only on a call rerouted because that major was sunset."
          },
          "rerouted": {
            "type": "string",
            "enum": [
              "sunset"
            ],
            "description": "Only on a call rerouted to the latest major because the major you pinned was sunset. The latest major's inputs and fields can differ from the ones you pinned."
          }
        },
        "required": [
          "run_id",
          "status"
        ]
      },
      "RunSummary": {
        "type": "object",
        "properties": {
          "source_id": {
            "type": "string"
          },
          "definition_version": {
            "type": "string",
            "description": "Must match the contract's definition_version."
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "bounded",
              "partial"
            ]
          },
          "within_scope_passed": {
            "type": "boolean"
          },
          "catalog_complete": {
            "type": "boolean",
            "description": "A run does not establish full-catalog coverage; the generated contract reports false."
          },
          "records": {
            "type": "integer",
            "description": "Number of records in the run's dataset."
          }
        },
        "additionalProperties": true
      },
      "Delivery": {
        "type": "object",
        "description": "Present for a customer workspace run.",
        "properties": {
          "runId": {
            "type": "string"
          },
          "chargeReceiptId": {
            "type": "string",
            "description": "The same identifier as runId."
          },
          "recordCount": {
            "type": "integer"
          }
        }
      },
      "RunResult": {
        "type": "object",
        "description": "A run that ended. Check summary.status is completed or bounded and summary.within_scope_passed is true before you use the records.",
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "Records conforming to the endpoint's output_schema, de-duplicated within the run."
          },
          "summary": {
            "$ref": "#/components/schemas/RunSummary"
          },
          "metadata": {
            "type": "object",
            "properties": {
              "definition_version": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "artifacts": {
            "description": "Additional execution artifacts."
          },
          "traceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "run": {
            "$ref": "#/components/schemas/Run"
          },
          "delivery": {
            "$ref": "#/components/schemas/Delivery"
          },
          "version": {
            "type": "string",
            "description": "The version that ran: the major and its newest minor, for example `2.3`."
          },
          "version_requested": {
            "type": "integer",
            "description": "The major you pinned. Only on a call rerouted because that major was sunset."
          },
          "rerouted": {
            "type": "string",
            "enum": [
              "sunset"
            ],
            "description": "Only on a call rerouted to the latest major because the major you pinned was sunset. The latest major's inputs and fields can differ from the ones you pinned."
          }
        },
        "required": [
          "records",
          "summary",
          "run"
        ]
      }
    }
  }
}
