Skip to content
Email SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

SparkPost

Send through the SparkPost Transmissions API with metadata, substitution data from tags, and a provider-side sandbox mode.

Capabilities

Repeated headers Idempotency Scheduling Personalized
No none Yes expanded

These values come from the adapter’s exported capabilities declaration. The field support matrix covers normalized message fields.

The SparkPost adapter calls the SparkPost Transmissions API with plain fetch. Two things set it apart: a sandbox option that routes sends through SparkPost’s shared sandbox domain for testing, and tags become SparkPost substitution_data as name: value pairs instead of a flat list.

SparkPost logo
SparkPost@opencoredev/email-sdk/sparkpost
Provider docs

Configure

Create an API key with Transmissions permission in the SparkPost dashboard. SparkPost expects the raw key in the Authorization header, so the adapter sends it without a Bearer prefix.

PropType
apiKeystring

SparkPost API key, sent as the Authorization header (no Bearer prefix).

Typestring
baseUrl?string

Override the API origin, e.g. for the EU region.

Typestring
Default"https://api.sparkpost.com/api/v1"
sandbox?boolean

Send through SparkPost's shared sandbox domain (options.sandbox on the transmission).

Typeboolean
fetch?typeof fetch

Custom fetch implementation for tests or special runtimes.

Typetypeof fetch

Send

SparkPost maps replyTo, headers, attachments, metadata, and tags (each tag becomes a substitution_data entry keyed by its name). sendAt schedules the transmission natively as options.start_time; SparkPost accepts at most 3 days in the future.

The response id is the transmission id from results.id (or results.transmission_id). Use it to query SparkPost’s events API for delivery status.

Verify from the CLI

Drop --dry-run for one real send, or set sandbox: true in code first to exercise the API through SparkPost’s shared sandbox domain before touching your own.

Frequently asked questions

Does Email SDK support SparkPost?

Yes. Email SDK ships a SparkPost adapter imported from @opencoredev/email-sdk/sparkpost. You keep your SparkPost account and credentials; the SDK adds message validation, typed errors, and no-network test adapters around the same send() call used for every other provider.

Which message fields does the SparkPost adapter support?

SparkPost supports Reply-To address, Custom headers, Attachments, Tags, Metadata, and Scheduled sending (sendAt). It does not support CC recipients and BCC recipients; Email SDK rejects a message that uses those fields before any request is made.

Can SparkPost schedule email for later with Email SDK?

Yes. Set sendAt on the message and the SparkPost adapter passes the scheduled time to the provider.

Does the SparkPost adapter support idempotent sends?

No. SparkPost has no provider-side idempotency, so a retried send can be delivered twice. A send with idempotencyKey on a route that includes SparkPost fails with EmailValidationError unless you pass idempotency: “best-effort”. Deduplicate in your own queue before retrying.

Last updated on