---
title: "Trigger AI Reply"
method: POST
path: "/ai/reply"
tags: ["ai"]
---

# Trigger AI Reply

`POST /ai/reply`

Triggers an AI-generated reply to a specific message in a chat. The AI agent processes the message context and generates an appropriate response asynchronously.

**Requirements:**
- Organization must have an active subscription
- Organization must be on the Pro plan
- AI agent must be enabled at the organization level
- AI agent must be enabled for the specific chat

This is an asynchronous endpoint - it queues the AI reply for processing and returns immediately with a trace ID for tracking.

## Headers

- `x-phone` string

## Request body

- object
  - `chat_id` string, required — The unique identifier of the chat to reply in
  - `unique_id` string, required — The unique_id of the message to reply to. The AI will use this message and its surrounding context to generate a reply
  - `org_phone` string, required — The phone number of the organization (connected WhatsApp number) in the format country_code + number without special characters

## Response `200`

AI reply triggered successfully

- object
  - `success` boolean
  - `message` string
  - `trace_id` string, uuid — A unique trace ID for tracking the AI reply processing

## Other responses

- `400` — Bad Request
- `401` — Unauthorized - Invalid or missing API key

---

[API](https://skmtc.net/periskope/apis/api-local.md) · [All operations](https://skmtc.net/periskope/apis/api-local/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/periskope/api-local/revisions/f2738ced87d8/schema)
