---
title: "Draft policy rules"
url: https://hexelstudio.com/docs/api/titan/management/drafts
---

# Draft policy rules

**POST** `/titan/management/deployments/{id}/policy/drafts`

Drafts typed policy rules from the customer's text with Claude, given only the text, the deployment's capabilities (ids, names, toolkits, risk and side-effect classes, operations, resource types, registered attribute names and types) and the policy's approval profile ids; never Ledger data, argument values or resource ids. The answer is parsed strictly, every name it uses is checked against the deployment, the rules are deny, or require_approval narrowed to each allow of the policy it overlaps (the allow's agents and conditions kept, so nothing refused today is let through), and are compiled with the policy in force, and the result is a suggestion of kind draft with the customer's text, listed, previewed and accepted through the suggestions routes. Nothing changes until it is accepted.

## Path parameters

- `id: string`

## Headers

- `Authorization: string`

  `Bearer <token>`. A Hexel Studio access token for a member or a service user of your organization (or send a service user's API key as X-API-Key).

## Body parameters

- `text: string`

## Returns

`200` Organization-scoped result. (`PolicyDraftResult`)

- `preview: object`

  - `added_rules: array of object`

    - `approval_profile_ids: array of string`

    - `connection_constraints: object`

      - `allowed_principal_types: optional array of string`

      - `provider: optional string`

      - `required_destination_boundaries: optional array of string`

      - `required_permissions: optional array of string`

      - `required_tags: optional array of string`

    - `effect: string`

    - `limits: object`

      - `maximum_concurrency: optional integer`

      - `maximum_cost_microunits: optional integer`

      - `maximum_response_bytes: optional integer`

      - `timeout_ms: optional integer`

    - `match: object`

      - `agent_ids: optional array of string`

      - `agent_revision_ids: optional array of string`

      - `attributes: optional array of object`

        - `name: string`

        - `operator: string`

        - `value: any`

      - `capability_contract_digests: optional array of string`

      - `capability_ids: optional array of string`

      - `capability_revisions: optional array of integer`

      - `delegation: optional string`

      - `delegator_ids: optional array of string`

      - `deployment_ids: optional array of string`

      - `destination_boundaries_all: optional array of string`

      - `destination_providers: optional array of string`

      - `environment_ids: optional array of string`

      - `environment_states: optional array of string`

      - `excluded_delegator_ids: optional array of string`

      - `minimum_assurance: optional string`

      - `operations: optional array of string`

      - `resource_ids: optional array of string`

      - `resource_types: optional array of string`

      - `risk_classes: optional array of string`

      - `runtime_classes: optional array of string`

      - `runtime_principal_ids: optional array of string`

      - `side_effect_classes: optional array of string`

      - `toolkits: optional array of string`

      - `utc_windows: optional array of object`

        - `end_minute: integer`

        - `start_minute: integer`

        - `weekday: integer`

      - `workspace_ids: optional array of string`

    - `mode: optional string`

    - `obligations: object`

      - `audit_profile_ids: optional array of string`

      - `audit_required: optional boolean`

      - `executor_obligation_profile_ids: optional array of string`

      - `idempotency_required: optional boolean`

      - `response_filter_profile_ids: optional array of string`

    - `priority: integer`

    - `rule_id: string`

  - `approval_profile_id: optional string`

  - `base_source_digest: string`

  - `evidence_digest: string`

  - `kind: string`

  - `option: string`

  - `problems: array of string`

  - `source_revision: integer`

  - `suggestion_id: string`

  - `valid: boolean`

- `suggestion: object`

  - `evidence: optional object`

    - `count: optional integer`

    - `first_at: optional string`

    - `last_at: string`

    - `sessions: optional integer`

    - `window_days: integer`

  - `evidence_digest: string`

  - `group: optional object`

    - `agent_id: string`

    - `capability_id: string`

    - `delegated: boolean`

    - `deployment_id: string`

    - `operation: string`

    - `resource_id: optional string`

    - `resource_type: string`

  - `kind: string`

  - `options: array of object`

    - `approval_profile_required: boolean`

    - `option: string`

  - `rule_ids: array of string`

  - `suggestion_id: string`

  - `template: optional object`

    - `capability_bundle_digest: string`

    - `capability_bundle_generation: integer`

    - `name: string`

    - `rules_digest: string`

    - `template_id: string`

    - `template_version: integer`

  - `text: optional string`

## Errors

- `400` Invalid request: the body is not exactly {"text"} with 1-1000 characters, or the path has a query.
- `401` Missing or invalid authenticated context.
- `403` Organization mismatch, or the IAM action titan:policy:publish is denied.
- `404` Unknown or foreign deployment; NOT_FOUND too while the caller's organization does not have policy suggestions.
- `405` HTTP method is not supported on this route.
- `409` The deployment is not a provisioned Titan Cloud deployment (DEPLOYMENT_NOT_PROVISIONED), is retired (DEPLOYMENT_RETIRED) or has an operation in progress (OPERATION_IN_PROGRESS).
- `413` Request body exceeds its size limit.
- `415` Unsupported request media type.
- `422` DRAFT_REFUSED with error.message saying why: the model declined, its answer did not parse, or it named a capability, operation, resource type, attribute or approval profile the deployment does not have (for example no registered amount attribute on the refund capability), or the rules do not pass the policy checks; a require_approval that no allow of the policy overlaps; a Titan Dedicated deployment; more than 2,000 capabilities; a request the model API refuses as invalid. No rule is offered.
- `429` RATE_LIMITED: the organization asked for 20 drafts in the last hour; Retry-After says when to try again.
- `502` The deployment's Configuration Authority refused or answered unexpectedly (closed code).
- `503` DRAFT_UNAVAILABLE when the model is not configured, unreachable, overloaded or timed out, or the deployment's capability catalog or policy layers cannot be read; local storage or the deployment's Configuration Authority unavailable.

## Example

```bash
curl --request POST \
  --url 'https://api.hexelstudio.com/v1/titan/management/deployments/{id}/policy/drafts' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "text": "string"
}'
```

### Response (200)

```json
{
  "preview": {
    "added_rules": [
      {
        "approval_profile_ids": [
          "string"
        ],
        "connection_constraints": {
          "allowed_principal_types": [
            "string"
          ],
          "provider": "string",
          "required_destination_boundaries": [
            "string"
          ],
          "required_permissions": [
            "string"
          ],
          "required_tags": [
            "string"
          ]
        },
        "effect": "string",
        "limits": {
          "maximum_concurrency": 0,
          "maximum_cost_microunits": 0,
          "maximum_response_bytes": 0,
          "timeout_ms": 0
        },
        "match": {
          "agent_ids": [
            "string"
          ],
          "agent_revision_ids": [
            "string"
          ],
          "attributes": [
            {
              "name": "string",
              "operator": "string",
              "value": "string"
            }
          ],
          "capability_contract_digests": [
            "string"
          ],
          "capability_ids": [
            "string"
          ],
          "capability_revisions": [
            0
          ],
          "delegation": "string",
          "delegator_ids": [
            "string"
          ],
          "deployment_ids": [
            "string"
          ],
          "destination_boundaries_all": [
            "string"
          ],
          "destination_providers": [
            "string"
          ],
          "environment_ids": [
            "string"
          ],
          "environment_states": [
            "string"
          ],
          "excluded_delegator_ids": [
            "string"
          ],
          "minimum_assurance": "string",
          "operations": [
            "string"
          ],
          "resource_ids": [
            "string"
          ],
          "resource_types": [
            "string"
          ],
          "risk_classes": [
            "string"
          ],
          "runtime_classes": [
            "string"
          ],
          "runtime_principal_ids": [
            "string"
          ],
          "side_effect_classes": [
            "string"
          ],
          "toolkits": [
            "string"
          ],
          "utc_windows": [
            {
              "end_minute": 0,
              "start_minute": 0,
              "weekday": 0
            }
          ],
          "workspace_ids": [
            "string"
          ]
        },
        "mode": "string",
        "obligations": {
          "audit_profile_ids": [
            "string"
          ],
          "audit_required": true,
          "executor_obligation_profile_ids": [
            "string"
          ],
          "idempotency_required": true,
          "response_filter_profile_ids": [
            "string"
          ]
        },
        "priority": 0,
        "rule_id": "string"
      }
    ],
    "approval_profile_id": "string",
    "base_source_digest": "string",
    "evidence_digest": "string",
    "kind": "string",
    "option": "string",
    "problems": [
      "string"
    ],
    "source_revision": 0,
    "suggestion_id": "string",
    "valid": true
  },
  "suggestion": {
    "evidence": {
      "count": 0,
      "first_at": "2026-01-01T00:00:00Z",
      "last_at": "2026-01-01T00:00:00Z",
      "sessions": 0,
      "window_days": 0
    },
    "evidence_digest": "string",
    "group": {
      "agent_id": "string",
      "capability_id": "string",
      "delegated": true,
      "deployment_id": "string",
      "operation": "string",
      "resource_id": "string",
      "resource_type": "string"
    },
    "kind": "string",
    "options": [
      {
        "approval_profile_required": true,
        "option": "string"
      }
    ],
    "rule_ids": [
      "string"
    ],
    "suggestion_id": "string",
    "template": {
      "capability_bundle_digest": "string",
      "capability_bundle_generation": 0,
      "name": "string",
      "rules_digest": "string",
      "template_id": "string",
      "template_version": 0
    },
    "text": "string"
  }
}
```

### Response (400)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (401)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (403)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (404)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (405)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (409)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (413)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (415)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (422)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (429)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (502)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```

### Response (503)

```json
{
  "error": {
    "billing_url": "string",
    "code": "string",
    "message": "string"
  }
}
```
