Custom Roles

The Custom Roles API allows you to create, manage, and retrieve custom roles for viewers.


GET/customRoles

List all custom roles

List all custom roles with associated viewers.

Request

GET
/customRoles
curl http://localhost:7472/api/v1/customRoles

Response

[
  {
    "id": "role1",
    "name": "Moderator",
    "viewers": ["viewer1", "viewer2"]
  },
  {
    "id": "role2",
    "name": "VIP",
    "viewers": ["viewer3"]
  }
]

GET/customRoles/:customRoleId

Retrieve a custom role

Fetches a specific custom role by its ID. Returns role details and the list of viewers associated with it.

URL Parameters

  • Name
    customRoleId
    Type
    string
    Description

    The ID of the custom role to retrieve.

Request

GET
/customRoles/:customRoleId
curl http://localhost:7472/api/v1/customRoles/role1

Response

{
  "id": "role1",
  "name": "Moderator",
  "viewers": ["viewer1", "viewer2"]
}

POST/customRoles/:customRoleId/viewer/:userIdOrName

Add user to custom role

Adds a user to a custom role.

URL Parameters

  • Name
    customRoleId
    Type
    string
    Description

    The ID of the custom role to which the user is being added.

  • Name
    userIdOrName
    Type
    string
    Description

    The ID or username of the viewer to be added to the role.

Query Parameters

  • Name
    username
    Type
    boolean
    Description

    Set to "true" if the user should be found by username instead of userId.

Request

POST
/customRoles/:customRoleId/viewer/:userId
curl -X POST http://localhost:7472/api/v1/customRoles/role1/viewer/viewer1?username=true

Response

{
  "status": "success",
  "message": "Viewer added to custom role"
}

DELETE/customRoles/:customRoleId/viewer/:userId

Remove user from custom role

Removes a user from a custom role. You can specify the user by either userId or username via query parameter.

URL Parameters

  • Name
    customRoleId
    Type
    string
    Description

    The ID of the custom role to which the user is being removed from.

  • Name
    userId
    Type
    string
    Description

    The ID of the viewer to be removed from the role.

Query Parameters

  • Name
    username
    Type
    boolean
    Description

    Set to "true" if the user should be found by username instead of userId.

Request

DELETE
/customRoles/:customRoleId/viewer/:userId
curl -X DELETE http://localhost:7472/api/v1/customRoles/role1/viewer/viewer1?username=true

Response

{
  "status": "success",
  "message": "Viewer removed from custom role"
}

DELETE/customRoles/:customRoleId/clear

Remove all viewers from custom role

Removes all viewers from a custom role.

URL Parameters

  • Name
    customRoleId
    Type
    string
    Description

    The ID of the custom role from which all viewers are being removed.

Request

DELETE
/customRoles/:customRoleId/clear
curl -X DELETE http://localhost:7472/api/v1/customRoles/role1/clear

Response

{
  "status": "success",
  "message": "All viewers removed from the custom role"
}