Group API

API Requests

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

Create Group Request

Create group request is used to create groups in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter Limit
apiKey API key is used for authenticating API requests
name Name of group 100 chars

Optional Parameters

Parameter
users The usernames of users which will be added to group
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/group' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "name" : "network",
    "users" : ["john.smith@opsgenie.com", "eric.boston@opsgenie.com"]
}'
Response:
{
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "status" : "successful",
    "code" : 200
}

Update Group Request

Update group request is used to update groups in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of group to be updated

Optional Parameters

Parameter Limit
name Name of group 512 chars
users The usernames of users which will be added to group
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/group' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "name" : "network_updated"
}'
Response:
{
    "status" : "successful",
    "code" : 200
}

Group Add Member Request

Add member group request is used to add new users to group in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of group which users will be added to
users The usernames of users which will be added to group

Optional Parameters

Parameter
name Name of group which users will be added to
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/group/member' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "users" : "eric.boston@opsgenie.com"
}'
curl -XPOST 'https://api.opsgenie.com/v1/json/group/member' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "users" : ["eric.boston@opsgenie.com", "john.smith@opsgenie.com"]
}'
curl -XPOST 'https://api.opsgenie.com/v1/json/group/member' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "users" : "eric.boston@opsgenie.com,john.smith@opsgenie.com"
}'
Response:
{
         "status" : "successful",
         "code" : 200
}

Group Remove Member Request

Remove member group request is used to remove users to group in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of group which users will be removed from
name Name of group which users will be removed fro
users The usernames of users which will be removed from group
One of id or name parameters should be specified with remove group member request
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/group/member?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871&users=eric.boston@opsgenie.com'
curl -XDELETE 'https://api.opsgenie.com/v1/json/group/member?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network&users=eric.boston@opsgenie.com,john.smith@opsgenie.com'
Response:
{
         "status" : "successful",
         "code" : 200
}

Delete Group Request

Delete group request is used to delete groups in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of group to be deleted
name Name of group
One of id or name parameters should be specified with delete group request
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/group?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network'
curl -XDELETE 'https://api.opsgenie.com/v1/json/group?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
    "status" : "successful",
    "code" : 200
}

Get Group Request

This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.

Get group request is used to search and retrieve groups in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of group to be retrieved
name Name of group to be retrieved
One of id or name parameters should be specified with get group request.
Sample Request For Group Retrieve
curl -XGET 'https://api.opsgenie.com/v1/json/group?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network'
curl -XGET 'https://api.opsgenie.com/v1/json/group?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "name" : "network",
    "users" : ["john.smith@opsgenie.com", "eric.boston@opsgenie.com"]
}

List Groups Request

This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.

List groups request is used to list groups in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
Sample Request For Group Retrieve
curl -XGET 'https://api.opsgenie.com/v1/json/group?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network'
curl -XGET 'https://api.opsgenie.com/v1/json/group?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
    "groups":[
        {
             "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
             "name" : "network",
             "users" : ["john.smith@opsgenie.com"]
        },
        {
             "id" : "fg463552-dvf2-4ca3-a4315-48fhf5j67875",
             "name" : "database",
             "users" : [eric.boston@opsgenie.com"]
        },
    ]
}