Sluice Docs

Migrating from Resend

If you're already using Resend to send email from your AI agent, adding Sluice is a one-line change. You keep Resend as your delivery provider — Sluice just adds guardrails in the middle.

Before: direct Resend call

// Before — sending directly via Resend
import { Resend } from 'resend'
 
const resend = new Resend('re_...')
 
await resend.emails.send({
  from: 'agent@yourdomain.com',
  to: 'customer@example.com',
  subject: 'Your order is confirmed',
  html: '<p>Hi! Your order <strong>#1234</strong> has been confirmed.</p>',
})

After: via Sluice

// After — point at Sluice instead
await fetch('https://app.sluice.email/api/v1/emails', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sl_live_...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    from: 'agent@yourdomain.com',
    to: 'customer@example.com',
    subject: 'Your order is confirmed',
    html: '<p>Hi! Your order <strong>#1234</strong> has been confirmed.</p>',
  }),
})
 
// Sluice forwards approved emails via your configured Resend account

No Resend SDK needed. The Sluice REST API accepts the same fields — from, to, subject, text, html, and attachments.

What changes

Before (direct Resend)After (via Sluice)
EndpointResend APISluice API
AuthResend API keySluice API key
Email fieldsSameSame
Delivery providerResendStill Resend (configured in Sluice)
GuardrailsNoneAll configured guardrails apply
SDK requiredYes (resend package)No (plain fetch)

Configure Sluice to forward via Resend

  1. In the Sluice dashboard, go to Settings > Outbound
  2. Select Resend as your outbound provider
  3. Enter your Resend API key (re_...)
  4. Click Test Connection to verify

Important: The from address in your API calls must be verified in your Resend account. Sluice always sends from the address configured in your outbound provider settings, regardless of what the agent specifies.

End result

Your agent code is simpler — no SDK dependency, just a fetch call. Sluice adds guardrails in the middle (PII detection, tone analysis, content policy, and more). Resend still delivers the email. The customer sees no difference.

Python migration

Before:

import resend
 
resend.api_key = "re_..."
 
resend.Emails.send({
    "from": "agent@yourdomain.com",
    "to": "customer@example.com",
    "subject": "Your order is confirmed",
    "html": "<p>Hi! Your order <strong>#1234</strong> has been confirmed.</p>",
})

After:

import requests
import os
 
requests.post(
    "https://app.sluice.email/api/v1/emails",
    headers={
        "Authorization": f"Bearer {os.environ['SLUICE_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "from": "agent@yourdomain.com",
        "to": "customer@example.com",
        "subject": "Your order is confirmed",
        "html": "<p>Hi! Your order <strong>#1234</strong> has been confirmed.</p>",
    },
)

On this page