---
title: "Generate AI Reply"
method: POST
path: "/user/ai/generate-reply"
tags: ["AI Replies"]
---

# Generate AI Reply

`POST /user/ai/generate-reply`

## Request

- Base URL: `https://app.famulor.de/api`
- URL: `https://app.famulor.de/api/user/ai/generate-reply`
- Auth: HTTP bearer

Generates an AI reply using an assistant based on a customer identifier

[Docs](https://docs.famulor.io/api-v1/ai-replies/generate-reply)

## Request body

- object
  - `assistant_id` integer, required: The ID of the assistant to use for reply generation. Must belong to your account.
  - `customer_identifier` string, required: A unique identifier for the customer. This is used to maintain conversation context across multiple messages. **Examples**: Phone number, email address, CRM contact ID, Facebook user ID. **Maximum length**: 255 characters. **Important**: Always use the same format for the same customer to ensure context is correctly mapped.
  - `message` string, required: The customer's message to reply to.
  - `variables` object: Optional context variables to pass to the assistant. These are merged with existing conversation variables. Useful for passing customer data, session context, or other metadata that can personalize the reply.
    - `customer_name` string: Customer name for personalized addressing
    - `source` string: Message source (e.g. `whatsapp`, `facebook`, `sms`)
    - `order_id` string: Order number for support requests

## Response `200`

OK

- object
  - `success` boolean: Will be `false` when an error occurs
  - `conversation_id` string: The UUID of the conversation. Use this to track or reference the conversation later.
  - `customer_identifier` string: The customer identifier provided in the request
  - `reply` string: The AI-generated reply to the customer message
  - `function_calls` object[]: Array of function calls the assistant made while processing the message. Empty array if no functions were called.
    - `name` string: The name of the function that was called
    - `arguments` object: The arguments passed to the function
    - `result` object: The result of the function call
  - `ai_disabled` boolean: Indicates whether AI replies are disabled for this conversation (e.g. due to manual takeover)
  - `error` string: Error message describing what went wrong
  - `error_code` string: Machine-readable error code. Possible values: - `ASSISTANT_NOT_FOUND` - The assistant ID is invalid or does not belong to your account - `INSUFFICIENT_BALANCE` - Your account balance is too low to process the message

## Other responses

- `401`: Fehlender oder ungültiger API-Key.
- `402`: Insufficient Balance
- `404`: Assistant Not Found
- `422`: Validation Error
- `429`: Rate Limited

---

[API](https://skmtc.dev/famulor/apis/famulor-api.md) · [All operations](https://skmtc.dev/famulor/apis/famulor-api/llms.txt) · [OpenAPI document](https://skmtc.dev/famulor/apis/famulor-api/revisions/3b938c370721?raw)
