---
title: "POST /v1alpha1/policies/{policyId}/rules"
method: POST
path: "/v1alpha1/policies/{policyId}/rules"
tags: ["PolicyService"]
---

# POST /v1alpha1/policies/{policyId}/rules

`POST /v1alpha1/policies/{policyId}/rules`

## Request

- Base URL: `http://localhost:4000`
- URL: `http://localhost:4000/v1alpha1/policies/{policyId}/rules`
- Auth: HTTP bearer and API key in header `x-id-api-key`

Create a new Rule.

## Path parameters

- `policyId` string, required

## Request body

- CreateRuleRequest
  - `policyId` string: The Policy Id to which these Rules belong.
  - `name` string: A human-readable name for the Rule.
  - `description` string: A human-readable description for the Rule.
  - `tasks` string[]: The tasks that this Rule applies to.
  - `needsApproval` boolean: Need User Approval for this Rule.
  - `action` 'RULE_ACTION_UNSPECIFIED' | 'RULE_ACTION_ALLOW' | 'RULE_ACTION_DENY', enum: The action applied for the rule when calling the tasks

## Response `200`

OK

- Rule: Identity Service Policy Rule
  - `id` string: A unique identifier for the Rule.
  - `name` string, required: A human-readable name for the Rule.
  - `description` string: A human-readable description for the Rule.
  - `policyId` string
  - `tasks` Task[], required: The tasks that this Rule applies to.
    - `id` string: A unique identifier for the Task.
    - `name` string: A human-readable name for the Task.
    - `description` string: A human-readable description for the Task.
    - `appId` string: An application ID for the Task.
    - `toolName` string: A tool name for the Task.
  - `action` 'RULE_ACTION_UNSPECIFIED' | 'RULE_ACTION_ALLOW' | 'RULE_ACTION_DENY', enum, required: The action applied for the rule when calling the specified tasks
  - `needsApproval` boolean, required: Need User Approval for this Rule.
  - `createdAt` string, date-time: CreatedAt records the timestamp of when the Rule was initially created

## Other responses

- `default`: Default error response

## Changes

> 18 revisions in range; 7 not diffed.

- **2025-07-28** `63464ebf3f61`: 4 breaking, 9 info
  - the response property `action` became optional for the status `200`
  - the response property `name` became optional for the status `200`
  - the response property `needsApproval` became optional for the status `200`
  - the response property `tasks` became optional for the status `200`
  - …9 more

[Operation history](https://skmtc.dev/agntcy/apis/agntcy-identity-service-api/changes/v1alpha1/policies/:policyId/rules/post.md)

---

[API](https://skmtc.dev/agntcy/apis/agntcy-identity-service-api.md) - [All operations](https://skmtc.dev/agntcy/apis/agntcy-identity-service-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agntcy/apis/agntcy-identity-service-api/revisions/1dc8f8328648?raw)
