Add Delivrie to your Vercel projects: the integration creates an API key and sets DELIVRIE_API_KEY on the projects you choose, for production, preview and development.
Delivrie creates an API key and adds it to each project as DELIVRIE_API_KEY, encrypted, for production, preview and development. Redeploy, and your code can read it:
import { Delivrie } from "delivrie";
const delivrie = new Delivrie(); // reads DELIVRIE_API_KEY
export async function POST(req: Request) {
const { email } = await req.json();
const { data, error } = await delivrie.emails.send({
from: "Acme <hello@mail.acme.com>",
to: email,
subject: "Welcome to Acme",
html: "<p>Thanks for signing up.</p>",
}, { idempotencyKey: `welcome-${email}` });
return Response.json(error ?? data, { status: error ? 400 : 200 });
}
Remove the integration in Vercel, or in Delivrie under Settings → Integrations. Delivrie deletes the API key and removes DELIVRIE_API_KEY from the projects.
Create a key in API keys and add it yourself: vercel env add DELIVRIE_API_KEY. See Next.js for complete examples.