User API (Deprecated)

πŸ“˜

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
apiKeyAPI key is used for authenticating API requests
usernameUsername of user. It should be email address of user.100 chars
fullnameFull name of user.512 chars
roleRole of user. It may be one of "Owner", Admin", "User" or the name of a custom role you've created.512 chars

Optional Parameters

timezoneTimezone information of the user. Please look at Supported Timezone IDs for available timezones.
localeLocation information of the user. Please look at Supported Locale IDs for available locales.
skypeUsernameSkype user name of the user.

Sample Request

curl -XPOST 'https://api.opsgenie.com/v1/json/user' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "username" : "[email protected]",
     "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
apiKeyAPI key is used for authenticating API requests
idID of user to be updated

Optional Parameters

fullnameFull name of user to be updated512 chars
roleRole of user. It may be one of "Owner", "Admin", "User" or the name of a custom role you've created.512 chars
timezoneTimezone information of the user. Please look at Supported Timezone IDs for available timezones.
localeLocation information of the user. Please look at Supported Locale IDs for available locales.
skypeUsernameSkype 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
apiKeyAPI key is used for authenticating API request
idID of user to be deleted
usernameUsername 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&[email protected]'
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

apiKeyAPI key is used for authenticating API requests
idId of user to be retrieved
usernameUsername 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&[email protected]'
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" : "[email protected]",
     "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": "[email protected]",
            "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
apiKeyAPI key is used for authenticating API requests

Opstional Parameters

ParameterDefault
sortFieldField to use in sorting users. Supported values: username, fullNameusername
sortOrderDirection of sorting. Supported values: ASC, DESCASC
limitNumber of users to get. Min:1, Max: 10010
offsetNumber 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": "[email protected]"
        },
        {
             "createdAt": 1482243196741,
             "role": "User",
             "blocked": false,
             "skypeUsername": "",
             "timezone": "Europe/Istanbul",
             "verified": false,
             "id": "d6b85867-3304-46d5-b196-7cd5d91d4956",
             "fullname": "Halit",
             "locale": "en_US",
             "username": "[email protected]"
        }
    ]
}

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
apiKeyAPI key is used for authenticating API requests
fromUserUsername of the template user. This user's notification rules will be used for copying.
toUsersSpecify 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".
ruleTypesSpecify 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" : "[email protected]",
    "toUsers" : [
        "group1",
        "[email protected]",
        "[email protected]"
    ]
    "ruleTypes" : [
        "New Alert",
        "Alert Closed"
    ]
} '

Response

{
     "status" : "process started",
     "code" : 200
}