Official SDKs for Node.js, Python, PHP, Go, and Ruby. Or just use fetch - no SDK required. All SDKs are thin wrappers around the same REST API, so behavior is identical everywhere.
One command per language. Pick yours.
npm install @sparked/mail
pip install sparked-mail
composer require sparked/mail
go get github.com/sparked-mail/go-sdk
gem install sparked-mail
Send a transactional email in five lines of code. Each tab below shows the same send in a different language.
import { SparkedMail } from '@sparked/mail'; const mail = new SparkedMail(process.env.SPARKED_API_KEY); const res = await mail.emails.send({ from: 'noreply@acme.com', to: 'user@example.com', subject: 'Welcome', html: '<b>Hi!</b>' }); console.log(res.id);
from sparked_mail import SparkedMail import os mail = SparkedMail(os.environ['SPARKED_API_KEY']) res = mail.emails.send( from_='noreply@acme.com', to='user@example.com', subject='Welcome', html='<b>Hi!</b>' ) print(res.id)
use SparkedMail\Client; $mail = new Client(getenv('SPARKED_API_KEY')); $res = $mail->emails->send([ 'from' => 'noreply@acme.com', 'to' => 'user@example.com', 'subject' => 'Welcome', 'html' => '<b>Hi!</b>' ]); echo $res->id;
import "github.com/sparked-mail/go-sdk" mail := sparked.New(os.Getenv("SPARKED_API_KEY")) res, err := mail.Emails.Send(&sparked.SendRequest{ From: "noreply@acme.com", To: []string{"user@example.com"}, Subject: "Welcome", HTML: "<b>Hi!</b>", }) fmt.Println(res.ID)
require 'sparked-mail' mail = SparkedMail::Client.new(ENV['SPARKED_API_KEY']) res = mail.emails.send( from: 'noreply@acme.com', to: 'user@example.com', subject: 'Welcome', html: '<b>Hi!</b>' ) puts res.id
Every SDK above is a thin wrapper around a single REST endpoint. If your language isn't listed, or you don't want a dependency, use fetch (or its equivalent) directly.
The API is a single POST /emails with a JSON body and a Bearer token. That's it. No SDK required means no version lock-in, no transitive deps, no security advisories to chase.
# Send email in 1 line curl -X POST https://mail.sparked.network/emails \ -H "Authorization: Bearer re_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "from": "noreply@acme.com", "to": "user@example.com", "subject": "Welcome", "html": "<b>Hi!</b>" }'
See the API reference for every endpoint. The full request/response shape is the same regardless of which language you call it from.