---
title: "Create one Hive AI policy. A new policy is not enabled, so nothing answers from it until an owner or admin enables it."
method: POST
path: "/api/v1/tools/create_ai_policy"
---

# Create one Hive AI policy. A new policy is not enabled, so nothing answers from it until an owner or admin enables it.

`POST /api/v1/tools/create_ai_policy`

## Request

- Base URL: `https://hivepublish.com`
- URL: `https://hivepublish.com/api/v1/tools/create_ai_policy`
- Auth: HTTP bearer

## Headers

- `Idempotency-Key` string, required

## Request body

- object
  - `goalEvent` string, nullable: Optional goal event, or null to clear it.
  - `providerConnectionId` string, nullable: Saved provider connection id, or null for the workspace default.
  - `knowledgeSourceIds` string[]: Exact knowledge source ids to use; an empty list restores the native default.
  - `outputSchema` object: The policy output schema stored by Hive.
  - `piiRedaction` boolean: Redact personal information before evaluation.
  - `injectionDefense` boolean: Enable the native injection checks.
  - `retentionDays` integer: Stored result retention, from 0 to 3650 days.
  - `name` string, required: What to call this policy.
  - `policyType` string, required: What kind of policy it is.
  - `instruction` string: What the AI is told to do.
  - `allowedTopics` string[]: What it may talk about.
  - `blockedTopics` string[]: What it must not.
  - `languages` string[]: The languages it may answer in.
  - `tone` string: How it should sound.
  - `confidenceThreshold` number: How sure it must be, from 0 to 1.
  - `requireCitations` boolean: Make it cite an approved source.
  - `requireHumanApproval` boolean: Make a person approve each answer.
  - `fallbackAction` string: What it does when it is not sure.

## Response `200`

Tool result

- ToolResult
  - `data` unknown, required
  - `meta` object, required
    - `tool` string
    - `workspaceId` string, uuid

## Other responses

- `400`: Invalid input
- `401`: Missing or invalid credential
- `403`: Missing workspace scope, role permission, or plan entitlement
- `409`: Idempotency conflict, replay, or request still in progress
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/hivepublish/apis/hive-developer-api.md) · [All operations](https://skmtc.dev/hivepublish/apis/hive-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hivepublish/apis/hive-developer-api/revisions/b440c763583e?raw)
