Segments
Create and manage Segments through the Resend API.
Operations
| Method | Endpoint | Description |
|---|---|---|
GET | /segments | Retrieve a list of segments |
POST | /segments | Create a new segment |
GET | /segments/{id} | Retrieve a single segment |
PATCH | /segments/{id} | Update an existing segment |
DELETE | /segments/{id} | Remove an existing segment |
GET | /segments/{id}/contacts | Retrieve a list of contacts in a segment |
Example
Retrieve a list of segments, with the TypeScript SDK:
ts
import { Resend } from "@octridev/resend";
const client = new Resend({
// Optional: replaces the default server and any server an operation declares.
baseUrl: "https://api.resend.com",
auth: { bearerAuth: process.env.API_TOKEN! },
});
const result = await client.segments.list();
console.log(result);Nine more languages
The same call exists in every SDK. See SDKs for the other nine.