Skip to main content
POST
/
repos
/
{repo_id}
/
granular-permissions
Create a path permission
curl --request POST \
  --url https://api.diversion.dev/v0/repos/{repo_id}/granular-permissions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "path_pattern": "<string>",
  "access_level": "ADMIN",
  "permission_type": "ALLOW_LT_EQ",
  "user_id": "<string>",
  "group_id": "<string>",
  "insert_above_rule_id": "<string>"
}
'
{
  "id": "example_id",
  "read_only": true
}

Authorizations

Authorization
string
header
required

This API uses OAuth 2 with the implicit grant flow

Path Parameters

repo_id
string
required

The repo ID of the repository. Repo name can be used instead of the ID, but usage of ID for permanent linking and API requests is preferred.

Required string length: 3 - 128
Example:

"example_id"

Body

application/json
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.

Required string length: 1 - 1024
access_level
enum<string>
required

Access level for path permissions. Hierarchical: ADMIN > WRITE > READ > NO_ACCESS.

Available options:
ADMIN,
WRITE,
READ,
NO_ACCESS
permission_type
enum<string>
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.

Available options:
ALLOW_LT_EQ,
ALLOW_EQ,
DENY_ALL,
DENY_EQ
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)

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

Resource created

id
string
required

The id of the newly created resource

Example:

"example_id"

read_only
boolean