---
title: "Create a path permission"
method: POST
path: "/repos/{repo_id}/granular-permissions"
tags: ["Repository Granular Permissions"]
---

# Create a path permission

`POST /repos/{repo_id}/granular-permissions`

Create a new path permission rule for this repository

## Request body

- CreateGranularPermission
  - `user_id` string — User ID to assign this permission to (mutually exclusive with group_id)
  - `group_id` string — Group ID to assign this permission to (mutually exclusive with `user_id`)
  - `path_pattern` string, required — Path pattern for matching files. Supports wildcards: "/path/to/file" for exact match, "/path/..." for recursive wildcard, "/path/*.ext" for extension matching.
  - `access_level` 'ADMIN' | 'WRITE' | 'READ' | 'NO_ACCESS', required — Access level for path permissions. Hierarchical: ADMIN > WRITE > READ > NO_ACCESS.
  - `permission_type` 'ALLOW_LT_EQ' | 'ALLOW_EQ' | 'DENY_ALL' | 'DENY_EQ', required — Permission type controlling how access levels are granted or denied. ALLOW_LT_EQ grants specified level and all lower levels. ALLOW_EQ grants only the exact level. DENY_ALL denies all level granted above in the table. DENY_EQ denies only the exact level.
  - `insert_above_rule_id` string — Optional. ID of an existing rule to insert this rule above (lower evaluation_order). If not provided, the rule is added at the top (highest evaluation_order/priority).

## Response `201`

Resource created

- NewResourceId
  - `id` string, required — The id of the newly created resource

## Other responses

- `400` — Invalid path pattern or missing required fields
- `default` — An error occurred

---

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