Update Segment
The Segmentation V2 API is in public beta. V2 segments can now be created and edited through both the UI and API.
You can see both V1 and V2 segments you have created with their contacts in the UI. While the UI only supports creation of V2 segments, you can still edit or delete either V1 or V2 segments in the UI. Both V1 and V2 segments can be exported and used as an audience for a Single Send or Automation. See the V2 Segmentation API documentation for more information.
PATCH /v3/marketing/segments/2.0/{segment_id}
Base url: https://api.sendgrid.com
Segment name
has to be unique. A user can not create a new segment with an existing segment name.
Authentication
- API Key
Headers
Request Body
Name of the segment.
maxLength: 100minLength: 1SQL query which will filter contacts based on the conditions provided
Path Parameters
Responses
ID assigned to the segment when created.
format: uuidmaxLength: 36minLength: 36Name of the segment.
maxLength: 100minLength: 1SQL query which will filter contacts based on the conditions provided
Total number of contacts present in the segment
A subset of all contacts that are in this segment
ID assigned to a contact when added to the system.
format: uuidmaxLength: 36pattern: [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}Email of the contact. This is a reserved field.
format: emailmaxLength: 254minLength: 3Alternate emails of the contact. This is a reserved field.
minItems: 0uniqueItems: TrueFirst name of the contact. This is a reserved field.
minLength: 1Last name of the contact. This is a reserved field.
minLength: 1First line of address of the contact. This is a reserved field.
minLength: 0Second line of address of the contact. This is a reserved field.
minLength: 0City associated with the contact. This is a reserved field.
minLength: 0pattern: ^[a-zA-Z\u0080-\u024F\s\/\-\)\(\`\.\"\']+$State associated with the contact. This is a reserved field.
minLength: 0Zipcode associated with the address of the contact. This is a reserved field.
Country associated with the address of the contact. This is a reserved field.
minLength: 0IDs of all lists the contact is part of
uniqueItems: TrueThe user may choose to create up to 120 custom fields or none at all. This is not a reserved field.
IDs of all segments the contact is part of
uniqueItems: TrueISO8601 timestamp of when the object was created
ISO8601 timestamp of when the object was last updated
ISO8601 timestamp of when the samples were last updated
ISO8601 timestamp of when the samples will be next updated
The array of list ids to filter contacts on when building this segment. It allows only one such list id for now. We will support more in future
uniqueItems: TrueIf not set, segment contains a Query for use with Segment v1 APIs. If set to '2', segment contains a SQL query for use in v2.
Segment status indicates whether the segment's contacts will be updated periodically
Status of query validation. PENDING, VALID, or INVALID
Describes any errors that were encountered during query validation
If the request is incorrect, an array of errors will be returned.
the field in the request body that is incorrect
a description of what is specifically wrong with the field passed in the request
If the request is incorrect, an array of errors will be returned.
the field in the request body that is incorrect
a description of what is specifically wrong with the field passed in the request
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow.