{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/typesearch-ai/json-schema/typesearch-ai-chart-request-schema.json",
  "title": "ChartRequest",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/typesearch-ai-api-v1-openapi.json#/components/schemas/ChartRequest",
  "type": "object",
  "properties": {
    "query": {
      "description": "What you want to see, in plain words: «blue dollar this week», «Milei vs Bullrich coverage», «prices in my catalog».",
      "type": "string",
      "minLength": 2,
      "maxLength": 200
    },
    "data": {
      "type": "object",
      "properties": {
        "series": {
          "default": [],
          "maxItems": 12,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "points": {
                "minItems": 1,
                "maxItems": 1000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "x": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "y": {
                      "type": "number"
                    },
                    "r": {
                      "type": "number",
                      "minimum": 0
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 120
                    }
                  },
                  "required": [
                    "x",
                    "y"
                  ]
                }
              },
              "role": {
                "type": "string",
                "enum": [
                  "positive",
                  "neutral",
                  "negative",
                  "other"
                ]
              }
            },
            "required": [
              "name",
              "points"
            ]
          }
        },
        "x": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "time",
                "category",
                "number"
              ]
            },
            "label": {
              "type": "string",
              "maxLength": 80
            },
            "unit": {
              "type": "string",
              "maxLength": 16
            },
            "granularity": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month",
                "year"
              ]
            }
          }
        },
        "y": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string",
              "maxLength": 80
            },
            "unit": {
              "type": "string",
              "maxLength": 16
            },
            "format": {
              "type": "string",
              "enum": [
                "number",
                "percent",
                "currency"
              ]
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Za-z]{3}$"
            },
            "decimals": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            },
            "higher_is_better": {
              "type": "boolean"
            }
          }
        },
        "x_measure": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string",
              "maxLength": 80
            },
            "unit": {
              "type": "string",
              "maxLength": 16
            },
            "format": {
              "type": "string",
              "enum": [
                "number",
                "percent",
                "currency"
              ]
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Za-z]{3}$"
            },
            "decimals": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            },
            "higher_is_better": {
              "type": "boolean"
            }
          }
        },
        "events": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
              },
              "end": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "detail": {
                "type": "string",
                "maxLength": 200
              }
            },
            "required": [
              "date",
              "label"
            ]
          }
        },
        "columns": {
          "maxItems": 8,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "format": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "unit": {
                    "type": "string",
                    "maxLength": 16
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "number",
                      "percent",
                      "currency"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{3}$"
                  },
                  "decimals": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "higher_is_better": {
                    "type": "boolean"
                  }
                }
              }
            },
            "required": [
              "key",
              "label"
            ]
          }
        },
        "rows": {
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 200
                },
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        "highlight": {
          "type": "string",
          "maxLength": 120
        }
      },
      "description": "Your own data: series of points (x, y), or events, or columns and rows."
    },
    "type": {
      "default": "auto",
      "description": "The chart type. auto (the default) picks the one that tells the data best; any other forces it while the data allows.",
      "type": "string",
      "enum": [
        "auto",
        "line",
        "area",
        "bar",
        "bar_horizontal",
        "stacked_bar",
        "pie",
        "donut",
        "scatter",
        "funnel",
        "timeline",
        "kpi",
        "table"
      ]
    },
    "index": {
      "description": "Build the chart from your custom index (idx_…) instead of the news: prices, ratings, availability and brands.",
      "type": "string",
      "pattern": "^idx_[a-z0-9]{6,40}$"
    },
    "mode": {
      "default": "auto",
      "description": "auto: the cheapest mode that gets the data (coverage in ultra, figures in fast, reading articles only if needed). Or fix it.",
      "type": "string",
      "enum": [
        "auto",
        "ultra",
        "fast",
        "normal",
        "deep"
      ]
    },
    "compare": {
      "description": "What to compare (2 to 5), if the query does not say it with «vs».",
      "minItems": 2,
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 80
      }
    },
    "questions": {
      "description": "One typed question (boolean, choice, score): the chart shows how the answers split across the articles.",
      "type": "object",
      "propertyNames": {
        "type": "string",
        "pattern": "^[\\w-]{1,40}$"
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "boolean"
              },
              "instructions": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "$ref": "#/$defs/ChartRequest___schema0"
                    }
                  },
                  {
                    "type": "array",
                    "items": {
                      "$ref": "#/$defs/ChartRequest___schema0"
                    }
                  }
                ]
              },
              "criteria": {
                "type": "object",
                "properties": {
                  "true": {
                    "type": "string"
                  },
                  "false": {
                    "type": "string"
                  }
                }
              }
            },
            "required": [
              "type",
              "instructions"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "choice"
              },
              "instructions": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "$ref": "#/$defs/ChartRequest___schema0"
                    }
                  },
                  {
                    "type": "array",
                    "items": {
                      "$ref": "#/$defs/ChartRequest___schema0"
                    }
                  }
                ]
              },
              "criteria": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "required": [
              "type",
              "instructions",
              "criteria"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "score"
              },
              "instructions": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "$ref": "#/$defs/ChartRequest___schema0"
                    }
                  },
                  {
                    "type": "array",
                    "items": {
                      "$ref": "#/$defs/ChartRequest___schema0"
                    }
                  }
                ]
              },
              "criteria": {
                "minItems": 2,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "instructions",
              "criteria"
            ]
          }
        ]
      }
    },
    "days": {
      "description": "The last N days. By default it depends on what is measured: 30 for coverage, share of voice and outlets, 14 for tone, 60 for a timeline, 7 for figures.",
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 365
        },
        {
          "type": "null"
        }
      ]
    },
    "published_after": {
      "description": "Published on or after this date. A bare date is read in Argentina time (UTC−3).",
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        }
      ]
    },
    "published_before": {
      "description": "Published on or before this date; a bare date includes that whole day.",
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        }
      ]
    },
    "countries": {
      "description": "Only sources from these countries: ISO 3166-1 alpha-2 codes, such as AR or US.",
      "minItems": 1,
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 20
      }
    },
    "languages": {
      "description": "Only sources that publish in these languages: ISO 639-1 codes, such as es or en (a BCP 47 tag such as pt-BR counts as pt).",
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 35
      }
    },
    "include_domains": {
      "description": "Only these domains or paths. A domain includes its subdomains.",
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 200,
        "pattern": "^(https?:\\/\\/)?(\\*\\.)?[\\w-]+(\\.[\\w-]+)+(\\/\\S*)?$"
      }
    },
    "exclude_domains": {
      "description": "Never these domains or paths.",
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 200,
        "pattern": "^(https?:\\/\\/)?(\\*\\.)?[\\w-]+(\\.[\\w-]+)+(\\/\\S*)?$"
      }
    },
    "timezone": {
      "description": "IANA time zone that decides what day «today» is. Defaults to Argentina (America/Argentina/Buenos_Aires).",
      "type": "string"
    },
    "title": {
      "description": "Your title. Without one, the chart gets a title that states the finding.",
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "subtitle": {
      "type": "string",
      "minLength": 1,
      "maxLength": 240
    },
    "source": {
      "description": "The source line in the footer, for your own data.",
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "theme": {
      "default": "light",
      "description": "light, dark, editorial (warm paper, for media) or electric (deep blue, for presentations).",
      "type": "string",
      "enum": [
        "light",
        "dark",
        "editorial",
        "electric"
      ]
    },
    "locale": {
      "description": "Language of titles, labels and numbers. Defaults to Accept-Language.",
      "type": "string",
      "enum": [
        "en",
        "es"
      ]
    },
    "interpretation": {
      "description": "One of `interpretation.alternatives` from a previous response: chart that reading of the query instead.",
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "plan_only": {
      "default": false,
      "description": "Only the plan: what we understood, what would be measured, the chart type and the data needed. Free, without searching.",
      "type": "boolean"
    },
    "stream": {
      "default": false,
      "description": "Server-sent events: `step` while it works, `result` with the chart and, if a better chart arrives after the deadline, `improved`.",
      "type": "boolean"
    },
    "store": {
      "default": true,
      "description": "false: nothing is stored (no embed_url); the SVG comes in the response.",
      "type": "boolean"
    },
    "include_svg": {
      "default": false,
      "description": "Include the SVG in the response.",
      "type": "boolean"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "ChartRequest___schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChartRequest___schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/ChartRequest___schema0"
          }
        }
      ]
    }
  }
}