🚧

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

General Information

Domains

📘

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.

Create Team

Create team 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

📘

This request is not allowed for apiKey belonging to a team integration.

JSON Body Fields

FieldsMandatoryDescriptionLimit
nametrueName of the team100 chars
descriptionfalseThe description of team10000 chars
membersfalseThe users which will be added to team, and optionally their roles. You can refer Team Members for detailed information about members and their fields

Sample Requests

curl -X POST  'https://api.opsgenie.com/v2/teams'
    --header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
    --header 'Content-Type: application/json'
    --data
'{
    "name": "TeamName",
    "description": "Team Description",
    "members": [
        {
            "user": {
                "username": "[email protected]"
            },
            "role": "admin"
        },
        {
            "user": {
                "id": "00564944-b42f-4b95-a882-ee9a5alpb9bb"
            }
        },
        {
            "user": {
                "username": "[email protected]",
                "id": "1f2alp91-bca3-4ae2-bdea-b02e94d10953"
            },
            "role": "user"
        }
    ]
}'

Response:

{
    "result": "Created",
    "data": {
        "id": "a30b5c45-6alp-422f-9d41-67b10a67282a",
        "name": "TeamName"
    },
    "took": 1.443,
    "requestId": "ac8d85d8-f13a-45c4-965b-3a8alpb9f988"
}

Get Team

In-Line Parameters

Referred NameDescription
identifierIdentifier of the team

Query Parameters

ParameterMandatoryDescription
identifierTypefalseType of the 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?identifierType=name'
    --header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'

Response:

{
    "data": {
        "id": "a30alp45-65bf-422f-9d41-67b10a67282a",
        "name": "TeamName",
        "description": "Team Description",
        "members": [
            {
                "user": {
                    "id": "a9514028-2bca-4510-a51f-4b65f2c33alp",
                    "username": "[email protected]"
                },
                "role": "admin"
            },
            {
                "user": {
                    "id": "00564944-b42f-4b95-a882-ee9a5aalp9bb",
                    "username": "[email protected]"
                },
                "role": "user"
            },
            {
                "user": {
                    "id": "1f281991-bca3-4ae2-bdea-b02e94dalp53",
                    "username": "[email protected]"
                },
                "role": "user"
            }
        ]
    },
    "took": 0.021,
    "requestId": "36d5c8c5-alpf-47b2-9964-9fd435e5e306"
}

Update Team (Partial)

Update team 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
teamIdId of the team

JSON Body Fields

FieldsMandatoryDescriptionLimit
namefalseThe name of team100 chars
descriptionfalseThe description of team10000 chars
membersfalseThe users which will be added to team, and optionally their roles. You can refer Team Members for detailed information about members and their fields

Sample Request

curl -X PATCH 'https://api.opsgenie.com/v2/teams/a30alp45-65bf-422f-9d41-67b10a67282a'
    --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
    --header 'Content-Type: application/json'
    -data
'{
    "description" : "Updated Description",
    "members": [
        {
            "user": {
                "username": "[email protected]",
            },
            "role": "admin"
        },
        {
            "user": {
                "username": "[email protected]",
            }
        }
    ]
}'

📘

This request changes team members to given list above. In other words, It is not append them as new members.

Response:

{
    "result": "Updated",
    "data": {
        "id": "a30alp45-65bf-422f-9d41-67b10a67282a",
        "name": "TeamName"
    },
    "took": 0.369,
    "requestId": "be211alp-fef0-4698-bab6-d99ab4f8b5be"
}

Delete Team

📘

This request is not allowed for apiKey belonging to a team integration.

Delete team 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
identifierIdentifier of the team

Query Parameters

ParameterMandatoryDescription
identifierTypefalseType of the 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?identifierType=name'
    --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'

Response:

{
    "result": "Deleted",
    "took": 0.229,
    "requestId": "0367a2e8-3b9f-4f00-acf0-alp1df5489f0"
}

List Teams

Sample Request

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

📘

List teams request is not affected by the number of teams you are calling. You will receive all the teams on your account, without pagination.

Response:

{
    "data": [
        {
            "id": "90098alp9-f0e3-41d3-a060-0ea895027630",
            "name": "ops_team",
            "description": ""
        },
        {
            "id": "a30alp45-65bf-422f-9d41-67b10a67282a",
            "name": "TeamName2",
            "description": "Description"
        },
        {
            "id": "c569c016-alp9-4e20-8a28-bd5dc33b798e",
            "name": "TeamName",
            "description": ""
        }
    ],
    "took": 1.08,
    "requestId": "9cbfalp7-53f5-41ef-a360-be01277a903d"
}

List Team Logs

In-Line Parameters

Referred NameDescription
identifierIdentifier of the team

Query Parameters

ParameterMandatoryDescription
identifierTypefalseType of the identifier that is provided as an in-line parameter. Possible values are id and name . Default value is id
limitfalseMaximum number of items to provide in the result. Must be a positive integer value. Default value is 20 and maximum is 100
orderfalseSorting order of the result set. Possible values are desc and asc. Default value is desc
offsetfalseKey which will be used in pagination

Sample Requests

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

Response:

{
    "data": {
        "offset": "1495523940765000268",
        "logs": [
            {
                "owner": "System",
                "createdDate": "2017-05-23T07:45:51.56Z",
                "log": "Updated members."
            },
            {
                "owner": "System",
                "createdDate": "2017-05-23T07:19:00.765Z",
                "log": "Created team \"TeamName\"."
            }
        ]
    },
    "took": 0.041,
    "requestId": "1cee4c3e-a573-48b0-bef5-alpbfb03da63"
}

Team Member Fields

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

user field example:

{
    "user": {
        "id": "b3578948-55b3-4acc-9bf1-2ce2db3alpa2"
    }
}
{
    "user": {
        "username": "[email protected]"
    }
}

Updated 6 months ago


Team API


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.