---
title: "Generate Customer Agent Response"
description: "How to call Generate Customer Agent Response (POST /api/customer-agent-responses) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/reference/create_customer_agent_response_beta"
revision: "2026-10-15.pre"
operationId: "create_customer_agent_response_beta"
method: "POST"
endpoint: "https://a.klaviyo.com/api/customer-agent-responses"
authentication: "privateKey"
scopes: ["agents:write"]
rateLimits: {"burst":"10/s","steady":"150/m"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
preRelease: "BETA"
openApi: "https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json"
jsonApi: {"fields":{"customer-agent-response":["events","id"]}}
related: ["https://developers.klaviyo.com/en/reference/customer-agent-beta/llms.txt","https://developers.klaviyo.com/en/reference/create_customer_agent_conversation_context_beta.md","https://developers.klaviyo.com/en/reference/get_customer_agents_beta.md","https://developers.klaviyo.com/en/reference/get_customer_agent_beta.md","https://developers.klaviyo.com/en/reference/create_customer_agent_beta.md","https://developers.klaviyo.com/en/reference/update_customer_agent_beta.md","https://developers.klaviyo.com/en/reference/get_customer_agent_training_runs_beta.md","https://developers.klaviyo.com/en/reference/start_customer_agent_training_run_beta.md","https://developers.klaviyo.com/en/reference/get_agent_conversation_context_ids_for_customer_agent_conversation_beta.md","https://developers.klaviyo.com/en/reference/get_agent_conversation_contexts_for_customer_agent_conversation_beta.md"]
---

# Generate Customer Agent Response

> This is the Markdown version of https://developers.klaviyo.com/en/reference/create_customer_agent_response_beta

```http
POST https://a.klaviyo.com/api/customer-agent-responses
```


> [!WARNING]
> **This endpoint is in beta and subject to change.**
> A beta revision header (2026-10-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.


Sends one or more messages to Customer Agent and returns every public event it emits in response, including structured data such as orders and products.

Multiple messages can be attached, if the user has sent multiple or another agent's response should be included. The response is non-streaming; the entire event list is returned at once.

Images the customer sent can be attached to the final message as `https://` URLs or base64 data URIs for the agent to take into account.

Requires an open `conversation`, created via `POST /api/customer-agent-conversations`. Conversations can only be interacted with that were created via the API. A closed or unknown conversation is also rejected. A hard or silent handoff moves the conversation to `routed-to-team`, after which it no longer accepts responses.

- Revision header: `revision: 2026-10-15.pre` (required)
- Scopes: `agents:write`
- Rate limits: Burst: `10/s`, Steady: `150/m`
- OpenAPI: [Download this endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json)

## Example request

### curl

```bash
curl --request POST \
     --url 'https://a.klaviyo.com/api/customer-agent-responses' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-10-15.pre' \
     --header 'content-type: application/vnd.api+json' \
     --data '{
  "data": {
    "type": "customer-agent-response",
    "attributes": {
      "messages": [
        {
          "content": "string",
          "role": "user"
        }
      ]
    },
    "relationships": {
      "conversation": {
        "data": {
          "type": "customer-agent-conversation",
          "id": "string"
        }
      }
    }
  }
}'
```

### CLI

```bash
klaviyo beta customer-agent create-customer-agent-response \
  -d '{
  "data": {
    "type": "customer-agent-response",
    "attributes": {
      "messages": [
        {
          "content": "string",
          "role": "user"
        }
      ]
    },
    "relationships": {
      "conversation": {
        "data": {
          "type": "customer-agent-conversation",
          "id": "string"
        }
      }
    }
  }
}'
```

Sign in first with `klaviyo auth login`. [Install the Klaviyo CLI](https://developers.klaviyo.com/en/docs/klaviyo_cli.md)

## Query parameters

- `fields[customer-agent-response]` (string[]): For more information please visit [API overview](https://developers.klaviyo.com/en/reference.md) Allowed values: `events`, `id`

## Headers

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

## Request body

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

- `data` (object, required)
  - `type` (string, required): Allowed values: `customer-agent-response`
  - `attributes` (object, required)
    - `mode` (string, nullable): Deprecated: ignored. The conversation's mode is used. Allowed values: `preview`, `live`
    - `channel` (string, nullable): Deprecated: ignored. The conversation's channel is used. Allowed values: `web-chat`, `sms`, `email`, `whatsapp`
    - `messages` (object[], required): Conversation history for this turn. The final message must have `role: user`, and is the only message that can include `images`.
      - `content` (string, required): Message text.
      - `role` (string, required): Author of a message in a Customer Agent conversation. Allowed values: `user`, `agent`
      - `images` (object[], nullable): Images the customer sent with this message, up to 4. Only allowed on the final message. Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
  - `relationships` (object, required)
    - `conversation` (object, required)
      - `data` (object, required): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).

### Example request body

```json
{
  "data": {
    "type": "customer-agent-response",
    "attributes": {
      "messages": [
        {
          "content": "string",
          "role": "user"
        }
      ]
    },
    "relationships": {
      "conversation": {
        "data": {
          "type": "customer-agent-conversation",
          "id": "string"
        }
      }
    }
  }
}
```

## Responses

### 201: Success

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

- `data` (object, required)
  - `type` (string, required): Allowed values: `customer-agent-response`
  - `id` (string, required): Opaque identifier for this Customer Agent response.
  - `attributes` (object, required)
    - `events` (oneOf[], required): Events from this turn, in the order they were emitted. Alongside message and handoff events, can include structured data: `order-tracking`, `edit-order`, `order-return`, `product`, `subscriptions`, `discounts-coupons`, and `loyalty-card`. Ignore event types you don't recognize.
      - One of:
        - Option 1: `CustomerAgentResponseMessageEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 2: `CustomerAgentResponseHandoffEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 3: `CustomerAgentResponseRequireAuthenticationEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 4: `CustomerAgentResponseErrorEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 5: `CustomerAgentResponseOrderTrackingEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 6: `CustomerAgentResponseEditOrderEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 7: `CustomerAgentResponseOrderReturnEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 8: `CustomerAgentResponseProductEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 9: `CustomerAgentResponseSubscriptionsEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 10: `CustomerAgentResponseDiscountsCouponsEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
        - Option 11: `CustomerAgentResponseLoyaltyCardEvent` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
  - `relationships` (object, required)
    - `conversation` (object, required)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_customer_agent_response_beta.json).
  - `links` (object, required)
    - `self` (string<uri>, required)
- `links` (ObjectLinks): Same fields as the first ObjectLinks above.

#### Example response body

```json
{
  "data": {
    "type": "customer-agent-response",
    "id": "string",
    "attributes": {
      "events": [
        {
          "type": "message",
          "role": "agent",
          "content": "string"
        }
      ]
    },
    "relationships": {
      "conversation": {
        "data": {
          "type": "customer-agent-conversation",
          "id": "string"
        }
      }
    },
    "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"
      }
    }
  ]
}
```
