Update a webhook

PUT/api/v1/webhooks/{webhook}
Requires anorganization API keywith the scopewebhooks:write

Changes only the fields you send; everything you leave out stays as it is.

filters (or targeting) replaces all of the webhook's filters: a list you leave out of it is cleared. Send domain on its own to change just the domain and keep the rest. "filters": null clears every filter, the domain included.

The same rules as create apply: an unknown field, filter key or event name is a 422 that names it, and in an account with more than one domain an update that would leave an email.inbound webhook without a domain is refused. The response's targeting is what is now applied.

Parameters

NameInTypeDescription
webhookrequiredpathstringThe webhook identifier.

Request body

  • namestring

    A name for your team, like Production events.

  • eventsarray<string>

    The events to receive. Each one's payload is in the Receiving webhooks guide.

  • filtersobject

    Optional. Send only some events, by what is in the email. A list matches if any of its words appears (case does not matter); leave a list out to match everything. Other keys are refused with a 422. On update this replaces all the filters; leave it out to keep them.

    • domainstring

      The same as the top-level domain.

    • senderIncludesarray<string>

      Only mail whose sender contains one of these.

    • subjectContainsarray<string>

      Only mail whose subject contains one of these.

    • bodyContainsarray<string>

      Only mail whose body contains one of these.

  • targetingobject

    The same filters, spelt as the response returns them, so you can send back what you read. Send filters or targeting, not both.

    • domainstring

      The same as the top-level domain.

    • sender_includesarray<string>

      As filters.senderIncludes.

    • subject_containsarray<string>

      As filters.subjectContains.

    • body_containsarray<string>

      As filters.bodyContains.

  • domainstring

    Only events for this domain, such as yourdomain.com: one of your domains, exact match. Required with email.inbound when your account has more than one domain. Can also be sent as filters.domain or targeting.domain; this field wins.

  • urlstring

    The full HTTPS address we send to. It must be reachable from the internet.

Request

PUT/api/v1/webhooks/{webhook}
curl -X PUT 'https://app.mailyte.com/api/v1/webhooks/01JBT8XQ2M9WYC3K4F6R7S8T9V' \
  -H 'Authorization: Bearer mk_live_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Production events",
    "events": [
      "email.delivered",
      "email.bounced"
    ]
  }'
The key names its own organization, so no X-Organization-ID header is needed.

Response

Success.

  • dataobject
    • objectstringwebhook
    • idstring

      Unique identifier for the webhook.

    • namestring

      Your name for the webhook.

    • urlstring

      Where we send events. It must be a public HTTPS address.

    • statusstringactive | inactive

      An inactive webhook is skipped by the dispatcher. It is not deleted and keeps its delivery history and its secret.

    • eventsarray<string>

      The events this webhook receives. A name not on this list is refused with a 422. quota.warning is an older name for storage.quota.warning and still works, but do not use it for new webhooks. contact.checked, checks.running_low and checks.ran_out are about your account, not one email, so filters never hold them back; they are sent only while Bounce protection is on.

    • targetingobject

      Which events reach this webhook. A field that is null does not narrow anything.

      • domainstring

        Only events for this domain, exact match (acme.com does not match notacme.com). Null means every domain. Always set on an email.inbound webhook in an account with more than one domain.

      • sender_includesarray<string>

        Any-of substring match on the sender. null = not narrowed.

      • subject_containsarray<string>

        Any-of substring match on the subject. null = not narrowed.

      • body_containsarray<string>

        Any-of substring match on the body. null = not narrowed.

    • deliveriesobject

      The delivery history, grouped so the numbers cannot disagree.

      • succeededinteger

        Lifetime tally of accepted deliveries.

      • failedinteger

        Lifetime tally of failed deliveries.

      • consecutive_failuresinteger

        Resets to zero on any success. This is what drives auto-disable, so it answers a different question from failed.

      • success_ratenumber

        The percentage of deliveries that succeeded, 0 to 100. Null when no delivery has been tried yet; show it as "no deliveries yet", not as 0.

    • last_delivered_atstring

      When a delivery to this webhook last succeeded, in ISO 8601 UTC. Null when none has succeeded yet; check deliveries to see whether any were tried.

    • created_atstring

      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.