Skip to main content
POST
/
api
/
v1
/
roles
/
Python (SDK)
import os
from syllable_sdk import SyllableSDK


with SyllableSDK(
    api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:

    res = ss_client.roles.create(request={
        "name": "Prompt Engineer",
        "description": "Role for users who can fetch and change prompts",
        "permissions": [
            "prompts_read",
            "prompts_write",
            "prompts_delete",
        ],
    })

    # Handle response
    print(res)
{
  "name": "Prompt Engineer",
  "description": "Role for users who can fetch and change prompts",
  "permissions": [
    "prompts_read",
    "prompts_write",
    "prompts_delete"
  ],
  "id": 1,
  "last_updated_comments": "Updated to add delete permission",
  "is_system_role": false,
  "last_updated": "2023-11-07T05:31:56Z",
  "last_updated_by": "user@email.com"
}

Authorizations

Syllable-API-Key
string
header
required

Body

application/json

Request model to create a role.

name
string
required

The name of the role.

Examples:

"Prompt Engineer"

permissions
string[]
required

The permissions associated with the role. Available permissions can be found by calling GET /permissions.

Examples:
[
"prompts_read",
"prompts_write",
"prompts_delete"
]
description
string | null

The description of the role.

Examples:

"Role for users who can fetch and change prompts"

Response

Successful Response

Information about a role.

name
string
required

The name of the role.

Examples:

"Prompt Engineer"

permissions
string[]
required

The permissions associated with the role. Available permissions can be found by calling GET /permissions.

Examples:
[
"prompts_read",
"prompts_write",
"prompts_delete"
]
id
integer
required

The internal ID of the role.

Examples:

1

is_system_role
boolean
required

Whether this is a built-in system role that cannot be updated or deleted

Examples:

false

last_updated
string<date-time>
required

The timestamp of the most recent update to the role

last_updated_by
string
required

The email of the user who last updated the role

Examples:

"user@email.com"

description
string | null

The description of the role.

Examples:

"Role for users who can fetch and change prompts"

last_updated_comments
string | null

Comments for the most recent edit to the role.

Examples:

"Updated to add delete permission"

I