---
title: "Create Ksql Ask"
description: "How to call Create Ksql Ask (POST /api/ksql-ask) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/v2026-07-15/reference/create_ksql_ask_beta"
revision: "2026-07-15.pre"
latestUrl: "https://developers.klaviyo.com/en/reference"
operationId: "create_ksql_ask_beta"
method: "POST"
endpoint: "https://a.klaviyo.com/api/ksql-ask"
authentication: "privateKey"
scopes: ["campaigns:read","catalogs:read","events:read","lists:read","metrics:read","profiles:read","segments:read"]
rateLimits: {"burst":"1/s","steady":"15/m"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
preRelease: "BETA"
openApi: "https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15.pre/openapi/beta/apis/create_ksql_ask_beta.json"
jsonApi: {"fields":{"ksql-ask":["answer","id","result_sets","status","warnings"]}}
related: ["https://developers.klaviyo.com/en/v2026-07-15/reference/ksqls-beta/llms.txt"]
---

# Create Ksql Ask

> This is the Markdown version of https://developers.klaviyo.com/en/v2026-07-15/reference/create_ksql_ask_beta

```http
POST https://a.klaviyo.com/api/ksql-ask
```


> [!WARNING]
> **This endpoint is in beta and subject to change.**
> A beta revision header (2026-07-15.pre) is required to use our beta APIs. Klaviyo APIs in beta are not intended for use in production. See our [versioning and deprecation policy](https://developers.klaviyo.com/en/docs/api_versioning_and_deprecation_policy.md) for more information.


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.pre` (required)
- Scopes: `campaigns:read`, `catalogs:read`, `events:read`, `lists:read`, `metrics:read`, `profiles:read`, `segments:read`
- Rate limits: Burst: `1/s`, Steady: `15/m`
- OpenAPI: [Download this endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15.pre/openapi/beta/apis/create_ksql_ask_beta.json)

Steady: `15/m`

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

## Example request

```bash
curl --request POST \
     --url 'https://a.klaviyo.com/api/ksql-ask' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-07-15.pre' \
     --header 'content-type: application/vnd.api+json' \
     --data '{
  "data": {
    "type": "ksql-ask",
    "attributes": {
      "question": "How many orders were placed last week?",
      "max_rows": 100
    }
  }
}'
```

## Query parameters

- `fields[ksql-ask]` (string[]): For more information please visit [API overview](https://developers.klaviyo.com/en/v2026-07-15/reference.md) Allowed values: `answer`, `id`, `result_sets`, `status`, `warnings`

## Headers

- `revision` (string, required): API endpoint revision (format: YYYY-MM-DD[.suffix]) Default: `2026-07-15.pre`

## Request body

Content type: `application/vnd.api+json` (required)

- `data` (object, required)
  - `type` (string, required): Allowed values: `ksql-ask`
  - `attributes` (object, required)
    - `question` (string, required): 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`

### Example request body

```json
{
  "data": {
    "type": "ksql-ask",
    "attributes": {
      "question": "How many orders were placed last week?",
      "max_rows": 100
    }
  }
}
```

## Responses

### 201: Success

Content type: `application/vnd.api+json`

- `data` (object, required)
  - `type` (string, required): Allowed values: `ksql-ask`
  - `id` (string, required): Identifier for this ask, for joining logs across services.
  - `attributes` (object, required)
    - `status` (string, required): Whether this ask was answered or needs more input. Allowed values: `success`, `clarification`
    - `answer` (string, required): 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: `[]`
      - `columns` (object[], required): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15.pre/openapi/beta/apis/create_ksql_ask_beta.json).
      - `rows` (string | integer | number | boolean[][], required)
      - `row_count` (integer, required)
      - `rows_returned` (integer, required)
      - `completeness` (string, required): 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` (string, nullable)
      - `sql` (string, nullable): 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: `[]`
  - `links` (object, required)
    - `self` (string<uri>, required)
- `links` (ObjectLinks): Same fields as the first ObjectLinks above.

#### Example response body

```json
{
  "data": {
    "type": "ksql-ask",
    "id": "string",
    "attributes": {
      "status": "success",
      "answer": "string",
      "result_sets": [],
      "warnings": [
        "Showing the first 100 of 4,182 matching orders."
      ]
    },
    "links": {
      "self": "https://www.example.com"
    }
  },
  "links": {
    "self": "https://www.example.com"
  }
}
```

### 4XX: Client Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```

### 5XX: Server Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```
