---
title: "Create a new Insight"
method: POST
path: "/governance/insights/create"
tags: ["Governance"]
---

# Create a new Insight

`POST /governance/insights/create`

Creates a new insight with the provided configuration. The endpoint validates required fields (name, code, type, providerIds, category) and tests the Rego code for validity before creation.

## Request body

- object
  - `name` string, required — Name of the insight
  - `description` string — Description of the insight
  - `code` string, required — Rego code for the insight rule (can be base64 encoded)
  - `type` string[], required — Array of insight types
  - `providerIds` string[], required — Array of provider IDs this insight applies to
  - `labels` union — Labels for the insight
    - string — Comma-separated labels
    - string[] — Array of labels
  - `severity` integer — Severity level of the insight
  - `category` string, required — Category of the insight
  - `frameworks` string[] — Array of compliance frameworks this insight relates to

## Response `200`

Insight created successfully

- object
  - `id` string — The ID of the created insight
  - `name` string — Name of the insight
  - `description` string — Description of the insight
  - `code` string — Rego code for the insight rule
  - `type` string[] — Array of insight types
  - `providerIds` string[] — Array of provider IDs
  - `labels` union — Labels
    - string — Comma-separated labels
    - string[] — Array of labels
  - `severity` string — Severity level
  - `category` string — Category
  - `frameworks` string[] — Array of compliance frameworks

## Other responses

- `400` — Bad request - missing required parameters (name, code, type, providerIds, category), empty field values, or invalid Rego rule
- `401` — Unauthorized
- `500` — Internal server error

---

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