Skip to content

This page is available as Markdown at https://developers.klaviyo.com/en/v2026-07-15/reference/create_ksql_ask_beta.md. Its OpenAPI document is at https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15.pre/openapi/beta/apis/create_ksql_ask_beta.json. An index of every page is at https://developers.klaviyo.com/llms.txt.

KlaviyoKlaviyoDevelopers
v2026-07-15

This endpoint is in beta. Call it with the revision header 2026-07-15.pre. Beta endpoints may change before they're generally available. See our versioning and deprecation policy for more information.

You're reading the reference for API revision 2026-07-15. The latest revision is 2026-10-15. See this page in the latest revision.

Create Ksql Ask

POSThttps://a.klaviyo.com/api/ksql-ask

Ask K-SQL a natural-language question and get back an answer.

No public deadline_sec -- this layer owns the run budget (see KsqlPublicApiSettings.ask_deadline_sec) rather than letting a caller hold a run open past this service's own ceiling.

Revision header
revision: 2026-07-15.prerequired
Scopes
campaigns:readcatalogs:readevents:readlists:readmetrics:readprofiles:readsegments:read
Rate limits
Burst: 1/sSteady: 15/m

Steady: 15/m

Optional Scopes: campaigns:read catalogs:read events:read lists:read metrics:read profiles:read segments:read

Query parameters

  • fields[ksql-ask]#string[]

    For more information please visit API overview

    Allowed values:
    • answer
    • id
    • result_sets
    • status
    • warnings

Headers

  • revision#stringrequired

    API endpoint revision (format: YYYY-MM-DD[.suffix])

    2026-07-15.pre

Request body

Content type: application/vnd.api+jsonrequired

  • data#objectrequired
    Show 2 fields
    • type#stringrequired
      Allowed values:
      • ksql-ask
    • attributes#objectrequired
      Show 2 fields
      • question#stringrequired

        The natural-language question to ask. 1-2000 characters.

        Example: How many orders were placed last week?

      • max_rows#integer

        Cap on rows per result set. 1-1000.

        Default: 100

        Example: 100

Responses

201Success

Content type: application/vnd.api+json

  • data#objectrequired
    Show 4 fields
    • type#stringrequired
      Allowed values:
      • ksql-ask
    • id#stringrequired

      Identifier for this ask, for joining logs across services.

    • attributes#objectrequired
      Show 4 fields
      • status#stringrequired

        Whether this ask was answered or needs more input.

        Allowed values:
        • success
        • clarification
      • answer#stringrequired

        Plain-language answer when status is success, or the clarifying question back to the caller when status is clarification.

      • result_sets#object[]

        The executed queries' typed result sets supporting answer. Always empty when status is clarification; may also be empty on success when the answer required no query execution.

        Default: []

        Show 8 fields
        • columns#object[]required
          Show 2 fields
          • name#stringrequired
          • type#stringrequired

            The kind of a k-sql result column's type.

            Allowed values:
            • boolean
            • long
            • double
            • string
            • timestamptz
            • unknown
        • rows#string | integer | number | boolean[][]required
        • row_count#integerrequired
        • rows_returned#integerrequired
        • completeness#stringrequired

          Whether the QUERY's result was complete -- it says nothing about this payload. sample means the query's row count equalled its own LIMIT, so the underlying result may be larger; truncated means it hit K-SQL's own result cap. Compare rows_returned to row_count for payload elision, which is separate: complete with rows_returned below row_count is a full query result only partially included here.

          Allowed values:
          • complete
          • sample
          • truncated

          Example: complete

        • description#stringnullable
        • sql#stringnullable

          The K-SQL query that produced this result set, so you can see how the numbers were derived. Read-only and for explanation only: K-SQL is an internal dialect with no endpoint that runs it, and it is not a stable interface -- do not parse it, store it, or build on its syntax.

          Example: SELECT count(*) FROM orders WHERE placed_at >= '2026-09-01'

        • caveats#string[]

          Caveats about this result set, in plain language and safe to show an end user as sent. The same sentences also appear in the response-level warnings; read them here when you need to know which result set a caveat applies to.

          Default: []

      • warnings#string[]

        Caveats that change how answer and result_sets should be read -- a sampled result set, row data elided by a cap, a table withheld from this ask. Several conditions are reported nowhere else, so surface these alongside the answer rather than discarding them.

        Default: []

4XXClient Error

Content type: application/vnd.api+json

  • errors#object[]required
    Show 5 fields
    • id#stringrequired
    • code#stringrequired
    • title#stringrequired
    • detail#stringrequired
    • source#object
      Show 2 fields
      • pointer#string
      • parameter#string

5XXServer Error

Content type: application/vnd.api+json

  • errors#object[]required
    Show 5 fields
    • id#stringrequired
    • code#stringrequired
    • title#stringrequired
    • detail#stringrequired
    • source#object
      Show 2 fields
      • pointer#string
      • parameter#string