Skip to content
gist.link ↗

previewSegment

Query CRM API — POST https://crm.api.gist.link/graphql

Live preview of an unsaved criteria set: count + a member sample.

crm:query:previewSegment

The calling IAM key must hold this permission (or a wildcard that covers it: crm:query:* or crm:*) and the access token must have been minted with audience=crm. See Permissions.

type Query {
previewSegment(targetType: String!, criteria: JSON!, first: Int): SegmentPreview!
}
Argument Type Required Description
targetType String! Yes —
criteria JSON! Yes —
first Int No —

SegmentPreview! — see the CRM types reference.

Terminal window
curl https://crm.api.gist.link/graphql \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d @- <<'JSON'
{
"query": "query PreviewSegment($targetType: String!, $criteria: JSON!, $first: Int) { previewSegment(targetType: $targetType, criteria: $criteria, first: $first) { count members } }",
"variables": {
"targetType": "example",
"criteria": {},
"first": 10
}
}
JSON