Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Refresh 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.

Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes.

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

Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours.

The Refresh Segment operation allows customers with Marketing Campaigns Basic or Advanced plans(link takes you to an external page) to manually refresh segments. You can refresh a segment twice per day. Refreshes will be reset at midnight in the timezone stored for the segment. A segment cannot be refreshed more than once within one hour, and the endpoint has a rate limit of 10 requests per day that is reset at 0:00 UTC. Manually refreshing a segment does not affect the segment's backoff.


POST/v3/marketing/segments/2.0/refresh/{segment_id}

Base url: https://api.sendgrid.com

Manually refresh a segment by segment ID.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
segment_idstring<uuid>required
Min length: 36Max length: 36
SchemaExample
Property nameTypeRequiredDescriptionChild properties
user_time_zonestringrequired

The user's timezone. The timezone is used to reset the refresh count at midnight in the user's local time. Only IANA time zone format(link takes you to an external page) is accepted.

202403404429500

The refresh was accepted and a request was sent to process.

SchemaExample
Property nameTypeRequiredDescriptionChild properties
job_idstring

The ID of the manual refresh job. Used only for internal purposes.

Manually refresh a segment

manually-refresh-a-segment page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_22
const client = require('@sendgrid/client');
_22
client.setApiKey(process.env.SENDGRID_API_KEY);
_22
_22
const segment_id = "f15982c1-a82c-4e87-a6b2-a4a63b4b7644";
_22
const data = {
_22
"user_time_zone": "America/Chicago"
_22
};
_22
_22
const request = {
_22
url: `/v3/marketing/segments/2.0/refresh/${segment_id}`,
_22
method: 'POST',
_22
body: data
_22
}
_22
_22
client.request(request)
_22
.then(([response, body]) => {
_22
console.log(response.statusCode);
_22
console.log(response.body);
_22
})
_22
.catch(error => {
_22
console.error(error);
_22
});


Rate this page: