Skip to content

Roles and Permissions

The Roles and Permissions resource provides access to all methods relating to user roles and associated permissions in Keystash.

List Roles

Path: /roles/list

Method: GET

Authentication: Bearer Token

Request Headers

Key Value Required
Accept-Encoding gzip optional

Request Parameters

None.

Request Body

None.

Example Request

curl --location --request GET 'https://app.keystash.io/api/v1/roles/list' \
--header 'Authorization: Bearer <token>'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "JbcmPofORxiJhleu",
    "name": "Team Leader",
    "description": "This role can manage users and server groups assignments but cannot change roles permissions.",
    "created": "2020-05-23 14:00:11",
    "created_user_id": "bkQV8I5BRcAVpgod",
    "created_by": "Max Smith",
    "modified": "2022-04-23 08:15:29",
    "modified_user_id": "bkQV8I5BRcAVpgod",
    "modified_by": "Max Smith",
    "permissions": [
      {
        "id": 1,
        "label": "Dashboard",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      },
      {
        "id": 2,
        "label": "Users",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      },
      {
        "id": 3,
        "label": "Permissions",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      },
      {
        "id": 4,
        "label": "Server Groups",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          },
          {
            "id": "edit_group_users",
            "name": "Edit Group Users",
            "permission": true
          },
          {
            "id": "add_user_groups",
            "name": "Add User Groups",
            "permission": false
          },
          {
            "id": "edit_user_groups",
            "name": "Edit User Groups",
            "permission": false
          },
          {
            "id": "delete_user_groups",
            "name": "Delete User Groups",
            "permission": false
          }
        ]
      },
      {
        "id": 5,
        "label": "SSH Keys",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          },
          {
            "id": "view_user_keys",
            "name": "View Other User Keys",
            "permission": false
          },
          {
            "id": "add_user_keys",
            "name": "Add Other User Keys",
            "permission": false
          },
          {
            "id": "edit_user_keys",
            "name": "Edit Other User Keys",
            "permission": false
          },
          {
            "id": "delete_user_keys",
            "name": "Delete Other User Keys",
            "permission": false
          }
        ]
      },
      {
        "id": 6,
        "label": "Servers",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": false
          },
          {
            "id": "add",
            "name": "Add",
            "permission": false
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": false
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": false
          },
          {
            "id": "export",
            "name": "Export",
            "permission": false
          },
          {
            "id": "deploy",
            "name": "Deploy New Servers",
            "permission": false
          }
        ]
      },
      {
        "id": 7,
        "label": "Account Administration",
        "actions": [
          {
            "id": "view_company",
            "name": "View Company",
            "permission": false
          },
          {
            "id": "edit_company",
            "name": "Edit Company",
            "permission": false
          },
          {
            "id": "edit_billing",
            "name": "Billing",
            "permission": false
          }
        ]
      },
      {
        "id": 8,
        "label": "Audit Logs",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "export",
            "name": "Export",
            "permission": true
          }
        ]
      },
      {
        "id": 9,
        "label": "Deployment Secrets",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": false
          },
          {
            "id": "add",
            "name": "Add",
            "permission": false
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": false
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": false
          }
        ]
      },
      {
        "id": 10,
        "label": "Two Factor Authentication",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": false
          },
          {
            "id": "add",
            "name": "Add",
            "permission": false
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": false
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": false
          }
        ]
      },
      {
        "id": 11,
        "label": "Settings",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      }
    ]
  }
]

Example Error Response

HTTP/1.1 403 Forbidden
Content-Type: application/json; charset=utf-8

{
  "error": "You do not have the required permission to access this path."
}

View Role

Path: /roles/view

Method: GET

Authentication: Bearer Token

Request Headers

Key Value Required
Accept-Encoding gzip optional

Request Parameters

Key Value Required Notes
id JbcmPofORxiJhleu required The ID of the role to view

Request Body

None.

Example Request

curl --location --request GET 'https://app.keystash.io/api/v1/roles/view?id=JbcmPofORxiJhleu' \
--header 'Authorization: Bearer <token>'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "JbcmPofORxiJhleu",
    "name": "Team Leader",
    "description": "This role can manage users and server groups assignments but cannot change roles permissions.",
    "created": "2020-05-23 14:00:11",
    "created_user_id": "bkQV8I5BRcAVpgod",
    "created_by": "Max Smith",
    "modified": "2022-04-23 08:15:29",
    "modified_user_id": "bkQV8I5BRcAVpgod",
    "modified_by": "Max Smith",
    "permissions": [
      {
        "id": 1,
        "label": "Dashboard",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      },
      {
        "id": 2,
        "label": "Users",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      },
      {
        "id": 3,
        "label": "Permissions",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": false
          },
          {
            "id": "add",
            "name": "Add",
            "permission": false
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": false
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": false
          }
        ]
      },
      {
        "id": 4,
        "label": "Server Groups",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          },
          {
            "id": "edit_group_users",
            "name": "Edit Group Users",
            "permission": true
          },
          {
            "id": "add_user_groups",
            "name": "Add User Groups",
            "permission": false
          },
          {
            "id": "edit_user_groups",
            "name": "Edit User Groups",
            "permission": false
          },
          {
            "id": "delete_user_groups",
            "name": "Delete User Groups",
            "permission": false
          }
        ]
      },
      {
        "id": 5,
        "label": "SSH Keys",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          },
          {
            "id": "view_user_keys",
            "name": "View Other User Keys",
            "permission": false
          },
          {
            "id": "add_user_keys",
            "name": "Add Other User Keys",
            "permission": false
          },
          {
            "id": "edit_user_keys",
            "name": "Edit Other User Keys",
            "permission": false
          },
          {
            "id": "delete_user_keys",
            "name": "Delete Other User Keys",
            "permission": false
          }
        ]
      },
      {
        "id": 6,
        "label": "Servers",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          },
          {
            "id": "export",
            "name": "Export",
            "permission": false
          },
          {
            "id": "deploy",
            "name": "Deploy New Servers",
            "permission": false
          }
        ]
      },
      {
        "id": 7,
        "label": "Account Administration",
        "actions": [
          {
            "id": "view_company",
            "name": "View Company",
            "permission": true
          },
          {
            "id": "edit_company",
            "name": "Edit Company",
            "permission": true
          },
          {
            "id": "edit_billing",
            "name": "Billing",
            "permission": true
          }
        ]
      },
      {
        "id": 8,
        "label": "Audit Logs",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "export",
            "name": "Export",
            "permission": true
          }
        ]
      },
      {
        "id": 9,
        "label": "Deployment Secrets",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      },
      {
        "id": 10,
        "label": "Two Factor Authentication",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      },
      {
        "id": 11,
        "label": "Settings",
        "actions": [
          {
            "id": "index",
            "name": "View",
            "permission": true
          },
          {
            "id": "add",
            "name": "Add",
            "permission": true
          },
          {
            "id": "edit",
            "name": "Edit",
            "permission": true
          },
          {
            "id": "delete",
            "name": "Delete",
            "permission": true
          }
        ]
      }
    ]
  }
]

Example Error Response

HTTP/1.1 403 Forbidden
Content-Type: application/json; charset=utf-8

{
  "error": "You do not have the required permission to access this path."
}