How do I send email from a Vercel Function?
Create a function, either a Next.js route handler under app/api or a file under api/ in a project without a framework, read NOTIX_API_KEY from the environment, and call notix.emails.send from notix-js or POST to https://app.usenotix.dev/api/v1/emails with fetch. The function answers with the message id; delivery is reported afterwards through a webhook.
Does notix-js run on the Edge runtime?
No. The send path is plain fetch, but the package also imports Node's crypto module for webhook signature checks, and the Edge runtime does not provide it, so the import fails. Keep the Node runtime, which is the default, for anything that uses the SDK. A route that must run at the edge can send with fetch alone; the API is an HTTPS POST with a bearer token.
Where do I put the API key on Vercel?
In the project's environment variables, once per environment: vercel env add NOTIX_API_KEY production, then the same for preview and development, or the same three fields in the dashboard. Name it NOTIX_API_KEY, never NEXT_PUBLIC_NOTIX_API_KEY: a NEXT_PUBLIC_ variable is inlined into the browser bundle at build time and is public the moment the deployment goes live. Use a separate key for preview deployments so a leaked preview cannot send as production.
Will a Vercel timeout cut off my send?
Not for a single message. A send is one HTTPS request that completes in well under a second, and with Fluid compute, which is on by default for new projects, the default maximum duration is at least 60 seconds on every plan. Set maxDuration on the route only when a handler loops over many recipients, and prefer a batch send for that anyway.
What happens if the function runs twice?
Without an idempotency key, two sends. A retried invocation, a deploy that lands mid-request or a user who double-clicks the form all look the same to the API. Pass idempotencyKey with a value that names the thing being sent, such as order-4471-receipt; the second call with the same key returns the first message instead of creating another.
Do I need a queue to send email from Vercel?
Not for one message per request. The function waits for the API to accept the message, which is a few hundred milliseconds, and Notix handles delivery, retries and bounces on its side; a webhook tells you the outcome. A queue earns its place when one request must fan out to thousands of recipients, and even then the batch endpoint or a scheduled send usually replaces it.