Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Delete segment


API Overview

api-overview page anchor

Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience.

The Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID.

Segments built using engagement data such as "was sent" or "clicked" will take approximately 30 minutes to begin populating.

Segment samples and counts refresh on a schedule that ranges from 1 to 24 hours. Segments with active automations or that are used as exclusion lists for scheduled Single Sends refresh every hour. Segments that aren't actively used refresh less frequently, up to every 24 hours, to optimize processing resources. Samples and counts displayed in the UI don't update immediately when segment criteria are modified or when contacts are added or updated. Instead, they update according to the segment's refresh schedule.


DELETE/v3/marketing/segments/2.0/{segment_id}

Base url: https://api.sendgrid.com (The Twilio SendGrid v3 API)

This endpoint allows you to delete a segment by ID.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstring
required
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
segment_idstring
required
202400404500
No response body.
Delete segmentLink to code sample: Delete segment
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const segment_id = "segment_id";
5
6
const request = {
7
url: `/v3/marketing/segments/2.0/${segment_id}`,
8
method: "DELETE",
9
};
10
11
client
12
.request(request)
13
.then(([response, body]) => {
14
console.log(response.statusCode);
15
console.log(response.body);
16
})
17
.catch((error) => {
18
console.error(error);
19
});