Skip to content

This page is available as Markdown at https://developers.klaviyo.com/en/v2026-07-15/reference/create_customer_agent_response_beta.md. Its OpenAPI document is at https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15.pre/openapi/beta/apis/create_customer_agent_response_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.

Generate Customer Agent Response

POSThttps://a.klaviyo.com/api/customer-agent-responses

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.

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.

Revision header
revision: 2026-07-15.prerequired
Scopes
agents:write
Rate limits
Burst: 10/sSteady: 150/m

Query parameters

  • fields[customer-agent-response]#string[]

    For more information please visit API overview

    Allowed values:
    • events
    • id

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 3 fields
    • type#stringrequired
      Allowed values:
      • customer-agent-response
    • attributes#objectrequired
      Show 3 fields
      • mode#stringrequired

        Whether the response is for testing or a real shopper interaction. preview responses are not billed and are excluded from production conversations and metrics. live responses count toward billing, Customer Agent conversations, and production metrics.

        Allowed values:
        • preview
        • live
      • channel#string

        Channel whose response conventions the agent should use, such as SMS terseness, email greetings and sign-offs, or web-chat formatting. This does not route or send the response through that channel; the caller delivers the output. Optional; defaults to web-chat.

        Allowed values:
        • web-chat
        • sms
        • email
        • whatsapp

        Default: web-chat

        Example: web-chat

      • messages#object[]required

        Conversation history for this turn. The final message must have role: user.

        Show 2 fields
        • content#stringrequired

          Message text.

        • role#stringrequired

          Author of a message in a Customer Agent conversation.

          Allowed values:
          • user
          • agent
    • relationships#objectrequired
      Show 1 field
      • conversation#objectrequired
        Show 1 field
        • data#object
          Show 2 fields
          • type#stringrequired
            Allowed values:
            • customer-agent-conversation
          • id#stringrequired

            Conversation to continue. Create one first via POST /api/customer-agent-conversations. Customer identity can only be set on the conversation itself, via that create call or a subsequent PATCH /api/customer-agent-conversations/{id}.

Responses

201Success

Content type: application/vnd.api+json

  • data#objectrequired
    Show 5 fields
    • type#stringrequired
      Allowed values:
      • customer-agent-response
    • id#stringrequired

      Opaque identifier for this Customer Agent response.

    • attributes#objectrequired
      Show 1 field
      • 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:

        1. Option 1: CustomerAgentResponseMessageEvent
          • type#stringrequired
            Allowed values:
            • message
          • role#stringrequired
            Allowed values:
            • agent
          • content#stringrequired
        2. Option 2: CustomerAgentResponseHandoffEvent
          • type#stringrequired
            Allowed values:
            • handoff
          • mode#stringrequired

            Public handoff mode.

            Allowed values:
            • hard
            • soft
            • silent
          • category#stringnullable

            Public handoff category.

            Allowed values:
            • explicit-ask
            • escalation-rule
            • unintelligible-input
            • bad-billing-state
        3. Option 3: CustomerAgentResponseRequireAuthenticationEvent
          • type#stringrequired
            Allowed values:
            • require-authentication
        4. Option 4: CustomerAgentResponseErrorEvent
          • type#stringrequired
            Allowed values:
            • error
          • code#integerrequired
          • message#stringrequired
        5. Option 5: CustomerAgentResponseOrderTrackingEvent
          • type#stringrequired
            Allowed values:
            • order-tracking
          • orders#object[]required

            Orders being tracked.

            Show 6 fields
            • order_id#stringnullable

              Order ID.

            • order_name#stringnullable

              Order name shown to the customer, e.g. #1001.

            • order_status#stringnullable

              Order status, e.g. PLACED, IN_TRANSIT, DELIVERED.

              Example: IN_TRANSIT

            • item_count#integernullable

              Number of items in the order.

            • image_url#stringnullable

              Image URL of the order's first item.

            • source_name#stringnullable

              Channel the order was placed through, e.g. web, pos.

        6. Option 6: CustomerAgentResponseEditOrderEvent
          • type#stringrequired
            Allowed values:
            • edit-order
          • orders#OrderData[]required

            Orders that can still be changed.

            Same fields as the first OrderData above.

        7. Option 7: CustomerAgentResponseOrderReturnEvent
          • type#stringrequired
            Allowed values:
            • order-return
          • orders#OrderData[]required

            Orders eligible for return.

            Same fields as the first OrderData above.

        8. Option 8: CustomerAgentResponseProductEvent
          • type#stringrequired
            Allowed values:
            • product
          • product#objectrequired

            The recommended product.

            Show 7 fields
            • product_id#stringrequired

              Product ID.

            • title#stringrequired

              Product name.

            • url#stringrequired

              Product page URL.

            • image#stringnullable

              Featured image URL.

            • variant_id#stringnullable

              Variant ID, if a variant applies.

            • request_id#stringnullable

              ID of the recommendation request that returned this product.

            • recommendation_source#stringnullable

              Recommendation provider, e.g. shopify.

        9. Option 9: CustomerAgentResponseSubscriptionsEvent
          • type#stringrequired
            Allowed values:
            • subscriptions
          • subscriptions#object[]required

            Subscriptions.

            Show 5 fields
            • subscription_id#stringnullable

              Subscription ID.

            • status#stringnullable

              Subscription status, e.g. active, paused, cancelled.

              Example: active

            • next_billing_date#stringnullable

              Date of the next charge and shipment.

            • billing_policy_interval#stringnullable

              Billing interval: day, week, or month.

              Example: month

            • lines#object[]

              Products in the subscription.

              Default: []

              Show 5 fields
              • product_title#stringnullable

                Product name.

              • product_variant_title#stringnullable

                Variant name.

              • image#stringnullable

                Product image URL.

              • price#numbernullable

                Price.

              • currency_code#stringnullable

                ISO 4217 currency code, e.g. USD.

        10. Option 10: CustomerAgentResponseDiscountsCouponsEvent
          • type#stringrequired
            Allowed values:
            • discounts-coupons
          • discounts_coupons#object[]required

            Available discount codes.

            Show 12 fields
            • coupon_id#integernullable

              Coupon ID.

            • coupon_type#stringnullable

              Integration that issued the coupon, e.g. shopify.

            • code#stringrequired

              Discount code to enter at checkout.

            • name#stringrequired

              Coupon name.

            • status#stringrequired

              Coupon status, e.g. active.

            • status_code#integernullable

              Numeric code for status.

            • description#stringnullable

              Coupon description.

            • discount_amount#numbernullable

              Discount value.

            • discount_type#integernullable

              Numeric discount type code.

            • purchase_min#numbernullable

              Minimum purchase amount.

            • start_time#stringnullable

              Start of the validity period.

            • expires_at#stringnullable

              Expiration time.

        11. Option 11: CustomerAgentResponseLoyaltyCardEvent
          • type#stringrequired
            Allowed values:
            • loyalty-card
          • loyalty_card#objectrequired

            Points balance and rewards.

            Show 9 fields
            • points_balance#integernullable

              Current points balance.

            • best_reward_name#stringnullable

              Most valuable reward the customer can redeem now.

            • best_reward_points_cost#integernullable

              Points cost of best_reward_name.

            • next_reward_name#stringnullable

              Least expensive reward the customer can't redeem yet.

            • next_reward_points_cost#integernullable

              Points cost of next_reward_name.

            • points_to_next_reward#integernullable

              Points still needed for next_reward_name.

            • reward_progress_percent#numbernullable

              Progress toward next_reward_name, from 0.0 to 1.0.

            • available_rewards#object[]

              Rewards the customer can redeem now.

              Default: []

              Show 5 fields
              • reward_id#stringnullable

                Reward ID.

              • name#stringnullable

                Reward name.

              • description#stringnullable

                Reward description.

              • points_cost#integernullable

                Points needed to redeem.

              • reward_type#stringnullable

                Reward type, e.g. discount, free_product, free_shipping.

            • loyalty_program_url#stringnullable

              Loyalty program page URL.

    • relationships#objectrequired
      Show 1 field
      • conversation#objectrequired
        Show 1 field
        • data#object
          Show 2 fields
          • type#stringrequired
            Allowed values:
            • customer-agent-conversation
          • id#stringrequired

            Conversation continued or created by this turn.

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