---
title: "Generate Insights"
method: POST
path: "/api/businesses/{business_id}/insights/generate"
tags: ["Insights"]
---

# Generate Insights

`POST /api/businesses/{business_id}/insights/generate`

## Request

- Base URL: `https://api.flagpost.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.flagpost.ai/api/businesses/{business_id}/insights/generate`
- Auth: HTTP bearer

Generate insights from all indexed documents for a business.

This triggers insight extraction jobs for all documents that have been
indexed (have embeddings). Each document will be processed by the
InsightExtractionService to extract structured insights.

Args:
    business_id: Business UUID
    request: Options for which types of insights to generate
    ctx: Advisor context

Returns:
    Job IDs and status information

## Path parameters

- `business_id` string, required

## Response `200`

Successful Response

- GenerateInsightsResponse: Response model for generate insights endpoint.
  - `job_ids` string[], required
  - `total_jobs` integer, required
  - `status` string, required
  - `message` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/flagpost/apis/flagpost-api.md) - [All operations](https://skmtc.dev/flagpost/apis/flagpost-api/llms.txt) - [OpenAPI document](https://skmtc.dev/flagpost/apis/flagpost-api/revisions/0308cef485ca?raw)
