TeamCity REST API Reference 2023.05 Help

Manage Roles and Permissions

This article explains how to manage TeamCity roles and permissions via REST API.

Browse All Roles

Send the following request to browse roles:


The response is the Roles object that contains Role instances.

If you need to obtain all existing roles and view their parent-child relationships, use the following request:


One specific role can be obtained using the role ID:


Add and Remove Roles

To create a new role, send the POST request with a Role object as a body to the /app/rest/roles endpoint. Sample payload (XML):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <role name="New Role 2"> <included><role id="PROJECT_VIEWER" name="Project viewer"/></included> <permissions> <permission id="customize_build_parameters" global="false"/> </permissions> </role>

To remove a role, send the DELETE request to the /app/rest/roles/id:id endpoint:


Add and Remove Individual Permissions

To add and remove permissions, you need their IDs. You can browse permissions of the system administrator role to view all avialable permissions and their IDs:


Then you can use these IDs to add and remove permissions to/from existing roles:


Add and Remove Included Roles

Instead of adding individual permissions one-by-one, you can add include group A into the included parameter of group B. As a result, all permissions available for group A will also be available for group B.

Last modified: 04 May 2023