# Update outgoing e-mail

Updates an existing outgoing e-mail integration. Only the parameters you send are changed. Returns the updated integration, or validation errors.

Sending `recipients` replaces the whole recipient list.

[endpoint]
base_url = "https://incidents.betterstack.com"
path = "/api/v2/outgoing-emails/{integration_id}"
method = "PATCH"

[[path_param]]
name = "integration_id"
description = "The ID of the outgoing e-mail integration."
required = true
type = "string"

[[body_param]]
name = "name"
description = "The name of the outgoing e-mail integration that you can see in the dashboard."
required = false
type = "string"

[[body_param]]
name = "recipients"
description = "The addresses that receive incident e-mails. Each entry is either a plain e-mail string, or an object with an `email` key plus your own custom attribute keys. Replaces the whole recipient list when sent. See [Create outgoing e-mail](https://betterstack.com/docs/uptime/api/create-outgoing-email-integration/) for the full shape."
required = false
type = "array"

[[body_param]]
name = "on_incident_started"
description = "Whether to send an e-mail when an incident starts."
required = false
type = "boolean"

[[body_param]]
name = "on_incident_acknowledged"
description = "Whether to send an e-mail when an incident is acknowledged."
required = false
type = "boolean"

[[body_param]]
name = "on_incident_resolved"
description = "Whether to send an e-mail when an incident is resolved."
required = false
type = "boolean"

[[body_param]]
name = "on_incident_reopened"
description = "Whether to send an e-mail when an incident is reopened."
required = false
type = "boolean"

[[body_param]]
name = "on_incident_comment"
description = "Whether to send an e-mail when a new comment is added to an incident. At least one of the `on_incident_*` triggers must stay enabled."
required = false
type = "boolean"

[[body_param]]
name = "notify_alongside_primary_responder"
description = "Whether to notify recipients alongside the primary responder when no escalation policy is configured."
required = false
type = "boolean"

[[body_param]]
name = "templates"
description = "Per-event message templates. See [Create outgoing e-mail](https://betterstack.com/docs/uptime/api/create-outgoing-email-integration/) for the shape, variables, and replace semantics."
required = false
type = "array"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content-Type"
description = "application/json"
required = false
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = '''Returns the updated outgoing e-mail integration'''
body = '''{
  "data": {
    "id": "42",
    "type": "outgoing_email",
    "attributes": {
      "name": "Renamed client list",
      "recipients": [
        { "email": "new@client.com" }
      ],
      "team_name": "My team",
      "paused": false,
      "notify_alongside_primary_responder": true,
      "on_incident_started": true,
      "on_incident_acknowledged": true,
      "on_incident_resolved": true,
      "on_incident_reopened": true,
      "on_incident_comment": true,
      "templates": [
        { "incident_stage": "resolved", "subject": "Resolved: $NAME", "title": null, "body": null }
      ]
    }
  }
}'''

[[response]]
status = 422
description = '''Returns validation errors, for example no recipients or no trigger enabled'''
body = '''{
  "errors": {
    "base": [
      "At least one trigger is required"
    ]
  }
}'''

[/responses]

#### Example cURL

```shell
[label Example]
curl -X "PATCH" "https://incidents.betterstack.com/api/v2/outgoing-emails/42" \
     -H "Authorization: Bearer $TOKEN" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "name": "Renamed client list",
  "recipients": [ "new@client.com" ],
  "templates": [
    { "incident_stage": "resolved", "subject": "Resolved: $NAME" }
  ]
}'
```

[info]
#### Looking for the details of a specific parameter?
Explore [the list of all outgoing e-mail integration API parameters](https://betterstack.com/docs/uptime/api/outgoing-email-integrations-response-params/).
[/info]
