{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/clay953f/json-schema/clay953f-query-response-schema.json",
  "title": "QueryResponse",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/clay953f-tables-api-openapi.yml#/components/schemas/QueryResponse",
  "additionalProperties": false,
  "properties": {
    "cursor": {
      "type": "string"
    },
    "data": {
      "items": {
        "additionalProperties": {
          "$ref": "#/$defs/CellResult"
        },
        "type": "object"
      },
      "type": "array"
    },
    "fields": {
      "additionalProperties": {
        "$ref": "#/$defs/FieldMeta"
      },
      "type": "object"
    },
    "truncated": {
      "description": "True when more results matched than the limit but no cursor can be issued (grouped, aggregated, or custom-ordered queries do not support cursor pagination). Narrow the query or raise the limit to see the rest.",
      "type": "boolean"
    }
  },
  "required": [
    "data"
  ],
  "type": "object",
  "$defs": {
    "CellEmpty": {
      "additionalProperties": false,
      "properties": {
        "status": {
          "const": "empty",
          "type": "string"
        }
      },
      "required": [
        "status"
      ],
      "type": "object"
    },
    "CellError": {
      "additionalProperties": false,
      "properties": {
        "error": {
          "type": "string"
        },
        "status": {
          "const": "error",
          "type": "string"
        }
      },
      "required": [
        "status"
      ],
      "type": "object"
    },
    "CellPending": {
      "additionalProperties": false,
      "properties": {
        "status": {
          "enum": [
            "running",
            "queued",
            "retry",
            "rate_limited",
            "awaiting_callback"
          ],
          "type": "string"
        }
      },
      "required": [
        "status"
      ],
      "type": "object"
    },
    "CellResult": {
      "oneOf": [
        {
          "$ref": "#/$defs/CellSuccess"
        },
        {
          "$ref": "#/$defs/CellError"
        },
        {
          "$ref": "#/$defs/CellPending"
        },
        {
          "$ref": "#/$defs/CellEmpty"
        }
      ]
    },
    "CellSuccess": {
      "additionalProperties": false,
      "properties": {
        "fields": {
          "anyOf": [
            {
              "additionalProperties": {},
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "is_stale": {
          "const": true,
          "type": "boolean"
        },
        "status": {
          "const": "success",
          "type": "string"
        },
        "value": {}
      },
      "required": [
        "status",
        "fields"
      ],
      "type": "object"
    },
    "FieldMeta": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "type"
      ],
      "type": "object"
    }
  }
}