Subscribe to a newsletter.

Subscribe to a newsletter.
export default async (req, res) => {
  const { email } = req.body;

  if (!email) {
    return res.status(400).json({ error: 'Email is required' });

  const result = await fetch('', {
    method: 'POST',
    headers: {
      Authorization: `Token ${process.env.REVUE_API_KEY}`,
      'Content-Type': 'application/json'
    body: JSON.stringify({ email })
  const data = await result.json();

  if (!result.ok) {
    return res.status(500).json({ error:[0] });

  return res.status(201).json({ error: '' });



Create Revue Account

First, create a Revue account.


Find API Key

From the Integrations page, retrieve your API key at the bottom.


Add Environment Variables

To securely access the API, we need to include the secret with each request.

Remember: never commit secrets to git. Thus, we should use an environment variable.