On this page
addSegmentMembers
mutation · in the family Pricing
What it does
Add up to 48 shoppers to a segment in one call — already-present shoppers are skipped, not errors.
Add up to 48 Consumers to a STATIC segment in ONE transaction: every consumer must exist in YOUR tenant non-doomed; a DYNAMIC segment refuses (its membership derives — edit the predicate/exclusions and refreshSegment); the membership cap (100,000) refuses naming the figure; legal on active AND inactive segments (staging), never doomed. Requires the unrestricted capability. Template class (v80).
What happens
Writes membership rows; the member count updates.
Who may call it
Capability area: Pricing — Prices, price schedules, promotions, coupons and the money rules of selling.
- Owner
- Manager
- An API key whose scope allows
api:addSegmentMembers
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
segmentId | ID ID! | yes | No further notes. |
consumerIds | ID [ID!]! | yes | No further notes. |
Returns
AddSegmentMembersResult AddSegmentMembersResult! — The addSegmentMembers result — the honest arithmetic (already-present shoppers SKIP, never error).
Example request
mutation ExampleAddSegmentMembers($segmentId: ID!, $consumerIds: [ID!]!) {
addSegmentMembers(segmentId: $segmentId, consumerIds: $consumerIds) {
added
skippedExisting
memberCount
}
}
Variables:
{
"segmentId": "01900000-0000-7000-8000-243b225b0000",
"consumerIds": [
"01900000-0000-7000-8000-a64ad04d0000"
]
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"addSegmentMembers": {
"added": 1,
"skippedExisting": 1,
"memberCount": 1
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
Errors this call can answer
VALIDATION/INVALID— Something in the request is not valid. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. (RATE_LIMIT)NOT_FOUND/*— That record could not be found. (NOT_FOUND)CONFLICT/*— The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. (CONFLICT)VALIDATION/VERSION_REQUIRED— The request did not say which app version it came from. (VALIDATION)