I can ensure that my API key is new and copied correctly, but for some reason, it returns 401 Can you tell me how to troubleshoot the problem? I searched online but couldn’t find any effective method.
{
"message": "not verified",
"code": "unauthorized"
}
nextjs code:
const headers = new Headers({
'accept': 'application/json',
'api-key': apiKey,
'content-type': 'application/json',
});
const body = JSON.stringify({
sender: {
name: "demo",
email: "demo@smtp-brevo.com",
},
to: [
{
email: recipientEmail,
name: recipientName,
},
],
subject,
htmlContent,
});
const response = await fetch('https://api.brevo.com/v3/smtp/email', {
method: 'POST',
headers,
body,
});