AlmondTill/G3N API

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).

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Pricing — Prices, price schedules, promotions, coupons and the money rules of selling.

Roles that may call it:

What happens

Writes membership rows; the member count updates.

Arguments

NameTypeRequiredNotes
segmentIdID ID!yes
consumerIdsID [ID!]!yes

Returns

AddSegmentMembersResult AddSegmentMembersResult! — The addSegmentMembers result — the honest arithmetic (already-present shoppers skip, never error).

Example request

graphql
mutation ExampleAddSegmentMembers($segmentId: ID!, $consumerIds: [ID!]!) {
  addSegmentMembers(segmentId: $segmentId, consumerIds: $consumerIds) {
    added
    skippedExisting
    memberCount
  }
}

Variables:

json
{
  "segmentId": "01900000-0000-7000-8000-50ab2f860000",
  "consumerIds": [
    "01900000-0000-7000-8000-3cbb3ce90000"
  ]
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "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

Used in