---
title: "Chat With Advisor"
method: POST
path: "/api/ai-advisor"
tags: ["AI Advisor"]
---

# Chat With Advisor

`POST /api/ai-advisor`

Handle a chat request and return a structured AI advisor response.

Uses Mistral AI with the Scout personality to provide business insights.

Returns:
    AIAdvisorResponse: Advisor message, transaction metrics and summary, date range, optional warning, and timestamp.

Raises:
    HTTPException: with status 503 if AI backend (MISTRAL_API_KEY) is not configured; with status 500 for other internal errors.

## Request body

- AIAdvisorRequest
  - `message` string, required
  - `conversationHistory` Message[]
    - `role` string, required
    - `content` string, required
  - `dateRangeOverride` object, nullable
  - `userId` string, nullable
  - `programId` string, nullable
  - `transactionSummary` object, nullable
  - `transactionDetails` object[], nullable
  - `currencyCode` string
  - `currencySymbol` string

## Response `200`

Successful Response

- AIAdvisorResponse
  - `response` string, required
  - `transactionCount` integer, required
  - `transactionSummary` object, required
  - `dateRange` object, required
  - `warning` string, nullable
  - `timestamp` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/loyalty/apis/loyaltydog.md) · [All operations](https://skmtc.net/loyalty/apis/loyaltydog/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/loyalty/loyaltydog/versions/42b7b22af2b6/schema)
