---
ref: tool:sendgrid/create-segment
name: Create a segment
company: company:sendgrid
workflows: []
access: [api]
tags: [capability:build-audience, category:email, has:api]
docs: https://www.twilio.com/docs/sendgrid/api-reference/segmenting-contacts-v2/create-segment
updated: 2026-09-27
---

# Create a segment

Creates a segment of the contacts that match an SQL-style query, optionally within one list, that updates as contacts change.

Pass a unique `name` and the `query_dsl`; `parent_list_ids` limits the
segment to one list. Segment counts refresh every 1 to 24 hours, and a
segment built on engagement data takes about 30 minutes to start filling.

## Set up

Use the first option your agent supports.

### API (official)

- Base URL: https://api.sendgrid.com
- Endpoint: `POST /v3/marketing/segments/2.0`
- Auth: send the header `Authorization: Bearer $SENDGRID_API_KEY`
- Get a key: https://app.sendgrid.com/settings/api_keys
- Docs: https://www.twilio.com/docs/sendgrid/api-reference

Before doing anything else, make one read-only call to confirm access.

## Rules

- Ask the user before anything that sends messages, costs money, or changes data.
- Never print API keys.
