Xurel Docs

Send email

Send a single email. Domain must be verified; use an API key with send permission.

Endpoint

POST /v1/emails

Body parameters

Field Type Required Description
from string (email) Required Sender address. Domain must be verified.
to string | string[] Required Recipient(s). Max 50 addresses.
subject string Required Email subject line.
html string Conditional HTML body. Required if text and templateId are absent.
text string Optional Plain-text body. Auto-generated from HTML when omitted.
type string Required transactional or broadcast.
cc string | string[] Optional CC recipients.
bcc string | string[] Optional BCC recipients.
replyTo string | string[] Optional Reply-To address(es).
headers object Optional Custom headers. Reserved names rejected.
attachments array Optional Max 10 files; total ≤ 25 MB. Base64 content or remote HTTPS URL. Attachment objects use contentType.
tags object Optional Up to 10 key-value string pairs for filtering analytics.
scheduledAt string (ISO 8601) Optional Schedule send for a future time.
templateId string Optional Use a stored template instead of inline HTML.
variables object Optional Template / merge variables.
topicId string Conditional Required when type=broadcast for preference-aware unsubscribe.

Response

200 OK — email accepted into the queue.

200
{
  "id": "em_a1b2c3d4",
  "status": "queued"
}

Errors

  • 400 validation_error — missing fields or invalid addresses
  • 422 domain_not_verified — sending domain not verified
  • 422 suppressed_recipient — all recipients are suppressed
  • 429 rate_limited — plan RPS exceeded

Examples

Node.js
import { Xurel } from 'xurel';

const xurel = new Xurel(process.env.XUREL_API_KEY);

const email = await xurel.emails.send({
  from: 'hello@yourdomain.com',
  to: 'user@example.com',
  subject: 'Hello from Xurel',
  html: '<p>Your first email.</p>',
  type: 'transactional',
});

console.log(email.id); // em_...
Python
import os
import xurel

client = xurel.Client(api_key=os.environ["XUREL_API_KEY"])

email = client.emails.send(
    from_="hello@yourdomain.com",
    to=["user@example.com"],
    subject="Hello from Xurel",
    html="<p>Your first email.</p>",
    type="transactional",
)

print(email["id"])
Go
package main

import (
  "context"
  "fmt"
  "os"

  "github.com/xurel/xurel-go"
)

func main() {
  client := xurel.New(os.Getenv("XUREL_API_KEY"))
  email, err := client.Emails.Send(context.Background(), &xurel.SendParams{
    From:    "hello@yourdomain.com",
    To:      []string{"user@example.com"},
    Subject: "Hello from Xurel",
    HTML:    "<p>Your first email.</p>",
    Type:    "transactional",
  })
  if err != nil {
    panic(err)
  }
  fmt.Println(email.ID)
}
cURL
curl https://api.xurel.co/v1/emails \
  -H "Authorization: Bearer $XUREL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "hello@yourdomain.com",
    "to": ["user@example.com"],
    "subject": "Hello from Xurel",
    "html": "<p>Your first email.</p>",
    "type": "transactional"
  }'