---
title: "Create an Alloy decision"
method: POST
path: "/ai/decision"
tags: ["ai-engine"]
---

# Create an Alloy decision

`POST /ai/decision`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/ai/decision`
- Auth: one of:
  - API key in cookie `session`
  - HTTP bearer

Creates a schema-validated AlloyDecision (v2.0.0). P0/P1 decisions are routed for human approval
per the approval matrix. rawInput triggers RAG evidence enrichment automatically.

## Request body

- object
  - `recommendedAction` string, required
  - `rationaleSummary` string, required
  - `riskLevel` 'P0' | 'P1' | 'P2' | 'P3' | 'P4', required
  - `confidence` number
  - `workflowId` string, nullable
  - `signalIds` string[]
  - `ownerSuggestion` string, nullable
  - `fallbackPlan` string, nullable
  - `modelRoute` string
  - `rawInput` string: If provided, triggers RAG retrieval to enrich evidenceRefs

## Response `201`

Decision created

- object
  - `decision` AlloyDecision: Schema-validated Alloy decision object (v2.0.0)
    - `decisionId` string, required
    - `workflowId` string, nullable
    - `signalIds` string[]
    - `recommendedAction` string, required
    - `rationaleSummary` string, required
    - `evidenceRefs` object[], required
      - `refId` string
      - `source` string
      - `sourceType` string
      - `content` string
      - `relevanceScore` number
      - `timestamp` string, nullable
      - `objectId` string, nullable
    - `confidence` number, required
    - `ownerSuggestion` string, nullable
    - `approvalRequired` boolean, required
    - `riskLevel` 'P0' | 'P1' | 'P2' | 'P3' | 'P4', required
    - `fallbackPlan` string, nullable
    - `modelRoute` string, required
    - `schemaVersion` '2.0.0', required
    - `createdAt` string, date-time, required
    - `status` 'proposed' | 'pending_approval' | 'approved' | 'rejected' | 'executed' | 'expired', required
    - `approvedBy` string, nullable
    - `approvedAt` string, date-time, nullable
    - `rejectedBy` string, nullable
    - `rejectedAt` string, date-time, nullable
    - `rejectionReason` string, nullable
    - `executedAt` string, date-time, nullable
    - `executionOutcome` 'pending' | 'executed' | 'failed' | 'rejected' | 'expired', nullable
    - `rawInput` string, nullable
    - `rawOutput` string, nullable
  - `approvalPolicy` ApprovalPolicy
    - `requiresApproval` boolean
    - `approverRole` string
    - `sla` string
    - `autoExpireHours` integer
  - `message` string

## Other responses

- `400`: Bad Request

## Changes

- **2026-04-18** `518dcf68679a`: 3 breaking, 1 info
  - the request property `fallbackPlan` became not nullable
  - the request property `ownerSuggestion` became not nullable
  - the request property `workflowId` became not nullable
  - removed the non-success response with the status `401`
- **2026-04-02** `86d5babe2996`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/szl-holdings/apis/szl-holdings-dreamstack-api/changes/ai/decision/post.md)

---

[API](https://skmtc.dev/szl-holdings/apis/szl-holdings-dreamstack-api.md) - [All operations](https://skmtc.dev/szl-holdings/apis/szl-holdings-dreamstack-api/llms.txt) - [OpenAPI document](https://skmtc.dev/szl-holdings/apis/szl-holdings-dreamstack-api/revisions/6ad730b13e59?raw)
