Sluice Docs

REST API quickstart

Send your first guardrailed email in 5 minutes using the Sluice REST API.

Prefer SMTP? See the SMTP quickstart for zero-code-change integration.

1. Sign up

Go to app.sluice.email and enter your email address. You'll receive a magic link — click it to create your account. Your organization is automatically set up and you're assigned the admin role.

No credit card required to get started.

2. Create an API key

Go to Settings > API Keys and click Create Key. Give it a descriptive name (e.g., "production-agent" or "dev-testing").

Your key will be displayed once — copy it and store it securely. It cannot be retrieved later.

API keys use the sl_live_ prefix:

sl_live_abc123...

Store it in an environment variable:

export SLUICE_API_KEY="sl_live_..."

See API keys reference for more on key management and security.

3. Send your first email

curl -X POST https://app.sluice.email/api/v1/emails \
  -H "Authorization: Bearer sl_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "from": "agent@yourdomain.com",
    "to": "customer@example.com",
    "subject": "Your order is confirmed",
    "text": "Hi! Your order #1234 has been confirmed.",
    "html": "<p>Hi! Your order <strong>#1234</strong> has been confirmed.</p>"
  }'

Expected response:

{
  "id": "msg_abc123"
}

The id is a unique identifier for this email in Sluice. You can use it to check status in the dashboard.

Node.js example:

const response = await fetch('https://app.sluice.email/api/v1/emails', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.SLUICE_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    from: 'agent@yourdomain.com',
    to: 'customer@example.com',
    subject: 'Your order is confirmed',
    text: 'Hi! Your order #1234 has been confirmed.',
    html: '<p>Hi! Your order <strong>#1234</strong> has been confirmed.</p>',
  }),
});
 
const { id } = await response.json();

Python example:

import requests
import os
 
response = 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",
        "text": "Hi! Your order #1234 has been confirmed.",
        "html": "<p>Hi! Your order <strong>#1234</strong> has been confirmed.</p>",
    },
)
 
email_id = response.json()["id"]

4. What happens next

Once Sluice receives your email via the API:

  1. Guardrails analyze the email — PII detection, tone analysis, content policy, prompt injection defense, and more
  2. If all guardrails pass, the email is forwarded to the recipient automatically via your configured outbound provider
  3. If any guardrail flags a concern, the email is held in the Review Queue for human review

Tuning mode is on by default — all emails are held for review regardless of guardrail results. This lets you see how the guardrails perform on your real traffic before enabling auto-forwarding.

5. Configure your outbound provider

In Settings > Outbound, configure where Sluice delivers approved emails. Sluice supports API-based providers (Resend, SendGrid, Postmark) and SMTP providers (Gmail, Outlook, any custom SMTP server).

See the Outbound providers guide for step-by-step setup.

What's next?

On this page