Team Role API

🚧

If using the EU instance of Opsgenie, the URL needs to be https://api.eu.opsgenie.com for requests to be successful.

General Information

📘

Create an API Integration and obtain your apiKey to make requests listed above. Please make sure that the integration is not restricted to access configurations.

📘

All requests of Team Role API work under Team domain. It means that; If you are using apiKey belongs to a team integration, that team must allowed to access given team. Otherwise, we would respond with 403 - Forbidden (Unauthorized) with 40301 internal code (Response)

Create Team Role

Create team role request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management

In-Line Parameters

Referred NameDescription
teamIdentifierIdentifier of the team

Query Parameters

ParameterMandatoryDescription
teamIdentifierTypefalseType of the team identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id

JSON Body Fields

FieldsMandatoryDescription
nametrueName of the defined team role
rightstrueYou can refer Team Right for detailed information about team right and its fields

rights field example:

"rights": [
  {
    "right":"manage-members", 
    "granted":true
  }
]
"rights": [
  {
    "right":"edit-team-roles", 
    "granted":false
  }
]

Sample Request

curl -X POST  'https://api.opsgenie.com/v2/teams/TeamName/roles?teamIdentifierType=name'
	--header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
  	--header 'Content-Type: application/json'
  	--data
'{
  "name": "TeamRoleName",
  "rights": [
    {"right":"manage-members", "granted":true},
    {"right":"edit-team-roles", "granted":true}
  ]
}'

Response

{
  "result":"Created",
  "data":{
    "id":"dbe375e3-b7d4-4e18-balp-8c47fd4de27a",
    "name":"TeamRoleName"
  },
  "took":0.118,
  "requestId":"23cefb5d-6475-47e0-alp9-b8481653ce6e"
}

Get Team Role

In-Line Parameters

Referred NameDescription
teamIdentifierIdentifier of the team
identifierIdentifier of the team role

Query Parameters

ParameterMandatoryDescription
teamIdentifierTypefalseType of the team identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id
identifierTypefalseType of the team role identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id

Sample Request

curl -X GET  'https://api.opsgenie.com/v2/teams/TeamName/roles/dbe375e3-b7d4-4e18-balp-8c47fd4de27a?teamIdentifierType=name'
		--header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'

Response

{
  "data":{
    "id":"dbe375e3-b7d4-4e18-balp-8c47fd4de27a",
    "name":"TeamRoleName",
    "rights":[
      {"right":"access-member-profiles","granted":false},
      {"right":"access-reports","granted":false},
      {"right":"delete-escalations","granted":false},
      {"right":"delete-heartbeats","granted":false},
      {"right":"delete-integrations","granted":false},
      {"right":"delete-mass-templates","granted":false},
      {"right":"delete-rooms","granted":false},
      {"right":"delete-routing-rules","granted":false},
      {"right":"delete-schedules","granted":false},
      {"right":"delete-services","granted":false},
      {"right":"delete-team-roles","granted":false},
      {"right":"edit-escalations","granted":false},
      {"right":"edit-heartbeats","granted":false},
      {"right":"edit-integrations","granted":false},
      {"right":"edit-mass-templates","granted":false},
      {"right":"edit-member-profiles","granted":false},
      {"right":"edit-rooms","granted":false},
      {"right":"edit-routing-rules","granted":false},
      {"right":"edit-schedules","granted":false},
      {"right":"edit-services","granted":false},
      {"right":"edit-team-roles","granted":true},
      {"right":"manage-members","granted":true}
    ]
  },
  "took":0.023,
  "requestId":"8alp66db-a250-4f5b-baa4-3765028954e3"
}

Update Team Role(Partial)

Update team role request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management

In-Line Parameters

Referred NameDescription
teamIdentifierIdentifier of the team
identifierIdentifier of the team role

Query Parameters

ParameterMandatoryDescription
teamIdentifierTypefalseType of the team identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id
identifierTypefalseType of the team role identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id

JSON Body Field

FieldsMandatoryDescription
namefalseName of the team role
rightsfalseYou can refer Team Right for detailed information about team right and its fields

📘

Only the given team rights will be updated and the others will remain the same.

rights field example:

"rights": [
  {
    "right":"manage-members", 
    "granted":true
  }
]
"rights": [
  {
    "right":"edit-team-roles", 
    "granted":false
  }
]

Sample Request

curl -X PATCH 'https://api.opsgenie.com/v2/teams/TeamName/roles/dbe375e3-b7d4-4e18-balp-8c47fd4de27a?teamIdentifierType=name'
	--header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
  	--header 'Content-Type: application/json'
  	--data
'{
    "name": "UpdatedTeamRoleName",
    "rights": [
      {"right":"edit-routing-rules", "granted":true},
      {"right":"edit-team-roles", "granted":false}
    ]
}'

Response

{
  "result":"Updated",
  "data":{
    "id":"dbe375e3-b7d4-4e18-balp-8c47fd4de27a",
    "name":"UpdatedTeamRoleName"
  },
  "took":0.103,
  "requestId":"8b8debbc-e1a4-4ac2-a27b-7bc2f6alpc06"
}

Delete Team Role

Delete team role request is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management

In-Line Parameters

Referred NameDescription
teamIdentifierIdentifier of the team
identifierIdentifier of the team role

Query Parameters

ParameterMandatoryDescription
teamIdentifierTypefalseType of the team identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id
identifierTypefalseType of the team role identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id

Sample Request

curl -X DELETE 'https://api.opsgenie.com/v2/teams/TeamName/roles/dbe375e3-b7d4-4e18-balp-8c47fd4de27a?teamIdentifierType=name'
 		--header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'

Response

{
  "result":"Deleted",
  "took":0.029,
  "requestId":"eec8d515-alpb-47c2-8f64-54f555162658"
}

List Team Roles

In-Line Parameters

Referred NameDescription
teamIdentifierIdentifier of the team

Query Parameters

ParameterMandatoryDescription
teamIdentifierTypefalseType of the team identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/teams/TeamName/roles?teamIdentifierType=name'
    --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'

Response

{
  "data":[
    {
      "id":"27alpc95-8982-435c-b91d-bebe4f833b50",
      "name":"TeamRoleName2",
      "rights":[
        {"right":"access-member-profiles","granted":false},
        {"right":"access-reports","granted":false},
        {"right":"delete-escalations","granted":true},
        {"right":"delete-heartbeats","granted":false},
        {"right":"delete-integrations","granted":false},
        {"right":"delete-mass-templates","granted":false},
        {"right":"delete-rooms","granted":false},
        {"right":"delete-routing-rules","granted":false},
        {"right":"delete-schedules","granted":false},
        {"right":"delete-services","granted":false},
        {"right":"delete-team-roles","granted":false},
        {"right":"edit-escalations","granted":true},
        {"right":"edit-heartbeats","granted":false},
        {"right":"edit-integrations","granted":false},
        {"right":"edit-mass-templates","granted":false},
        {"right":"edit-member-profiles","granted":false},
        {"right":"edit-rooms","granted":false},
        {"right":"edit-routing-rules","granted":false},
        {"right":"edit-schedules","granted":false},
        {"right":"edit-services","granted":false},
        {"right":"edit-team-roles","granted":false},
        {"right":"manage-members","granted":false}
      ]
    },
    {
      "id":"dbe375e3-b7d4-4e18-balp-8c47fd4de27a",
      "name":"UpdatedTeamRoleName",
      "rights":[
        {"right":"access-member-profiles","granted":false},
        {"right":"access-reports","granted":false},
        {"right":"delete-escalations","granted":false},
        {"right":"delete-heartbeats","granted":false},
        {"right":"delete-integrations","granted":false},
        {"right":"delete-mass-templates","granted":false},
        {"right":"delete-rooms","granted":false},
        {"right":"delete-routing-rules","granted":false},
        {"right":"delete-schedules","granted":false},
        {"right":"delete-services","granted":false},
        {"right":"delete-team-roles","granted":false},
        {"right":"edit-escalations","granted":false},
        {"right":"edit-heartbeats","granted":false},
        {"right":"edit-integrations","granted":false},
        {"right":"edit-mass-templates","granted":false},
        {"right":"edit-member-profiles","granted":false},
        {"right":"edit-rooms","granted":false},
        {"right":"edit-routing-rules","granted":true},
        {"right":"edit-schedules","granted":false},
        {"right":"edit-services","granted":false},
        {"right":"edit-team-roles","granted":false},
        {"right":"manage-members","granted":true}
      ]
    }
  ],
  "took":0.05,
  "requestId":"f6alp3f0-40bc-4c51-a824-59938591b835"
}

Team Right Fields

Defines the rights that will be assigned to a team role.

JSON Body Fields

FieldsMandatoryDescription
righttrueName of the right will be assigned to a team role. Should be one of
manage-members,
edit-team-roles,
delete-team-roles,
access-member-profiles,
edit-member-profiles,
edit-routing-rules,
delete-routing-rules,
edit-escalations,
delete-escalations,
edit-schedules,
delete-schedules,
edit-integrations,
delete-integrations,
edit-heartbeats,
delete-heartbeats,
access-reports,
edit-services,
delete-services,
edit-mass-templates,
delete-mass-templates,
edit-rooms,
delete-rooms,
send-service-status-update
grantedfalseDescribes if a right is granted to a team role or not. Should be either true or false. The default value is false.

📘

Some team rights require other team rights to be granted. In other words, some team rights are prerequisites for other team rights to be assigned. The detailed schema could be found in Team Right Prerequisite

rights field example:

"rights": [
    {
      "right":"manage-members", 
      "granted":true
    }
]
"rights": [
    {
      "right":"edit-team-roles", 
      "granted":false
    }
]

Team Right Prerequisites

The table below shows rights to be granted and the required rights needed to be granted as well.

RightPrerequisite
manage-members-
edit-team-rolesmanage-members
delete-team-rolesedit-team-roles
access-member-profiles-
edit-member-profilesaccess-member-profiles
edit-routing-rules-
delete-routing-rulesedit-routing-rules
edit-escalations-
delete-escalationsedit-escalations
edit-schedules-
delete-schedulesedit-schedules
edit-integrations-
delete-integrationsedit-integrations
edit-heartbeats-
delete-heartbeatsedit-heartbeats
access-reports-
edit-services-
delete-servicesedit-services
edit-mass-templates-
delete-mass-templatesedit-mass-templates
edit-rooms-
delete-roomsedit-rooms
send-service-status-update-