POST
/
api
/
v1
/
workspace
/
{projectSlug}
/
roles
curl --request POST \
  --url https://us.infisical.com/api/v1/workspace/{projectSlug}/roles \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "slug": "<string>",
  "name": "<string>",
  "description": "<string>",
  "permissions": [
    {
      "subject": "secrets",
      "inverted": true,
      "action": "read",
      "conditions": {
        "environment": "<string>",
        "secretPath": "<string>"
      }
    }
  ]
}'
{
  "role": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "description": "<string>",
    "slug": "<string>",
    "permissions": [
      {
        "subject": "<string>",
        "action": "<string>",
        "conditions": "<any>",
        "inverted": true
      }
    ],
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "projectId": "<string>",
    "version": 1
  }
}

You can read more about the permissions field in the permissions documentation.

Authorizations

Authorization
string
header
required

An access token in Infisical

Path Parameters

projectSlug
string
required

Slug of the project to create the role for.

Body

application/json
slug
string
required

The slug of the role.

Required string length: 1 - 64
name
string
required

The name of the role.

Minimum length: 1
permissions
object[]
required

The permissions assigned to the role.

description
string | null

The description for the role.

Response

200
application/json
Default Response
role
object
required