Enable a transport rule

PUT/api/v1/transport-rules/{id}/enable
Requires anorganization API keywith the scopetransport_rules:write

Parameters

NameInTypeDescription
idrequiredpathstringThe id identifier.

Request body

  • enabledbooleanrequired

    true turns the rule on, false off.

Request

PUT/api/v1/transport-rules/{id}/enable
curl -X PUT 'https://app.mailyte.com/api/v1/transport-rules/01JBT8XQ2M9WYC3K4F6R7S8T9V/enable' \
  -H 'Authorization: Bearer mk_live_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "enabled": true
  }'
The key names its own organization, so no X-Organization-ID header is needed.

Response

Success.

  • dataobject
    • objectstringtransport_rule
    • idstring

      The rule's ID, a ULID. Rule IDs are uppercase, such as 01M2RV5CEM4MT97RQ00ANRRFCP; compare them exactly.

    • namestring

      The rule's name.

    • descriptionstring

      Your note about the rule. Null when there is none.

    • directionstringinbound | outbound | both

      Which mail the rule checks: inbound, outbound or both (the default).

    • enabledboolean

      A disabled rule keeps its priority and is not evaluated.

    • priorityinteger

      The order rules run in: lower runs first. The default is 100. PUT /transport-rules/reorder renumbers rules in steps of 10, so a rule can be put between two others.

    • matchobject

      How a message is matched: logic and its conditions.

      • logicstringall | any

        all means every condition must match (the default); any means one is enough.

      • conditionsarray<object>

        The conditions, each with field, operator and value.

        • fieldstringsender | recipient | subject | header | size | has_attachment

          What is checked. size is the message size in bytes; has_attachment is true or false.

        • operatorstringequals | contains | starts_with | ends_with | regex | greater_than | less_than

          How value is compared with field.

        • valuestring

          What to compare with. Always a string, even for numbers: a size limit reads back as "1048576". Parse it yourself for greater_than and less_than.

    • actionsarray<object>

      What happens to a matched message, in order.

      • typestringadd_header | modify_subject | redirect | bcc | reject | add_disclaimer | quarantine

        What is done to a message that matches.

      • paramsobject

        The action's settings, keyed by name. Always an object, {} when there are none.

    • created_atstring

      In ISO 8601 UTC.

    • updated_atstring

      In ISO 8601 UTC.

Returned inside the standard envelope.

Errors

StatusWhen
401The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist.
403The 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.
404No such resource in this organization.
422The request was understood but the values were not acceptable.
429Too 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.