User 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 User Request

Create user request is used to create users in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter Limit
apiKey API key is used for authenticating API requests
username Username of user. It should be email address of user. 100 chars
fullname Full name of user. 512 chars
role Role of user. It may be one of "Owner", Admin", "User" or the name of a custom role you've created. 512 chars

Optional Parameters

Parameter
timezone Timezone information of the user. Please look at Supported Timezone Ids for available timezones.
locale Location information of the user. Please look at Supported Locale Ids for available locales.
skypeUsername Skype user name of the user.
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/user' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "username" : "john.smith@opsgenie.com",
     "fullname" : "John Smith",
     "role" : "Admin",
     "skypeUsername" : "johnSmith"
} '
Response:
{
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "status" : "successful",
     "code" : 200
}

Update User Request

Update user request is used to update users in OpsGenie. It takes the following parameters:

Mandatory Parameters

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

Optional Parameters

Parameter Limit
fullname Full name of user to be updated 512 chars
role Role of user. It may be one of "Owner", "Admin", "User" or the name of a custom role you've created. 512 chars
timezone Timezone of user to be updated
locale Location information of user to be updated
skypeUsername Skype user name of the user.
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/user' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "fullname" : "john"
} '
curl -XPOST 'https://api.opsgenie.com/v1/json/user' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "role" : "User"
} '
curl -XPOST 'https://api.opsgenie.com/v1/json/user' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "skypeUsername" : "johnSmith"
} '
Response:
{
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "status" : "successful",
     "code" : 200
}

Delete User Request

Delete user request is used to delete users in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
id Id of user to be deleted
username Username of user to be deleted
One of id or username parameters should be specified with delete user request
Owner users can be deleted only if there are at least 2 owners for the account
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/user?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&username=john.smith@opsgenie.com'
curl -XDELETE 'https://api.opsgenie.com/v1/json/user?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
     "status" : "successful",
     "code" : 200  
}

Get User 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 user request is used to search and retrieve users in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
Parameter
apiKey API key is used for authenticating API requests
id Id of user to be retrieved
username Username of user to be retrieved
One of id or username parameters should be specified with get user request.
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/user?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&username=john.smith@opsgenie.com'
curl -XGET 'https://api.opsgenie.com/v1/json/user?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
     "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
     "username" : "john.smith@opsgenie.com",
     "fullname" : "John Smith",
     "timezone" : "America/New_York",
     "locale" : "en_US",
     "createdAt": 1472023687693,
     "state" : "active",
     "escalations" : ["support_esc"],
     "skypeUsername" : "johnSmith",
     "schedules" : ["sch_1st"],
     "role" : "Owner",
     "groups" : ["network"],
     "contacts": [
        {
            "to": "john.smith@opsgenie.com",
            "method": "email",
            "disabledReason":"",
            "id":"ce7e52a7-6a0c-4680-a82c-198ddd877756",
            "enabled":true
        },
        {
            "to": "1-9999999999",
            "method": "sms",
            "disabledReason":"",
            "id":"932b9f35-fbaa-4784-8c4b-321d8427a2db",
            "enabled":true
        },
        {
            "to": "1-9999999999",
            "method": "voice",
            "disabledReason":"",
            "id":"b6552417-62cc-4b28-9ef3-9a50f0c8e82b",
            "enabled":false
        },
        {
            "to": "1-8888888888",
            "method": "voice",
            "disabledReason":"",
            "id":"05dd72bd-8457-46ae-b11e-f0ae16fab213",
            "enabled":true
        },
        {
            "to": "1-8888888888",
            "method": "sms",
            "disabledReason":"",
            "id":"431905a1-52fc-453e-b8a2-7daef130fd88",
            "enabled":false
        }
    ]

}

List Users 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 users request is used to list users in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests

Optional Parameters

Parameter Default
sortField Field to use in sorting users. Supported values: username, fullName username
sortOrder Direction of sorting. Supported values: ASC, DESC ASC
limit Number of users to get. Min:1, Max: 100 10
offset Number of users to skip in pagination. 0
Sample Request
curl -XGET 'https://api.opsgenie.com/v1.2/json/user?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&sortOrder=DESC&sortField=fullName&limit=2&offset=1'
Response:
{
    "users":[
        {
             "createdAt": 1482243103632,
             "role": "User",
             "blocked": false,
             "skypeUsername": "",
             "timezone": "Europe/Istanbul",
             "verified": false,
             "id": "1efbae5f-dc44-443e-8476-daf2e0b9165b",
             "fullname": "Kaan",
             "locale": "en_US",
             "username": "tst3@test.com"
        },
        {
             "createdAt": 1482243196741,
             "role": "User",
             "blocked": false,
             "skypeUsername": "",
             "timezone": "Europe/Istanbul",
             "verified": false,
             "id": "d6b85867-3304-46d5-b196-7cd5d91d4956",
             "fullname": "Halit",
             "locale": "en_US",
             "username": "tst7@test.com"
        }
    ]
}

Copy Notification Rules Request

Copy notification rules request is used to copy a user's current notification rules to multiple other users in OpsGenie. It takes the following parameters:

Refer to Can I copy my notification rules to other users? for more information.

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
fromUser Username of the template user. This user's notification rules will be used for copying.
toUsers Specify a list of the users which you want to copy the rules to. You can use the username of a user, the name of a group, or to copy to all users, "all".
ruleTypes Specify a list of the action types you want to copy the rules of. It can contain "New Alert", "Acknowledged Alert" or for all types of notification rules, "all". The total list of valid types are:
  • all
  • New Alert
  • Acknowledged Alert
  • Closed Alert
  • Schedule Start
  • Renotified Alert
  • Assigned Alert
  • Add Note
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/copyNotificationRules' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "fromUser" : "john.smith@opsgenie.com",
    "toUsers" : [
        "group1",
        "andy.doe@opsgenie.com",
        "dave.white@opsgenie.com"
    ]
    "ruleTypes" : [
        "New Alert",
        "Alert Closed"
    ]
} '
                
Response:
{
     "status" : "process started",
     "code" : 200
}