Delete Alert Recipient

Last modified on March 25, 2021

To delete an alert recipient, send a DELETE request to /recipients/{id}, where {id} is the recipient ID. Alerts will no longer be sent to this recipient, but the information about past alerts remains in the Alert Log.

Tip: Before deleting a recipient, call GET /notifier-groups?recipient_id={id} to check if there are any recipient groups that use this recipient. If this is the only recipient in some groups, you might want to also delete those groups or add some other recipients to those groups instead.

Request URL

DELETE https://api.alertsite.com/api/v3/recipients/{id}

Authentication

The request must include the Authorization header containing a user’s access token:

Authorization: Bearer ACCESS_TOKEN

See Authentication for more information.

Response body

On success, the operation returns HTTP status 204 without a request body.

Error responses have a non-204 status code and include the errors list:

{
  "errors": [
    {
      "code": 404,
      "message": "Record not found"
    }
  ]
}

Try it out

Click here to test this operation in AlertSite’s interactive API console.

Code examples

Delete the recipient with ID 123456:

cURL

curl -X DELETE https://api.alertsite.com/api/v3/recipients/123456 -H "Authorization: Bearer ACCESS_TOKEN"

Python

# Python 3.5+
import requests  # Requests library http://docs.python-requests.org
import json

baseUrl = 'https://api.alertsite.com/api/v3'
username = 'demo@example.com'  # Replace with your AlertSite login email
password = 'pa55w0rd'          # Replace with your AlertSite password
recipient_id = 123456

# Log in
payload = {'username': username, 'password': password}
r = requests.post(baseUrl + '/access-tokens', data=json.dumps(payload), headers={'Content-Type': 'application/json'})
token = r.json()['access_token']

# Delete the recipient
r = requests.delete(baseUrl + '/recipients/{}'.format(recipient_id), headers={'Authorization': 'Bearer ' + token})
if r.ok:
  print('Recipient {} has been deleted.'.format(recipient_id))
else:
  print('Could not delete recipient {}. The following error(s) occurred:'.format(recipient_id), *r.json()['errors'], sep='\n')

See Also

Alert Recipient Operations

Highlight search results