Test Sync User to Marketing
This endpoint allows testing the functionality of adding a single contact to the configured Resend marketing audience (MARKETING_AUDIENCE_ID
). It’s primarily for development and testing purposes.
Authentication
This endpoint requires a secret API key (
MARKETING_SYNC_API_KEY
environment variable) passed as a query parameter (apiKey
). This is not the standard user JWT token.Do not expose this endpoint or the API key publicly.Request (GET or POST)
The secret marketing sync API key.
The email address to test syncing.
If
true
(default), logs the contact data that would be sent but doesn’t actually call the Resend API. Set to false
to perform a real sync.Response
Indicates if the test process completed successfully (even in dry run).
Reflects the
dryRun
parameter from the request.The contact data object formatted for Resend.
The
MARKETING_AUDIENCE_ID
used, or a placeholder if not configured.The response from the Resend API
addContactsToAudience
call if dryRun
was false
, otherwise null
.Error Codes
Status Code | Description |
---|---|
400 | Missing or invalid email parameter. |
401 | Invalid or missing apiKey parameter. |
500 | Internal server error (e.g., Resend API error during actual sync). |
Code Examples
Notes
- Authorization: Uses a dedicated marketing sync API key passed as a query parameter.
- Purpose: Primarily for testing the Resend integration and contact formatting.
- Methods: Accepts both GET and POST requests.
- Dry Run: Defaults to
true
to prevent accidental syncs during testing. - Audience ID: Requires
MARKETING_AUDIENCE_ID
environment variable for actual syncing.
Query Parameters
Email address of the user to synchronize
API key for authentication
If set to true, simulates synchronization without making actual changes
User's first name (optional, to override the value in the database)
Body
application/json