DEV Community

Alex Spinov
Alex Spinov

Posted on

Resend Has a Free API You Should Know About

Resend is a modern email API built for developers — and the free tier sends 3,000 emails per month.

Send Email — One API Call

import { Resend } from 'resend'

const resend = new Resend(process.env.RESEND_API_KEY)

const { data, error } = await resend.emails.send({
  from: 'onboarding@yourdomain.com',
  to: 'user@example.com',
  subject: 'Welcome!',
  html: '<h1>Welcome to our platform</h1><p>Get started in 3 easy steps...</p>'
})

console.log(data?.id) // Email ID for tracking
Enter fullscreen mode Exit fullscreen mode

React Email — Components as Templates

// emails/welcome.tsx
import { Html, Head, Body, Container, Text, Button } from '@react-email/components'

export default function WelcomeEmail({ name, loginUrl }) {
  return (
    <Html>
      <Head />
      <Body style={{ fontFamily: 'sans-serif' }}>
        <Container>
          <Text>Hey {name}, welcome aboard!</Text>
          <Button href={loginUrl} style={{ background: '#000', color: '#fff', padding: '12px 20px' }}>
            Get Started
          </Button>
        </Container>
      </Body>
    </Html>
  )
}

// Send it
await resend.emails.send({
  from: 'team@yourdomain.com',
  to: 'user@example.com',
  subject: 'Welcome!',
  react: <WelcomeEmail name="John" loginUrl="https://app.com/login" />
})
Enter fullscreen mode Exit fullscreen mode

Batch Sending

const { data } = await resend.batch.send([
  { from: 'team@yourdomain.com', to: 'alice@test.com', subject: 'Hey Alice', html: '...' },
  { from: 'team@yourdomain.com', to: 'bob@test.com', subject: 'Hey Bob', html: '...' },
  { from: 'team@yourdomain.com', to: 'carol@test.com', subject: 'Hey Carol', html: '...' }
])
Enter fullscreen mode Exit fullscreen mode

Webhooks — Track Delivery

// POST /api/webhooks/resend
export async function POST(request) {
  const event = await request.json()

  switch (event.type) {
    case 'email.delivered':
      await markEmailDelivered(event.data.email_id)
      break
    case 'email.bounced':
      await handleBounce(event.data.to)
      break
    case 'email.opened':
      await trackOpen(event.data.email_id)
      break
  }

  return Response.json({ received: true })
}
Enter fullscreen mode Exit fullscreen mode

Real-World Use Case

A SaaS founder was paying $80/month for SendGrid, fighting with their template system. Switched to Resend + React Email: email templates became React components in their codebase, version-controlled, testable. Sending cost dropped to $0 (free tier) and developer experience went from "dreading email code" to "it's just React."

Resend made transactional email feel like building a web page.


Build Smarter Data Pipelines

Need to scrape websites, extract APIs, or automate data collection? Check out my ready-to-use scrapers on Apify — no coding required.

Custom scraping solution? Email me at spinov001@gmail.com — fast turnaround, fair prices.

Top comments (0)