Skip to Content
sesameSend

Segments

Create and manage Segments

Retrieve a list of segments

GET /segments

Query parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/segments" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "string",
      "name": "string",
      "audience_id": "string",
      "created_at": "2023-10-06 23:47:56.678+00"
    }
  ]
}

Create a new segment

POST /segments

Body

FieldTypeRequiredDescription
namestringyesThe name of the segment.
audience_idstringnoThe ID of the audience this segment belongs to.
filterobjectnoFilter conditions for the segment.

Example

curl -X POST "$SESAMESEND_URL/segments" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string"
}'

Responses

StatusDescription
201OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "segment"
}

Retrieve a single segment

GET /segments/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Segment ID.

Example

curl -X GET "$SESAMESEND_URL/segments/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "segment",
  "name": "Active Users",
  "audience_id": "string",
  "filter": {},
  "created_at": "2023-10-06 23:47:56.678+00"
}

Update an existing segment

PATCH /segments/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Segment ID.

Body

FieldTypeRequiredDescription
namestringyesThe name of the segment.

Example

curl -X PATCH "$SESAMESEND_URL/segments/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string"
}'

Responses

StatusDescription
200OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "segment"
}

Remove an existing segment

DELETE /segments/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Segment ID.

Example

curl -X DELETE "$SESAMESEND_URL/segments/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "segment",
  "deleted": true
}

Retrieve a list of contacts in a segment

GET /segments/{id}/contacts

Path parameters

NameTypeRequiredDescription
idstringyesThe Segment ID.

Query parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/segments/<id>/contacts" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "e169aa45-1ecf-4183-9955-b1499d5701d3",
      "email": "ada@example.com",
      "first_name": "Ada",
      "last_name": "Lovelace",
      "created_at": "2023-10-06 23:47:56.678+00",
      "unsubscribed": false
    }
  ]
}