ZapSMTP / Docs / Inbound setupResponse
Update a route
PATCH/v1/inbound/routes/{id}
Update an inbound route (partial; same fields and validation as create).
Requires a full-access live key; test keys get 403 test_key_restricted.
Any subset of the POST /inbound/routes fields. Omitted fields keep their value; webhook_id: "" clears it. The resulting route must still be valid (e.g. action webhook needs webhook_id).
Path parameters
idstring (UUID)required- Route id
Body parameters
namestring- Label (trimmed).
priorityinteger- Lower runs first; first match wins.
match_recipientstring- Glob (case-insensitive, * and ?) e.g. support+*@acme.com, or /regex/ (RE2, case-insensitive). Empty matches all. Limits: max 512 chars; must compile (422 invalid_parameter)
match_senderstring- Same syntax, matched against the envelope sender. Limits: max 512 chars; must compile
match_headerstring- Header name to test.
match_header_valuestring- Glob or /regex/ for that header's value. Limits: max 512 chars; must compile
actionstring- webhook: deliver email.received only to webhook_id; store: keep without webhook; forward: keep and forward to forward_id (a confirmed forward destination); reject: refuse with 550 at SMTP time. Limits: 422 invalid_parameter "action must be webhook, store, reject or forward" One of
webhook,store,forward,reject. webhook_idstring | null- A webhook of this account. Cleared for store/reject. Limits: 422 "webhook_id is required for action webhook" / "webhook_id does not belong to this account"
forward_idstring | null- A confirmed forward destination of this account (action forward). Cleared for other actions. Limits: 422 "forward_id is required for action forward" / "forward_id does not belong to this account" / "... is not confirmed yet"
enabledboolean
Errors
restricted_api_keyHTTP 403test_key_restrictedHTTP 403- test-mode keys can send test email and read, not change the account: use a live key
not_foundHTTP 404- route not found
invalid_parameterHTTP 422
curl -X PATCH 'https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10' \
-H "Authorization: Bearer $ZAP_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"enabled": false
}'const res = await fetch('https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.ZAP_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"enabled": false
}),
});
// 204 No Content (e.g. a delete) has no body
const data = res.status === 204 ? null : await res.json();
if (!res.ok) throw new Error(`${data.name}: ${data.message}`);
console.log(data);import os
import requests
res = requests.patch(
"https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10",
headers={"Authorization": f"Bearer {os.environ['ZAP_API_KEY']}"},
json={
"enabled": False,
},
timeout=30,
)
res.raise_for_status()
print(res.json() if res.status_code != 204 else "deleted")<?php
$ch = curl_init('https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZAP_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'enabled' => false,
]),
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status >= 400) {
throw new RuntimeException($data['message']);
}
print_r($data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"enabled": false
}`)
req, err := http.NewRequest(
"PATCH",
"https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10",
body,
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ZAP_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(out))
}require 'net/http'
require 'json'
uri = URI('https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = "Bearer #{ENV.fetch('ZAP_API_KEY')}"
req['Content-Type'] = 'application/json'
req.body = {
enabled: false
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, (JSON.parse(res.body) unless res.body.to_s.empty?)import java.net.URI;
import java.net.http.*;
public class ZapRequest {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder(URI.create("https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10"))
.header("Authorization", "Bearer " + System.getenv("ZAP_API_KEY"))
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("""
{
"enabled": false
}"""))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Patch, "https://zapsmtp.xyz/v1/inbound/routes/019a1c55-0d6e-7f21-8b3a-5e9d4c7b2a10");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ZAP_API_KEY"));
request.Content = new StringContent("""
{
"enabled": false
}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");Set
ZAP_API_KEY in your environment.Response 200 OK
{
"id": "019a1f31-0b2c-7d3e-8f4a-5b6c7d8e9f01",
"name": "Support tickets",
"priority": 5,
"match_recipient": "support+*@acme.com",
"match_sender": "",
"match_header": "",
"match_header_value": "",
"action": "store",
"webhook_id": null,
"enabled": true,
"created_at": "2026-10-20T12:00:00Z"
}