Skip to content

POST /api/v1/campaigns/{id}/test returns 200 but does not queue a send #1

Description

@yormi

Summary

POST /api/v1/campaigns/{campaignId}/test always returns
200 { "success": true, "message": "Test email would be sent to ..." },
but the send is never actually queued. Calls made via API never
result in delivery, while clicking Send test in the dashboard
for the same campaign delivers normally.

This affects the MCP server's send_test_email tool
(src/tools/index.ts, line ~1562) and presumably the equivalent
method in sequenzy-typescript.

Steps to reproduce

  1. POST /api/v1/campaigns with name, subject, html
    200, campaign saved as draft.

  2. POST /api/v1/campaigns/{campaignId}/test with
    { "to": "your-own-address@example.com" }:

    curl -X POST "https://api.sequenzy.com/api/v1/campaigns/{id}/test" \
      -H "Authorization: Bearer $API_KEY" \
      -H "Content-Type: application/json" \
      -H "x-company-id: $COMPANY_ID" \
      -d '{"to": "your-own-address@example.com"}'
  3. Response: 200 { "success": true, "message": "Test email would be sent to ...", "campaignId": "..." }

  4. GET /api/v1/subscribers/{email} → no new send event in
    activity, emailStats.sent unchanged.

  5. No email arrives.

Expected

A send event in the subscriber activity log within seconds,
followed by delivery. Email arrives in inbox.

Actual

200 is returned, but nothing is recorded in the subscriber
activity log and no email is delivered. The endpoint behaves
like a stub.

Evidence that the same campaign delivers from the UI

Clicking Send test in the dashboard for the same campaign
produces a real send event in /email-sends/{id}:

  • isTestEmail: true
  • testSourceType: "campaign"
  • testSourceId: "<campaignId>"
  • a separate testEmailId field

API-triggered tests never produce that testEmailId. This may
be the root cause — the UI's Send test flow appears to create a
backing TestEmail entity that the public API endpoint skips.

What I tried

  • Variable syntax: {{firstName|there}} (matching the UI-stored
    format), not {{FIRST_NAME}} — no change.
  • Added x-company-id header per the MCP server's apiRequest
    helper — no change.
  • Re-fired on a previously-delivered campaign (whose UI-triggered
    test had delivered earlier the same day) — also silently no-ops.

Note on the OpenAPI spec

The example response string "Test email would be sent to you@example.com" is hardcoded in the OpenAPI spec at
/campaigns/{campaignId}/test, and the running endpoint returns
that string verbatim — which suggests the response may be a
placeholder rather than wired through to a real send path.

Suggested fix

Either:

  • Make the endpoint actually create the TestEmail entity and
    queue the send (matching UI behavior), or
  • Return a clear 4xx when a precondition is missing, instead
    of 200 "would be sent".

The current behavior is particularly painful for AI agents using
the MCP send_test_email tool — there is no signal that the
send didn't happen.

Environment

  • API: https://api.sequenzy.com/api/v1
  • Observed: 2026-05-14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions