# loyaltyLedger

query · in the family [Reading your records](/reference/reading-your-records/)

## What it does

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

The LoyaltyPointsEntry ledger of ONE member, NEWEST-FIRST + bounded: 'limit' clamps server-side; 'before' = the prior page's oldest entry id (exclusive). With the member GET (cached pointsBalance — stamped in the SAME transaction as every entry) this IS the points story (earn/redeem/redeem_reversal/clawback/adjust, -ref'd to their orders/returns with per-line details). Requires authentication; the member is tenant-scoped server-side.

## What happens

Reads only.

## Who may call it

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

- Owner
- System Administrator
- Manager
- Associate Manager
- Warehouse Associate
- Sales Associate
- An API key whose scope allows `api:loyaltyLedger`

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `memberId` | [ID](/types/#scalars) `ID!` | yes | No further notes. |
| `limit` | [Int](/types/#scalars) | no | How many records to answer at most; a page may hold fewer. |
| `before` | [ID](/types/#scalars) | no | No further notes. |

## Returns

[LoyaltyPointsEntry](/types/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-80d971ae0000",
  "limit": 1
}
```

## Example response

```json
{
  "data": {
    "loyaltyLedger": [
      {
        "id": "01900000-0000-7000-8000-37386ae00000",
        "parentId": "01900000-0000-7000-8000-065235280000",
        "entryType": "earn",
        "points": 1,
        "reason": "Correcting a miscount.",
        "orderId": "01900000-0000-7000-8000-f6d8263a0000",
        "returnId": "01900000-0000-7000-8000-4d4c03d20000",
        "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

- `VALIDATION/INVALID` — Something in the request is not valid. ([VALIDATION](/errors/VALIDATION/))
- `AUTHN/REQUIRED` — Sign in to do this. ([AUTHN](/errors/AUTHN/))
- `AUTHZ/FORBIDDEN` — Your role does not allow this action. ([AUTHZ](/errors/AUTHZ/))
- `RATE_LIMIT/THROTTLED` — Too many requests in a short time. ([RATE_LIMIT](/errors/RATE_LIMIT/))
- `NOT_FOUND/*` — That record could not be found. ([NOT_FOUND](/errors/NOT_FOUND/))

## Used in

- [Start a loyalty programme and enrol members](/use-cases/start-a-loyalty-programme/)
