Create a email suppression
/api/v1/email-suppressionsRequest
/api/v1/email-suppressionscurl -X POST 'https://app.mailyte.com/api/v1/email-suppressions' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY'const response = await fetch('https://app.mailyte.com/api/v1/email-suppressions', {
method: 'POST',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
},
});
const { data } = await response.json();import requests
response = requests.post(
"https://app.mailyte.com/api/v1/email-suppressions",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->post('https://app.mailyte.com/api/v1/email-suppressions');
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/email-suppressions")
request = Net::HTTP::Post.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.
dataobjectobjectstringsuppressionidstringemailstringThe address, or -- when `scope` is `domain` -- the bare domain. Always lower-cased: the send-time check normalises, and a mixed-case row would never match it.
scopestringaddress | domainA `domain` rule blocks every recipient at that EXACT domain. Subdomains are separate rules, matching SendGrid and Mailgun, so a rule never blocks more than the string somebody typed.
applies_tostringall | marketingWhich traffic this suppression stops, and a DIFFERENT axis from `scope`. `all` stops everything including transactional mail; `marketing` stops campaigns and leaves receipts, password resets and other transactional mail alone. Derived from `reason`: an unsubscribe is `marketing`, because withdrawing consent to be marketed to has never meant refusing a password reset; a bounce or a complaint is `all`, because a dead or hostile address is a problem for every kind of mail. NOT nullable -- the column is NOT NULL and defaults to `all`, so an unclassified suppression stops everything rather than silently stopping less.
reasonstringWhy this address is blocked. `POST /email-suppressions` accepts only `unsubscribed`, `complained`, `bounced` or `manual`, but this field is NOT closed: `POST /email-suppressions/import` takes any string up to 30 characters and defaults to the literal `import`, so imported rows carry values the single-add endpoint would reject. Do not switch on it exhaustively.
sourcestringmanual | automatic`manual` is a person or your API call; `automatic` is our bounce and complaint listener. A manual entry is never downgraded to automatic by a later event.
notestringYour own free text. NULL MEANS NONE -- no note was supplied when the row was written -- and that is the usual case, because only a person adding an entry by hand tends to write one. Nothing we do fills this in: an address suppressed automatically by the bounce and complaint listener has no note and never will, and `reason` is where the machine explanation lives.
suppressed_atstringWhen the address was suppressed, and the ONLY date published here. `created_at`/`updated_at` made three dates for one event and they disagreed -- `updated_at` moves when a later bounce refreshes the row. NULL MEANS UNKNOWN: the column was added after this table already had rows, and although the migration backfilled every one of them from `created_at`, the column is nullable and nothing constrains a future writer to fill it. It never means "not suppressed" -- the row existing is what suppresses the address, and a null date does not soften that. Sort on it defensively.
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.