import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.templates.list({
limit: 2,
after: '34a080c9-b17d-4187-ad80-5af20266e535',
});
{
"object": "list",
"data": [
{
"id": "e169aa45-1ecf-4183-9955-b1499d5701d3",
"name": "reset-password",
"status": "draft",
"published_at": null,
"created_at": "2023-10-06T23:47:56.678Z",
"updated_at": "2023-10-06T23:47:56.678Z",
"alias": "reset-password"
},
{
"id": "b7f9c2e1-1234-4abc-9def-567890abcdef",
"name": "welcome-message",
"status": "published",
"published_at": "2023-10-06T23:47:56.678Z",
"created_at": "2023-10-06T23:47:56.678Z",
"updated_at": "2023-10-06T23:47:56.678Z",
"alias": "welcome-message"
}
],
"has_more": false
}
List all templates.
import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.templates.list({
limit: 2,
after: '34a080c9-b17d-4187-ad80-5af20266e535',
});
{
"object": "list",
"data": [
{
"id": "e169aa45-1ecf-4183-9955-b1499d5701d3",
"name": "reset-password",
"status": "draft",
"published_at": null,
"created_at": "2023-10-06T23:47:56.678Z",
"updated_at": "2023-10-06T23:47:56.678Z",
"alias": "reset-password"
},
{
"id": "b7f9c2e1-1234-4abc-9def-567890abcdef",
"name": "welcome-message",
"status": "published",
"published_at": "2023-10-06T23:47:56.678Z",
"created_at": "2023-10-06T23:47:56.678Z",
"updated_at": "2023-10-06T23:47:56.678Z",
"alias": "welcome-message"
}
],
"has_more": false
}
limit parameter to return a different number of templates or control the pagination of the results with the after or before parameters.
201001before parameter.after parameter.after or before parameter, not both. See our pagination guide for more information.import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.templates.list({
limit: 2,
after: '34a080c9-b17d-4187-ad80-5af20266e535',
});
{
"object": "list",
"data": [
{
"id": "e169aa45-1ecf-4183-9955-b1499d5701d3",
"name": "reset-password",
"status": "draft",
"published_at": null,
"created_at": "2023-10-06T23:47:56.678Z",
"updated_at": "2023-10-06T23:47:56.678Z",
"alias": "reset-password"
},
{
"id": "b7f9c2e1-1234-4abc-9def-567890abcdef",
"name": "welcome-message",
"status": "published",
"published_at": "2023-10-06T23:47:56.678Z",
"created_at": "2023-10-06T23:47:56.678Z",
"updated_at": "2023-10-06T23:47:56.678Z",
"alias": "welcome-message"
}
],
"has_more": false
}
Was this page helpful?