v5

latestOpenAPI 3.0.3Apache 2.0raw.githubusercontent.com2026-02-283466592.5 MB
Custom roles

Create custom role

Create a new custom role

post/api/v2/roles

Request body

namestring required

A human-friendly name for the custom role

keystring required

The custom role key

descriptionstring

Description of custom role

basePermissionsstring
resourceCategorystring

Example request

{
  "name": "Ops team",
  "key": "role-key-123abc",
  "description": "An example role for members of the ops team",
  "policy": [
    {
      "resources": [
        "proj/*:env/*:flag/*;testing-tag"
      ],
      "actions": [
        "*"
      ],
      "effect": "allow"
    }
  ]
}

Response

Custom role response

_idstring required

The ID of the custom role

_linksobject required

The location and content type of related resources

descriptionstring

The description of the custom role

keystring required

The key of the custom role

namestring required

The name of the custom role

basePermissionsstring
resourceCategorystring
_presetBundleVersioninteger

If created from a preset, the preset bundle version

Example response

{
  "_id": "1234a56b7c89d012345e678f",
  "_access": {
    "denied": [
      {
        "reason": {
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ],
          "effect": "allow"
        }
      }
    ],
    "allowed": [
      {
        "reason": {
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ],
          "effect": "allow"
        }
      }
    ]
  },
  "description": "This custom role is just an example",
  "key": "example-custom-role",
  "name": "Example custom role",
  "policy": [
    {
      "resources": [
        "proj/*:env/*;qa_*:/flag/*"
      ],
      "actions": [
        "*"
      ],
      "effect": "allow"
    }
  ],
  "_presetStatements": [
    {
      "resources": [
        "proj/*:env/*;qa_*:/flag/*"
      ],
      "actions": [
        "*"
      ],
      "effect": "allow"
    }
  ]
}