{
  "openapi": "3.1.0",
  "info": {
    "title": "inseeq Data API",
    "version": "1.0.0",
    "description": "Read-only HTTP API over one organization's published data tables. The key decides the organization, and no route takes one.\n\nServer-side only: no route sends CORS headers. Keep the key in server-side environment variables.\n\nRules for agents, in order of reading: https://api.inseeq.com/llms.txt. Get a key by asking Claude, with the inseeq connector, to run create_api_key. It answers a one-time link that works for 10 minutes.\n\nUnknown paths answer the 404 `not_found` envelope with or without a key. A wrong method on a known path answers 405 `method_not_allowed` with no key needed."
  },
  "externalDocs": {
    "description": "Rules, error table and guides",
    "url": "https://api.inseeq.com/llms.txt"
  },
  "servers": [
    {
      "url": "https://api.inseeq.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Tables"
    },
    {
      "name": "Query"
    },
    {
      "name": "Metrics"
    },
    {
      "name": "Status"
    },
    {
      "name": "Events"
    },
    {
      "name": "Webhooks"
    }
  ],
  "paths": {
    "/v1/tables": {
      "get": {
        "operationId": "listTables",
        "tags": [
          "Tables"
        ],
        "summary": "List the published tables",
        "description": "Call this first. Sorted by name. Names differ per organization.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Tables per page."
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`next_after` from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "One page of tables.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "tables",
                    "next_after"
                  ],
                  "properties": {
                    "tables": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TableSummary"
                      }
                    },
                    "next_after": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/bad_parameter"
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          },
          "503": {
            "$ref": "#/components/responses/warehouse_unavailable"
          }
        }
      }
    },
    "/v1/tables/{name}": {
      "get": {
        "operationId": "getTable",
        "tags": [
          "Tables"
        ],
        "summary": "Read a table's docs",
        "description": "Read this before querying a table. `description` here is the full text with caveats. The listing holds one sentence.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A name from GET /v1/tables."
          }
        ],
        "responses": {
          "200": {
            "description": "The table.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Table"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "404": {
            "$ref": "#/components/responses/not_found"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          },
          "503": {
            "$ref": "#/components/responses/warehouse_unavailable"
          }
        }
      }
    },
    "/v1/query": {
      "post": {
        "operationId": "runQuery",
        "tags": [
          "Query"
        ],
        "summary": "Run one SELECT",
        "description": "BigQuery GoogleSQL. One SELECT, which may start with WITH. Name tables with no dataset or project. A query may scan 5 GiB and run for 30 seconds. An identical query at the same `data_version` answers from the cache at no cost, unless its result needed a second page or was over 1 MiB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The first page. With `format` csv: RFC 4180 text with a header row, the fields in `X-` headers, and a `'` before a STRING value a spreadsheet would run as a formula.",
            "headers": {
              "X-Row-Count": {
                "schema": {
                  "type": "integer"
                },
                "description": "Rows on this page."
              },
              "X-Total-Rows": {
                "schema": {
                  "type": "integer"
                },
                "description": "Rows in the whole result."
              },
              "X-Next-Cursor": {
                "schema": {
                  "type": "string"
                },
                "description": "The cursor for the next page. Absent on the last page."
              },
              "X-Data-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "The data this page was read from. Absent when not recorded."
              },
              "X-Refreshed-At": {
                "schema": {
                  "type": "string",
                  "format": "date-time"
                },
                "description": "When that data was refreshed. Absent when not recorded."
              },
              "X-Cached": {
                "schema": {
                  "type": "boolean"
                },
                "description": "Answered from the cache."
              },
              "X-Bytes-Processed": {
                "schema": {
                  "type": "integer"
                },
                "description": "Bytes scanned."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryPage"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/bad_request.bad_parameter.not_select.refused_function.use_metadata_tools.bigquery_error"
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "404": {
            "$ref": "#/components/responses/table_not_published"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "413": {
            "$ref": "#/components/responses/over_bytes_cap.row_too_large"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited.busy.over_daily_budget"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          },
          "503": {
            "$ref": "#/components/responses/warehouse_unavailable"
          },
          "504": {
            "$ref": "#/components/responses/timeout"
          }
        }
      }
    },
    "/v1/query/results": {
      "get": {
        "operationId": "readQueryPage",
        "tags": [
          "Query"
        ],
        "summary": "Read the next page of a query",
        "description": "Every page of a query is one snapshot, even across a refresh, and keeps the first call's `max_rows`. Later pages spend no budget. On `cursor_expired`, run the query again.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`next_cursor` from the previous page, URL-encoded. A tampered cursor or one from another organization answers 400 `bad_parameter`."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            },
            "description": "The cursor does not carry the format: name it on every page."
          }
        ],
        "responses": {
          "200": {
            "description": "The next page. `cached` is false and `bytes_processed` is 0. With `format` csv: RFC 4180 text with a header row, the fields in `X-` headers, and a `'` before a STRING value a spreadsheet would run as a formula.",
            "headers": {
              "X-Row-Count": {
                "schema": {
                  "type": "integer"
                },
                "description": "Rows on this page."
              },
              "X-Total-Rows": {
                "schema": {
                  "type": "integer"
                },
                "description": "Rows in the whole result."
              },
              "X-Next-Cursor": {
                "schema": {
                  "type": "string"
                },
                "description": "The cursor for the next page. Absent on the last page."
              },
              "X-Data-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "The data this page was read from. Absent when not recorded."
              },
              "X-Refreshed-At": {
                "schema": {
                  "type": "string",
                  "format": "date-time"
                },
                "description": "When that data was refreshed. Absent when not recorded."
              },
              "X-Cached": {
                "schema": {
                  "type": "boolean"
                },
                "description": "Answered from the cache."
              },
              "X-Bytes-Processed": {
                "schema": {
                  "type": "integer"
                },
                "description": "Bytes scanned."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryPage"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/bad_parameter.bigquery_error"
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "410": {
            "$ref": "#/components/responses/cursor_expired"
          },
          "413": {
            "$ref": "#/components/responses/row_too_large"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited.busy"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          },
          "503": {
            "$ref": "#/components/responses/warehouse_unavailable"
          },
          "504": {
            "$ref": "#/components/responses/timeout"
          }
        }
      }
    },
    "/v1/metrics": {
      "get": {
        "operationId": "listMetrics",
        "tags": [
          "Metrics"
        ],
        "summary": "List the metrics",
        "description": "The organization's metrics: definitions people saved in chat so one question gives one number every time. Newest change first. Run one with GET /v1/metrics/{name}.",
        "responses": {
          "200": {
            "description": "Every metric.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "metrics"
                  ],
                  "properties": {
                    "metrics": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MetricSummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      }
    },
    "/v1/metrics/{name}": {
      "get": {
        "operationId": "runMetric",
        "tags": [
          "Metrics"
        ],
        "summary": "Run a metric",
        "description": "Runs the metric on current data, for a window, by period and by its breakdowns, and pages as POST /v1/query does. Any query parameter not listed here filters on the breakdown of that name, such as `?channel=linkedin`; `from`, `to`, `period`, `by`, `format`, `max_rows` and `cursor` are never filters. A metric of kind `fixed` takes only `from` and `to`.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A name from GET /v1/metrics."
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day, included. Send with `to`. Without both: last month."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day, included. Send with `from`."
          },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month",
                "total"
              ],
              "default": "total"
            },
            "description": "week runs Monday to Sunday. Each row then has `period`, its first day, and `partial`."
          },
          {
            "name": "by",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Up to 3 breakdown names, comma separated, from `breakdowns` on GET /v1/metrics."
          },
          {
            "name": "max_rows",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000,
              "default": 1000
            },
            "description": "Rows per page. A page also stops at 1 MiB."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`next_cursor` from the previous page, URL-encoded. It carries the window and breakdowns, so the other parameters are ignored. A cursor for another metric answers 400 `bad_parameter`."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ]
            },
            "description": "csv answers text/csv. Without it, an `Accept: text/csv` header does the same. Name it on every page."
          }
        ],
        "responses": {
          "200": {
            "description": "One page. As CSV: RFC 4180 text of the rows with a header row, the page fields in `X-` headers, and a `'` before a STRING value a spreadsheet would run as a formula. The definition, window and caveats are in the JSON only.",
            "headers": {
              "X-Row-Count": {
                "schema": {
                  "type": "integer"
                },
                "description": "Rows on this page."
              },
              "X-Total-Rows": {
                "schema": {
                  "type": "integer"
                },
                "description": "Rows in the whole result."
              },
              "X-Next-Cursor": {
                "schema": {
                  "type": "string"
                },
                "description": "The cursor for the next page. Absent on the last page."
              },
              "X-Data-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "The data this page was read from. Absent when not recorded."
              },
              "X-Refreshed-At": {
                "schema": {
                  "type": "string",
                  "format": "date-time"
                },
                "description": "When that data was refreshed. Absent when not recorded."
              },
              "X-Cached": {
                "schema": {
                  "type": "boolean"
                },
                "description": "Answered from the cache."
              },
              "X-Bytes-Processed": {
                "schema": {
                  "type": "integer"
                },
                "description": "Bytes scanned."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetricPage"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/bad_parameter.bigquery_error"
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "404": {
            "$ref": "#/components/responses/not_found.table_not_published"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "410": {
            "$ref": "#/components/responses/cursor_expired"
          },
          "413": {
            "$ref": "#/components/responses/over_bytes_cap.row_too_large"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited.busy.over_daily_budget"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          },
          "503": {
            "$ref": "#/components/responses/warehouse_unavailable"
          },
          "504": {
            "$ref": "#/components/responses/timeout"
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "operationId": "getStatus",
        "tags": [
          "Status"
        ],
        "summary": "How fresh the data is",
        "responses": {
          "200": {
            "description": "The current state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          },
          "503": {
            "$ref": "#/components/responses/warehouse_unavailable"
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "operationId": "listEvents",
        "tags": [
          "Events"
        ],
        "summary": "Read events, oldest first",
        "description": "Events are kept 30 days. `webhook.test` is never listed. To poll: save the id of the last event you handled, not `next_after`, which is null on the last page.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "An event id. Answers events after it. An id older than 30 days answers 404 `not_found`: restart with no `after`, and drop ids you have handled."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Events per page."
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "data.refreshed",
                "tables.changed",
                "data.refresh_failed"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of events.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "events",
                    "next_after"
                  ],
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    },
                    "next_after": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The last id on this page when more follow, else null."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/bad_parameter"
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "404": {
            "$ref": "#/components/responses/not_found"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks, oldest first",
        "responses": {
          "200": {
            "description": "Every webhook, disabled ones included.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhooks"
                  ],
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Register a webhook",
        "description": "The URL must be https on port 443 at a public address, and must resolve now. An organization holds 5 webhooks, disabled ones included. A webhook gets only events after it is registered.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registered. `secret` appears here and never again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/bad_request.bad_parameter.bad_webhook_url"
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing.webhook_limit"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "operationId": "getWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Read one webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "404": {
            "$ref": "#/components/responses/not_found"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "description": "There is no route to turn a disabled webhook back on. Delete it and register again, which gives a new id and secret.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted. No body."
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "404": {
            "$ref": "#/components/responses/not_found"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a signed webhook.test now",
        "description": "Sends in the request. Answers 200 even when the send failed, so read `delivered`. Works on a disabled webhook, moves no counter, and a 410 from the receiver disables nothing.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The send was tried.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "delivered",
                    "status"
                  ],
                  "properties": {
                    "delivered": {
                      "type": "boolean",
                      "description": "True only for a 2xx."
                    },
                    "status": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "The receiver's HTTP status. Null when it never answered."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/invalid_key.wrong_key_type"
          },
          "403": {
            "$ref": "#/components/responses/not_enabled"
          },
          "404": {
            "$ref": "#/components/responses/not_found"
          },
          "405": {
            "$ref": "#/components/responses/method_not_allowed"
          },
          "409": {
            "$ref": "#/components/responses/importing"
          },
          "429": {
            "$ref": "#/components/responses/rate_limited"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      }
    }
  },
  "webhooks": {
    "event": {
      "post": {
        "operationId": "receiveEvent",
        "summary": "What your receiver gets",
        "description": "A POST to your URL. Check the signature on the raw body. Answer 2xx within 15 seconds, and 2xx to a type you do not know. Redirects are not followed and count as failures.\n\nUp to 8 attempts, waiting 1 minute, 5 minutes, 30 minutes, 2 hours, 8 hours, 24 hours and 24 hours between them, give or take 10%. That is 58 hours 36 minutes in all. Keep handled webhook-id values for 4 days.\n\nAfter the last failure the webhook turns off with `disabled_reason` `attempts_exhausted`. A 410 turns it off at once with `receiver_gone`. There is no re-enable route: delete it and register again.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The event id, the same on every retry. Use it to drop repeats."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unix seconds of this attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,` and a base64 HMAC-SHA256 of `<id>.<timestamp>.<raw body>`, keyed by the base64-decoded text after `whsec_`."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "$ref": "#/components/schemas/WebhookTestEvent"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else is a failed attempt."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "inseeq_dk_ plus 64 hex characters",
        "description": "An API key. MCP keys and login tokens answer `wrong_key_type`."
      }
    },
    "responses": {
      "bad_parameter": {
        "description": "`bad_parameter`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "bad_parameter"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "invalid_key.wrong_key_type": {
        "description": "`invalid_key`, `wrong_key_type`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_key",
                            "wrong_key_type"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "not_enabled": {
        "description": "`not_enabled`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_enabled"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "method_not_allowed": {
        "description": "`method_not_allowed`. See ErrorCode.",
        "headers": {
          "Allow": {
            "$ref": "#/components/headers/Allow"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "method_not_allowed"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "importing": {
        "description": "`importing`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "importing"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "rate_limited": {
        "description": "`rate_limited`. See ErrorCode.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "internal_error": {
        "description": "`internal_error`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "warehouse_unavailable": {
        "description": "`warehouse_unavailable`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "warehouse_unavailable"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "not_found": {
        "description": "`not_found`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "bad_request.bad_parameter.not_select.refused_function.use_metadata_tools.bigquery_error": {
        "description": "`bad_request`, `bad_parameter`, `not_select`, `refused_function`, `use_metadata_tools`, `bigquery_error`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "bad_request",
                            "bad_parameter",
                            "not_select",
                            "refused_function",
                            "use_metadata_tools",
                            "bigquery_error"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "table_not_published": {
        "description": "`table_not_published`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "table_not_published"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "over_bytes_cap.row_too_large": {
        "description": "`over_bytes_cap`, `row_too_large`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "over_bytes_cap",
                            "row_too_large"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "rate_limited.busy.over_daily_budget": {
        "description": "`rate_limited`, `busy`, `over_daily_budget`. See ErrorCode.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited",
                            "busy",
                            "over_daily_budget"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "timeout": {
        "description": "`timeout`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "timeout"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "bad_parameter.bigquery_error": {
        "description": "`bad_parameter`, `bigquery_error`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "bad_parameter",
                            "bigquery_error"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "cursor_expired": {
        "description": "`cursor_expired`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "cursor_expired"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "row_too_large": {
        "description": "`row_too_large`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "row_too_large"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "rate_limited.busy": {
        "description": "`rate_limited`, `busy`. See ErrorCode.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited",
                            "busy"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "not_found.table_not_published": {
        "description": "`not_found`, `table_not_published`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found",
                            "table_not_published"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "bad_request.bad_parameter.bad_webhook_url": {
        "description": "`bad_request`, `bad_parameter`, `bad_webhook_url`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "bad_request",
                            "bad_parameter",
                            "bad_webhook_url"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "importing.webhook_limit": {
        "description": "`importing`, `webhook_limit`. See ErrorCode.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "importing",
                            "webhook_limit"
                          ]
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      }
    },
    "headers": {
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      },
      "Allow": {
        "description": "The methods this path takes.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "ErrorCode": {
        "type": "string",
        "enum": [
          "bad_request",
          "bad_parameter",
          "not_select",
          "refused_function",
          "use_metadata_tools",
          "bad_webhook_url",
          "invalid_key",
          "wrong_key_type",
          "not_enabled",
          "not_found",
          "method_not_allowed",
          "table_not_published",
          "importing",
          "webhook_limit",
          "cursor_expired",
          "over_bytes_cap",
          "row_too_large",
          "rate_limited",
          "busy",
          "over_daily_budget",
          "internal_error",
          "bigquery_error",
          "warehouse_unavailable",
          "timeout"
        ],
        "description": "- `bad_request` (400): The body is malformed, or a required field is missing or the wrong type.\n- `bad_parameter` (400): A value is out of range, a param is not valid, or a cursor is not valid.\n- `not_select` (400): The SQL is not one SELECT: DML, DDL, a script or several statements.\n- `refused_function` (400): The SQL calls something not allowed: session_user(), system variables, external queries, ML or AI functions.\n- `use_metadata_tools` (400): The SQL reads INFORMATION_SCHEMA or __TABLES__. Use GET /v1/tables and GET /v1/tables/{name}.\n- `bad_webhook_url` (400): The URL is not https on port 443 at a public address, carries a user name or password, is over 2,048 characters, or does not resolve. The message says which.\n- `invalid_key` (401): The key is missing, unknown or revoked.\n- `wrong_key_type` (401): This is an inseeq MCP key or a login token, not an API key.\n- `not_enabled` (403): The Data API is not enabled for this organization.\n- `not_found` (404): Unknown path, table, webhook or event.\n- `method_not_allowed` (405): This path does not take this method. The Allow header lists what it takes. No key is needed to get this answer.\n- `table_not_published` (404): The SQL reads a table that is not on GET /v1/tables, or names a dataset. Fail visibly. See /docs/changes.md.\n- `importing` (409): The organization's data is not ready yet. Try again later.\n- `webhook_limit` (409): The organization already has 5 webhooks. Disabled ones count. Delete one first.\n- `cursor_expired` (410): The results behind this cursor are gone. Run the query again.\n- `over_bytes_cap` (413): The query would scan over 5 GiB. Narrow the date range or the columns.\n- `row_too_large` (413): One row is over 1 MiB, so the page cannot advance. Select fewer columns.\n- `rate_limited` (429): Over 10 calls a second for this key, past a burst of 100. Wait for Retry-After.\n- `busy` (429): Too many queries are running, or BigQuery had a short fault. Wait for Retry-After, then retry. Stop after a few tries.\n- `over_daily_budget` (429): The daily query budget is spent. The error carries resets_at, and Retry-After counts down to it. Cached answers still work.\n- `internal_error` (500): Our own read failed. Retry a few times, then show the error.\n- `bigquery_error` (400): BigQuery refused the query. The message says why. Fix the SQL. Do not retry.\n- `warehouse_unavailable` (503): The data store could not be reached. Retry a few times, then show the error.\n- `timeout` (504): The query ran over 30 seconds and was cancelled. Narrow it."
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "docs_url"
            ],
            "properties": {
              "code": {
                "$ref": "#/components/schemas/ErrorCode"
              },
              "message": {
                "type": "string"
              },
              "docs_url": {
                "type": "string",
                "format": "uri"
              },
              "resets_at": {
                "type": "string",
                "format": "date-time",
                "description": "On `over_daily_budget` only: when the budget resets."
              }
            }
          }
        }
      },
      "TableSummary": {
        "type": "object",
        "required": [
          "name",
          "type",
          "description",
          "grain",
          "date_column",
          "date_from",
          "date_to",
          "row_count",
          "last_updated"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "table",
              "view"
            ]
          },
          "row_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "last_updated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "date_column": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null on a table with no date column."
          },
          "date_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "date_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "One sentence."
          },
          "grain": {
            "type": [
              "string",
              "null"
            ],
            "description": "What one row is."
          }
        }
      },
      "Table": {
        "type": "object",
        "required": [
          "name",
          "type",
          "description",
          "row_count",
          "last_updated",
          "date_column",
          "date_from",
          "date_to",
          "primary_key",
          "pii",
          "columns"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "table",
              "view"
            ]
          },
          "row_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "last_updated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "date_column": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null on a table with no date column."
          },
          "date_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "date_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The full text, with caveats."
          },
          "primary_key": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "The columns that make one row unique. Null when not stated."
          },
          "pii": {
            "type": "boolean",
            "description": "The table holds personal data."
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "type",
                "description",
                "unit",
                "additive",
                "pii"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "currency_major, cents, micros, count, ratio or share. Convert cents and micros before showing money."
                },
                "additive": {
                  "type": [
                    "boolean",
                    "null"
                  ],
                  "description": "false: never sum this column across rows or days. Null when not stated."
                },
                "pii": {
                  "type": "boolean",
                  "description": "This column is personal data. Keep it out of alerts and logs."
                }
              }
            }
          }
        }
      },
      "QueryRequest": {
        "type": "object",
        "required": [
          "sql"
        ],
        "properties": {
          "sql": {
            "type": "string",
            "description": "One SELECT."
          },
          "params": {
            "type": "array",
            "description": "Named parameters, `@name` in the SQL. Pass user input here, never in the SQL text.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "type",
                "value"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$",
                  "description": "Unique, ignoring case."
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "STRING",
                    "INT64",
                    "FLOAT64",
                    "BOOL",
                    "DATE",
                    "TIMESTAMP"
                  ]
                },
                "value": {
                  "type": "string",
                  "description": "Always a string. BOOL is `true` or `false`, lowercase. DATE and TIMESTAMP are ISO 8601. A TIMESTAMP with no zone is UTC."
                }
              }
            }
          },
          "max_rows": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5000,
            "default": 1000,
            "description": "Rows per page. A page also stops at 1 MiB."
          },
          "format": {
            "type": "string",
            "enum": [
              "json",
              "csv"
            ],
            "default": "json",
            "description": "csv answers text/csv with the page fields in X- headers. Errors stay JSON."
          }
        }
      },
      "QueryPage": {
        "type": "object",
        "required": [
          "columns",
          "rows",
          "row_count",
          "total_rows",
          "next_cursor",
          "data_version",
          "refreshed_at",
          "cached",
          "bytes_processed"
        ],
        "properties": {
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "type"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "description": "`INTEGER`, `FLOAT`, `BOOLEAN`, `STRING`, `NUMERIC`, `BIGNUMERIC`, `DATE`, `DATETIME`, `TIME`, `TIMESTAMP`, `BYTES`, `RECORD` and others. These are not the names `params` takes."
                }
              }
            }
          },
          "rows": {
            "type": "array",
            "description": "One object per row, keyed by column name. INT64 and FLOAT64 are JSON numbers. A non-finite float is the string `nan`, `inf` or `-inf`. NUMERIC, dates and timestamps are strings. BYTES are hex. Cast IDs over 2^53 to STRING in the SQL.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "row_count": {
            "type": "integer",
            "description": "Rows on this page. Can be below max_rows: a page also stops at 1 MiB."
          },
          "total_rows": {
            "type": "integer",
            "description": "Rows in the whole result."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass to GET /v1/query/results. Null on the last page. About 570 characters, so URL-encode it. Never store one: over 12 hours old it can expire."
          },
          "data_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "The data this answer was read from. Pages of one query all report the first page's value. Null until the organization's first check, and then nothing is cached."
          },
          "refreshed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the build behind `data_version` finished. Not the time of this call."
          },
          "cached": {
            "type": "boolean",
            "description": "True when answered from the API cache, with no scan and no budget spent. Always false on GET /v1/query/results."
          },
          "bytes_processed": {
            "type": "integer",
            "description": "Bytes scanned. 0 on a cached answer and on later pages. Can be 0 with `cached: false` when BigQuery's own cache served the job."
          }
        }
      },
      "MetricSummary": {
        "type": "object",
        "required": [
          "name",
          "title",
          "definition",
          "kind",
          "breakdowns",
          "set_by",
          "set_at"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Lower-case letters, digits and underscores."
          },
          "title": {
            "type": "string"
          },
          "definition": {
            "type": "string",
            "description": "What counts, in one or two plain sentences."
          },
          "kind": {
            "type": "string",
            "enum": [
              "rows",
              "fixed"
            ],
            "description": "`fixed`: one number per window, with no period or breakdowns."
          },
          "breakdowns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "label"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              }
            }
          },
          "set_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who saved the definition. `inseeq` when inseeq staff did."
          },
          "set_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the definition was last set."
          }
        }
      },
      "MetricPage": {
        "type": "object",
        "required": [
          "name",
          "title",
          "definition",
          "window",
          "set_by",
          "set_at",
          "caveats",
          "columns",
          "rows",
          "row_count",
          "total_rows",
          "next_cursor",
          "data_version",
          "refreshed_at",
          "cached",
          "bytes_processed"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Lower-case letters, digits and underscores."
          },
          "title": {
            "type": "string"
          },
          "definition": {
            "type": "string",
            "description": "What counts, in one or two plain sentences."
          },
          "window": {
            "type": "object",
            "required": [
              "from",
              "to",
              "period",
              "partial"
            ],
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "period": {
                "type": "string",
                "enum": [
                  "day",
                  "week",
                  "month",
                  "total"
                ]
              },
              "partial": {
                "type": "boolean",
                "description": "True when the window has not ended yet."
              }
            }
          },
          "set_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who saved the definition. `inseeq` when inseeq staff did."
          },
          "set_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the definition was last set."
          },
          "caveats": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Short lines to read before using the number."
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "type"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "description": "`INTEGER`, `FLOAT`, `BOOLEAN`, `STRING`, `NUMERIC`, `BIGNUMERIC`, `DATE`, `DATETIME`, `TIME`, `TIMESTAMP`, `BYTES`, `RECORD` and others. These are not the names `params` takes."
                }
              }
            }
          },
          "rows": {
            "type": "array",
            "description": "One object per row: `period` (the first day of the bucket, when `period` is not total), each breakdown asked for, and `value`. With a period, `partial` is true for a bucket not over yet or not fully inside the window.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "row_count": {
            "type": "integer",
            "description": "Rows on this page. Can be below max_rows: a page also stops at 1 MiB."
          },
          "total_rows": {
            "type": "integer",
            "description": "Rows in the whole result."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` to this path. Null on the last page. Never store one: over 12 hours old it can expire."
          },
          "data_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "The data this answer was read from. Pages of one query all report the first page's value. Null until the organization's first check, and then nothing is cached."
          },
          "refreshed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the build behind `data_version` finished. Not the time of this call."
          },
          "cached": {
            "type": "boolean",
            "description": "True when answered from the API cache, with no scan and no budget spent. Always false on GET /v1/query/results."
          },
          "bytes_processed": {
            "type": "integer",
            "description": "Bytes scanned. 0 on a cached answer and on later pages. Can be 0 with `cached: false` when BigQuery's own cache served the job."
          }
        }
      },
      "Status": {
        "type": "object",
        "required": [
          "refreshed_at",
          "build_mode",
          "stale_sources",
          "data_version",
          "last_failure",
          "sources"
        ],
        "properties": {
          "refreshed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the newest successful build finished."
          },
          "build_mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "daily",
              "weekly",
              "on_demand",
              null
            ]
          },
          "stale_sources": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Source platforms that were behind in this build."
          },
          "data_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Changes when a refresh lands or the published tables change."
          },
          "last_failure": {
            "type": [
              "object",
              "null"
            ],
            "description": "Set when the newest build failed, else null. The last good data stays readable, and some tables may be partly updated.",
            "required": [
              "failed_at"
            ],
            "properties": {
              "failed_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Source"
            }
          }
        }
      },
      "Source": {
        "type": "object",
        "description": "Coverage of one source. Dates are the source's own day.",
        "properties": {
          "platform": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null on a `not_collected` row."
          },
          "evidence_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "coverage_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "`measured`, `partial`, `stale` or `not_collected`. `not_collected` marks evidence the client should have but does not: on those rows only `evidence_type`, `evidence_label` and `coverage_status` are set."
          },
          "data_from_native": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first day with data. Before it the source is missing, not zero."
          },
          "data_through_native": {
            "type": [
              "string",
              "null"
            ],
            "description": "The end of the newest pull's window, on the source's own calendar. Not the newest day with rows, and it can run ahead of today."
          },
          "final_through_native": {
            "type": [
              "string",
              "null"
            ],
            "description": "The last day that is final. Later days may still change. A day that has not ended is never final, even if this says so."
          },
          "provisional_days": {
            "type": [
              "integer",
              "null"
            ]
          },
          "is_stale": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "last_success_at_utc": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_run_status": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Event": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "id",
              "type",
              "timestamp",
              "data"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Also sent as the webhook-id header. The same on every retry."
              },
              "type": {
                "const": "data.refreshed"
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "description": "UTC, to the second, ending in Z."
              },
              "data": {
                "type": "object",
                "required": [
                  "data_version",
                  "refreshed_at",
                  "build_mode",
                  "stale_sources"
                ],
                "properties": {
                  "data_version": {
                    "type": "string"
                  },
                  "refreshed_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "build_mode": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "daily",
                      "weekly",
                      "on_demand",
                      null
                    ]
                  },
                  "stale_sources": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Source platforms that were behind in this build."
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "type",
              "timestamp",
              "data"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Also sent as the webhook-id header. The same on every retry."
              },
              "type": {
                "const": "tables.changed"
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "description": "UTC, to the second, ending in Z."
              },
              "data": {
                "type": "object",
                "required": [
                  "data_version",
                  "added",
                  "removed",
                  "changed"
                ],
                "description": "Table names only, sorted. `changed` means a top-level column name or type moved. The order against `data.refreshed` is not promised.",
                "properties": {
                  "data_version": {
                    "type": "string"
                  },
                  "added": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "removed": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "changed": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "type",
              "timestamp",
              "data"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Also sent as the webhook-id header. The same on every retry."
              },
              "type": {
                "const": "data.refresh_failed"
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "description": "UTC, to the second, ending in Z."
              },
              "data": {
                "type": "object",
                "required": [
                  "data_version",
                  "failed_at",
                  "build_mode",
                  "last_refreshed_at",
                  "stale_sources"
                ],
                "description": "The last good data stays readable, and some tables may be partly updated. Carries no cause, and promises nothing about the next build.",
                "properties": {
                  "data_version": {
                    "type": "string"
                  },
                  "failed_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "build_mode": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "daily",
                      "weekly",
                      "on_demand",
                      null
                    ]
                  },
                  "last_refreshed_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "stale_sources": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Source platforms that were behind in this build."
                  }
                }
              }
            }
          }
        ]
      },
      "WebhookTestEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "timestamp",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Also sent as the webhook-id header. The same on every retry."
          },
          "type": {
            "const": "webhook.test"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "UTC, to the second, ending in Z."
          },
          "data": {
            "type": "object",
            "required": [
              "test"
            ],
            "properties": {
              "test": {
                "const": true
              }
            }
          }
        }
      },
      "WebhookRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "data.refreshed",
                "tables.changed",
                "data.refresh_failed"
              ]
            },
            "description": "Default: all three."
          }
        }
      },
      "WebhookCreated": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "status",
          "secret"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "data.refreshed",
                "tables.changed",
                "data.refresh_failed"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "secret": {
            "type": "string",
            "description": "`whsec_` plus base64. Shown once. If it is lost, delete the webhook and register again."
          }
        }
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "status",
          "disabled_reason",
          "last_delivery_at",
          "last_status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "data.refreshed",
                "tables.changed",
                "data.refresh_failed"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "disabled_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "receiver_gone",
              "attempts_exhausted",
              null
            ],
            "description": "`receiver_gone`: it answered 410. `attempts_exhausted`: all 8 attempts for one event failed."
          },
          "last_delivery_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_status": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Null when the last attempt got no HTTP answer."
          }
        }
      }
    }
  }
}