Send a test

POST/api/v1/campaigns/{campaign}/test-send
Requires anorganization API keywith the scopecampaigns:write

Sends 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

NameInTypeDescription
campaignrequiredpathstringThe campaign identifier.

Request body

  • emailsarray<string>required

    Where to send the test: 1 to 5 addresses. {{ tags }} are filled with sample values.

Request

POST/api/v1/campaigns/{campaign}/test-send
curl -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"
    ]
  }'
The key names its own organization, so no X-Organization-ID header is needed.

Response

Success.

  • dataobject

    The 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_send
    • campaign_idstring
    • statestringdraft | scheduled | sending | paused | sent | canceled | unknown

      The campaign's lifecycle state, unchanged by the test send — identical before and after, which is the point of publishing it here.

    • sentinteger

      Results with status sent. Derivable, and kept: it is the headline, and it is computed in the same pass as results so the two cannot disagree.

    • requestedinteger

      Addresses attempted — at most five.

    • resultsarray<object>

      One row per address, in the order given.

      • emailstring

        The address this row is about.

      • statusstringsent | suppressed | rate_limited | failed | unknown

        sent: handed to the mail server. suppressed: on your suppression list. rate_limited: over your sending rate. failed: see error.

      • errorstring

        What went wrong, for a person to read. Do not parse it. Null when status is sent.

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.