Send a test
/api/v1/campaigns/{campaign}/test-sendSends the campaign to addresses you name, so you can see it as a recipient would. Does not touch the audience and does not count against the campaign report.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
campaignrequired | path | string | The campaign identifier. |
Request body
emailsarray<string>requiredWhere to send the test: 1 to 5 addresses.
{{ tags }}are filled with sample values.
Request
/api/v1/campaigns/{campaign}/test-sendcurl -X POST 'https://app.mailyte.com/api/v1/campaigns/01JBT8XQ2M9WYC3K4F6R7S8T9V/test-send' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"emails": [
"you@yourdomain.com"
]
}'const response = await fetch('https://app.mailyte.com/api/v1/campaigns/01JBT8XQ2M9WYC3K4F6R7S8T9V/test-send', {
method: 'POST',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"emails": [
"you@yourdomain.com"
]
}),
});
const { data } = await response.json();import requests
response = requests.post(
"https://app.mailyte.com/api/v1/campaigns/01JBT8XQ2M9WYC3K4F6R7S8T9V/test-send",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
json={
"emails": [
"you@yourdomain.com"
]
},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->post('https://app.mailyte.com/api/v1/campaigns/01JBT8XQ2M9WYC3K4F6R7S8T9V/test-send', [
'emails' => [
'you@yourdomain.com',
],
]);
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/campaigns/01JBT8XQ2M9WYC3K4F6R7S8T9V/test-send")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
"emails": [
"you@yourdomain.com"
]
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataobjectThe test send's results. A test does not count as sending the campaign: its state and stats do not change, and the subject is marked as a test. You can test a campaign before marketing review approves your account.
objectstringcampaign_test_sendcampaign_idstringstatestringdraft | scheduled | sending | paused | sent | canceled | unknownThe campaign's lifecycle state, unchanged by the test send — identical before and after, which is the point of publishing it here.
sentintegerResults with status
sent. Derivable, and kept: it is the headline, and it is computed in the same pass asresultsso the two cannot disagree.requestedintegerAddresses attempted — at most five.
resultsarray<object>One row per address, in the order given.
emailstringThe address this row is about.
statusstringsent | suppressed | rate_limited | failed | unknownsent: handed to the mail server.suppressed: on your suppression list.rate_limited: over your sending rate.failed: seeerror.errorstringWhat went wrong, for a person to read. Do not parse it. Null when
statusissent.
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.