AlmondTill/G3N API

loyaltyLedger

query · in the family Reading your records

What it does

A loyalty member’s points history — every earn, redemption, and adjustment.

With the member GET (cached pointsBalance — stamped in the same transaction as every entry) this IS the points story.

Before you call

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

Capability area: Reading your records — Looking up and listing the records of your organization.

Roles that may call it:

What happens

Reads only.

Arguments

NameTypeRequiredNotes
memberIdID ID!yes
limitIntnoHow many records to answer at most; a page may hold fewer.
beforeIDno

Returns

LoyaltyPointsEntry [LoyaltyPointsEntry!]! — ONE immutable points fact: the signed points figure IS the balance direction; the parent member's pointsBalance was stamped in the same transaction. Corrections are NEW adjust entries, never edits.

Example request

graphql
query ExampleLoyaltyLedger($memberId: ID!, $limit: Int) {
  loyaltyLedger(memberId: $memberId, limit: $limit) {
    id
    parentId
    entryType
    points
    reason
    orderId
    returnId
    caption
    createdAt
  }
}

Variables:

json
{
  "memberId": "01900000-0000-7000-8000-fef5fce30000",
  "limit": 1
}

Example response

json
{
  "data": {
    "loyaltyLedger": [
      {
        "id": "01900000-0000-7000-8000-37386ae00000",
        "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
        "entryType": "earn",
        "points": 1,
        "reason": "Correcting a miscount.",
        "orderId": "01900000-0000-7000-8000-18e782370000",
        "returnId": "01900000-0000-7000-8000-cc01b1df0000",
        "caption": "Blue jeans",
        "createdAt": "2027-01-31T00:00:00.000Z"
      }
    ]
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in