Node.js / Next.js
Native fetch — no dependency.
Developers⏱ 2 min
Call native fetch from an API route or server action.
app/api/subscribe/route.js
await fetch('https://app.postlys.com/api/v1/contacts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': process.env.POSTLYS_KEY,
},
body: JSON.stringify({ email, name, list: 'Subscribers' }),
});
Keep it server-side. Call Postlys from a server route or action, never the browser — that would expose your key.
Ready to try it? Spin up a workspace and grab your key.