Skip to main content
PUT
/
automations
/
{id}
Update automation
curl --request PUT \
  --url https://mailcare.io/api/teams/{teamId}/automations/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/vnd.mailcare.v1+json' \
  --data '
{
  "title": "Save pdf invoices",
  "sender": "shop@example.com",
  "inbox": "claire@example.com",
  "subject": "New invoice",
  "has_attachments": true,
  "action_url": "https://example.com/webhooks/save-pdf-invoices",
  "action_secret_token": "SECRET12345$",
  "notification_email": "ops@example.com",
  "action_delete_email": true,
  "disabled": false,
  "payload_format": "json"
}
'
import requests

url = "https://mailcare.io/api/teams/{teamId}/automations/{id}"

payload = {
"title": "Save pdf invoices",
"sender": "shop@example.com",
"inbox": "claire@example.com",
"subject": "New invoice",
"has_attachments": True,
"action_url": "https://example.com/webhooks/save-pdf-invoices",
"action_secret_token": "SECRET12345$",
"notification_email": "ops@example.com",
"action_delete_email": True,
"disabled": False,
"payload_format": "json"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.mailcare.v1+json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/vnd.mailcare.v1+json'
},
body: JSON.stringify({
title: 'Save pdf invoices',
sender: 'shop@example.com',
inbox: 'claire@example.com',
subject: 'New invoice',
has_attachments: true,
action_url: 'https://example.com/webhooks/save-pdf-invoices',
action_secret_token: 'SECRET12345$',
notification_email: 'ops@example.com',
action_delete_email: true,
disabled: false,
payload_format: 'json'
})
};

fetch('https://mailcare.io/api/teams/{teamId}/automations/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://mailcare.io/api/teams/{teamId}/automations/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'Save pdf invoices',
'sender' => 'shop@example.com',
'inbox' => 'claire@example.com',
'subject' => 'New invoice',
'has_attachments' => true,
'action_url' => 'https://example.com/webhooks/save-pdf-invoices',
'action_secret_token' => 'SECRET12345$',
'notification_email' => 'ops@example.com',
'action_delete_email' => true,
'disabled' => false,
'payload_format' => 'json'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.mailcare.v1+json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://mailcare.io/api/teams/{teamId}/automations/{id}"

payload := strings.NewReader("{\n \"title\": \"Save pdf invoices\",\n \"sender\": \"shop@example.com\",\n \"inbox\": \"claire@example.com\",\n \"subject\": \"New invoice\",\n \"has_attachments\": true,\n \"action_url\": \"https://example.com/webhooks/save-pdf-invoices\",\n \"action_secret_token\": \"SECRET12345$\",\n \"notification_email\": \"ops@example.com\",\n \"action_delete_email\": true,\n \"disabled\": false,\n \"payload_format\": \"json\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/vnd.mailcare.v1+json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://mailcare.io/api/teams/{teamId}/automations/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.mailcare.v1+json")
.body("{\n \"title\": \"Save pdf invoices\",\n \"sender\": \"shop@example.com\",\n \"inbox\": \"claire@example.com\",\n \"subject\": \"New invoice\",\n \"has_attachments\": true,\n \"action_url\": \"https://example.com/webhooks/save-pdf-invoices\",\n \"action_secret_token\": \"SECRET12345$\",\n \"notification_email\": \"ops@example.com\",\n \"action_delete_email\": true,\n \"disabled\": false,\n \"payload_format\": \"json\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://mailcare.io/api/teams/{teamId}/automations/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/vnd.mailcare.v1+json'
request.body = "{\n \"title\": \"Save pdf invoices\",\n \"sender\": \"shop@example.com\",\n \"inbox\": \"claire@example.com\",\n \"subject\": \"New invoice\",\n \"has_attachments\": true,\n \"action_url\": \"https://example.com/webhooks/save-pdf-invoices\",\n \"action_secret_token\": \"SECRET12345$\",\n \"notification_email\": \"ops@example.com\",\n \"action_delete_email\": true,\n \"disabled\": false,\n \"payload_format\": \"json\"\n}"

response = http.request(request)
puts response.read_body

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

The unique identifier of the automation to update.

Body

application/vnd.mailcare.v1+json
title
string
required

Title of the automation

Example:

"Save pdf invoices"

sender
string<email>

Sender that should match (optional)

Example:

"shop@example.com"

inbox
string<email>

Inbox that should match (optional)

Example:

"claire@example.com"

subject
string

Subject that should match (optional)

Example:

"New invoice"

has_attachments
boolean

Email should have at least one attachment (optional)

Example:

true

action_url
string<uri>

URL that will be called (optional)

Example:

"https://example.com/webhooks/save-pdf-invoices"

action_secret_token
string

Use this token to validate received payloads (optional)

Example:

"SECRET12345$"

notification_email
string<email> | null

Email address to notify on webhook failures (optional). If empty, no notification is sent. At most one notification is sent per automation per UTC day.

Example:

"ops@example.com"

action_delete_email
boolean

Email should be deleted after processing (optional)

Example:

true

disabled
boolean

Disable this automation without deleting it (optional)

Example:

false

payload_format
enum<string>

Payload format to use (optional)

Available options:
json,
raw,
json_with_bodies
Example:

"json"

Response

Automation successfully updated.