Skip to main content
PATCH
/
segments
/
{id}
Update segment
curl --request PATCH \
  --url https://api.mailglyph.com/segments/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Premium Users",
  "description": "Users with premium plan",
  "condition": {
    "logic": "AND",
    "groups": [
      {
        "filters": [
          {
            "field": "data.plan",
            "operator": "equals",
            "value": "premium"
          }
        ]
      }
    ]
  },
  "trackMembership": true
}
'
{
  "id": "<string>",
  "name": "<string>",
  "description": "<string>",
  "condition": {
    "groups": [
      {
        "filters": [
          {
            "field": "<string>",
            "value": "<unknown>"
          }
        ],
        "conditions": "<unknown>"
      }
    ]
  },
  "trackMembership": true,
  "memberCount": 123,
  "projectId": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.mailglyph.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

API Key authentication. Secret keys (sk_*) are required for all endpoints except /v1/track. Public keys (pk_*) only work with the /v1/track endpoint for client-side event tracking. Workspaces can have multiple active keys, and sender-domain operations enforce per-key domain scope when configured.

Path Parameters

id
string
required

Body

application/json
name
string
description
string
condition
object

Root segment condition structure using logical groups.

trackMembership
boolean

Track segment membership changes over time

Response

Segment updated

id
string
name
string
description
string | null
type
enum<string>
Available options:
DYNAMIC,
STATIC
condition
object

Root segment condition structure using logical groups.

trackMembership
boolean
memberCount
integer
projectId
string
createdAt
string<date-time>
updatedAt
string<date-time>