List Emails
Retrieve a paginated list of sent emails.
GET /api/v1/emails
Returns a paginated list of emails sent from the authenticated account, ordered newest first. Authenticate with an X-API-Key header.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Number of results to return (max 100) |
offset | number | 0 | Number of results to skip |
Response
Returns 200 OK:
| Field | Type | Description |
|---|---|---|
emails | EmailSend[] | Array of email records |
count | number | Total count matching the query |
{
"emails": [
{
"id": "em_01hx...",
"status": "sent",
"from": "noreply@yourdomain.com",
"to": "user@example.com",
"subject": "Your order has shipped",
"created_at": "2024-01-15T10:30:00Z"
}
],
"count": 1
}Code examples
curl "https://api.smail.dev/api/v1/emails?limit=10&offset=0" \
-H "X-API-Key: sk_live_..."const { emails, count } = await smail.emails.list({ limit: 10, offset: 0 });
console.log(`Showing ${emails.length} of ${count} emails`);result, err := client.Emails.List(ctx, smail.ListEmailsOptions{
Limit: 10,
Offset: 0,
})
fmt.Printf("Showing %d of %d emails\n", len(result.Emails), result.Count)Error responses
| Status | Error | Description |
|---|---|---|
401 | unauthorized | Missing or invalid API key |