Team Member 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 Member 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)

Add Team Member

Add team member 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
usertrueMember identifier of the team, consisting id and/or username
rolefalseMember role of the user, consisting user and admin. Default value is user

Sample Request

curl -X POST  'https://api.opsgenie.com/v2/teams/TeamName/members?teamIdentifierType=name'
    --header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    --header 'Content-Type: application/json'
    --data
'{
    "user": {
        "username": "[email protected]",
    },
    "role": "admin"
}'
curl -X POST  'https://api.opsgenie.com/v2/teams/c569c016-alpc-4e20-8a28-bd5dc33b798e/members'
    --header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    --header 'Content-Type: application/json'
    --data
'{
    "user": {
        "id": "balp7783-a9f1-40e3-940c-ffde45656054"
    }
}'

Response:

{
    "result": "Added",
    "data": {
        "id": "c569c016-alpc-4e20-8a28-bd5dc33b798e",
        "name": "TeamName"
    },
    "took": 3.67,
    "requestId": "e413alpf-c183-4982-ab82-b34d77cfafc6"
}

Remove Team Member

Remove team member 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
memberIdentifierUser id or username of member for removal

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 DELETE 'https://api.opsgenie.com/v2/teams/TeamName/members/[email protected]?teamIdentifierType=name'
    --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'

Response:

{
    "result": "Removed",
    "data": {
        "id": "c569c016-alpc-4e20-8a28-bd5dc33b798e",
        "name": "TeamName"
    },
    "took": 1.024,
    "requestId": "d83c646e-87b3-40d8-alp4-03c06dd62444"
}