# How to Call Resend Email API from Static HTML & Astro Sites

> Static sites have no server to hold RESEND_API_KEY. RealComposer provides a zero-maintenance edge proxy that receives form submissions from your static HTML site and sends emails via Resend with sub-50ms latency.

- Canonical page: https://realcomposer.com/recipes/resend-email-api-static-site
- Client platform: Static HTML / Astro
- Upstream services: Resend
- Category: Security & Secret Vault
- JSON version: https://realcomposer.com/recipes/resend-email-api-static-site.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=resend-email-api-static-site&via=agent

## Problem: Static Sites Lack Server Secret Storage

Putting a Resend API key in static HTML contact forms lets anyone extract it and send emails from your domain.

- Email spoofing from your verified domain
- Resend daily quota exhaustion
- DKIM/SPF domain reputation damage

## Solution steps

1. **Vault Resend Key**: Store RESEND_API_KEY in RealComposer Secret Vault.

2. **Post from Static HTML**: Wire standard HTML form to RealComposer endpoint.

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Resend Static Proxy",
  "method": "POST",
  "cacheTtlSeconds": 0,
  "steps": [
    {
      "stepKey": "resend",
      "upstreamUrlTemplate": "https://api.resend.com/emails",
      "httpMethod": "POST",
      "headersTemplate": {
        "Authorization": "Bearer {{secrets.RESEND_API_KEY}}",
        "Content-Type": "application/json"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "id",
        "sourceStep": "resend",
        "sourcePath": "id"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X POST "https://realcomposer.com/v1/acme/contact-form"
```

## Payload before and after

Raw upstream response:

```json
{
  "id": "49a39281-a8b2",
  "from": "contact@domain.com",
  "to": [
    "team@domain.com"
  ]
}
```

Slimmed RealComposer response:

```json
{
  "id": "49a39281-a8b2"
}
```

## FAQ

### Do I need Cloudflare Workers or AWS Lambda?

No, RealComposer operates as the complete managed edge layer.
