# Pages Router: the handler shape is different, do not mix them
The send goes in `pages/api/send.ts` as a default export taking
`NextApiRequest` and `NextApiResponse`. `export async function POST` does not
exist here.
```ts
import type { NextApiRequest, NextApiResponse } from 'next';
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== 'POST') {
return res.status(405).json({ error: 'method not allowed' });
}
const { data, error } = await resend.emails.send({
from: '[SENDER]',
to: ['[RECIPIENT]'],
subject: 'Hello World',
html: '<strong>It works!</strong>',
});
if (error) {
return res.status(400).json({ error });
}
return res.status(200).json({ id: data.id });
}
```
## Checklist
- Default-export the handler. A named `POST` export is silently ignored by the
Pages Router and the route 404s.
- Guard `req.method`. API routes accept every method by default; an accidental
GET would trigger a send if you skip the check.
- Use `res.status(...).json(...)`, not the `Response.json` helper from the App
Router example. The two routers do not share response helpers.