const res = await fetch("https://myunite.ai/api/v1/pretests", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.UNITE_API_KEY}`,
"Idempotency-Key": "summer-urban-clock-email-001",
"Content-Type": "application/json",
},
body: JSON.stringify({
uploadId: "upl_0123456789abcdef0123456789abcdef.png",
title: "Summer · urban clock",
channel: "email",
email: {
subject: "The summer clock has arrived",
preheader: "Limited edition, this week only",
stage: "draft",
type: "promotional",
},
}),
});
console.log(res.status, await res.json()); // 202