List transport rules
/api/v1/transport-rulesRequest
/api/v1/transport-rulescurl -X GET 'https://app.mailyte.com/api/v1/transport-rules' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY'const response = await fetch('https://app.mailyte.com/api/v1/transport-rules', {
method: 'GET',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
},
});
const { data } = await response.json();import requests
response = requests.get(
"https://app.mailyte.com/api/v1/transport-rules",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->get('https://app.mailyte.com/api/v1/transport-rules');
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/transport-rules")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataarray<object>objectstringtransport_ruleidstringThe rule's ID, a ULID. Rule IDs are uppercase, such as
01M2RV5CEM4MT97RQ00ANRRFCP; compare them exactly.namestringThe rule's name.
descriptionstringYour note about the rule. Null when there is none.
directionstringinbound | outbound | bothWhich mail the rule checks:
inbound,outboundorboth(the default).enabledbooleanA disabled rule keeps its priority and is not evaluated.
priorityintegerThe order rules run in: lower runs first. The default is 100.
PUT /transport-rules/reorderrenumbers rules in steps of 10, so a rule can be put between two others.matchobjectHow a message is matched:
logicand itsconditions.logicstringall | anyallmeans every condition must match (the default);anymeans one is enough.conditionsarray<object>The conditions, each with
field,operatorandvalue.fieldstringsender | recipient | subject | header | size | has_attachmentWhat is checked.
sizeis the message size in bytes;has_attachmentis true or false.operatorstringequals | contains | starts_with | ends_with | regex | greater_than | less_thanHow
valueis compared withfield.valuestringWhat to compare with. Always a string, even for numbers: a size limit reads back as
"1048576". Parse it yourself forgreater_thanandless_than.
actionsarray<object>What happens to a matched message, in order.
typestringadd_header | modify_subject | redirect | bcc | reject | add_disclaimer | quarantineWhat is done to a message that matches.
paramsobjectThe action's settings, keyed by name. Always an object,
{}when there are none.
created_atstringIn ISO 8601 UTC.
updated_atstringIn ISO 8601 UTC.
Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
401 | The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist. |
403 | The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys. |
404 | No such resource in this organization. |
422 | The request was understood but the values were not acceptable. |
429 | Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait. |
Every status, with what causes it and what to do, is on the error reference.