# Identify a member

> Turn a scanned QR code, phone number, email or member id into a LoyX membership.

Source: https://developers.loyx.se/guides/identify-member/

Before you can show a card or credit a sale, find the member. Call:

```
POST /v1/memberships/lookup
```

with one identifier:

```json
{ "identifier": "qr_code", "value": "lx1_EXAMPLE_TOKEN" }
```

| `identifier` | `value` | Notes |
|---|---|---|
| `qr_code` | The string your scanner read | The normal case at a till. See below. |
| `mobile_number` | E.164, for example `+46701234567` | Only if the brand collects phone numbers. |
| `email` | An email address | Only if the brand collects emails. |
| `membership_id` | A LoyX membership UUID | When you kept it from an earlier lookup. |
| `user_id` | A LoyX user UUID | Rare. Prefer `membership_id`. |
| `national_id` | A national id number | Only if the brand uses it. Never log it. |

## Scanning the app QR code

The member opens the LoyX app and shows a QR code. **Send the scanned string exactly as read.** Do not trim, parse or decode it.

- Current codes start with `lx1_` and rotate every few minutes.
- Older codes are a plain UUID. They still work. LoyX tells the two apart, so you need no change when the old form is retired.

## What you get back

`200` with the membership:

```json
{
  "membership_id": "6f1c3e1a-0000-4000-8000-000000000001",
  "user_id": "0b7d9f52-0000-4000-8000-000000000002",
  "full_name": "Alex Example",
  "status": "active",
  "balance": 3,
  "loyalty_program_type": "stamps",
  "unit": { "label": "stamps", "presentation": "card", "currency": null, "minor_units": null, "locale": null },
  "cycle": 3,
  "cycle_length": 10,
  "stamps_dates": ["2026-11-02T08:30:00Z", "2026-11-09T12:05:00Z", "2026-11-20T10:15:00Z"],
  "celebration": false,
  "created_at": "2026-10-01T09:00:00Z",
  "updated_at": "2026-11-20T10:15:00Z"
}
```

Keep `membership_id` for the rest of the sale. Put it on the sale as the member reference.

The answer is enough for a simple card: `balance` in the program's `unit`, the current `cycle` number and its size `cycle_length` (`null` when unbounded), and `stamps_dates` on a stamp card. `unit` is `null` when the member is on no program. See [Member card and rewards](/guides/member-card/).

## When nothing is found

| Response | Meaning | What the till should do |
|---|---|---|
| `404 qr_code_not_resolvable` | The QR code expired or a newer one replaced it. | Ask the member to refresh the code in the app, then scan again. |
| `404 membership_not_found` | This person is not an active member of this brand. | Continue the sale without a member. |
| `422 invalid_fields` | The value does not match the identifier's format. | Fix the input. |

A miss is normal traffic. Do not retry it in a loop.

## Privacy

Member lookup is rate limited per client, because it can reveal who is a member. Look up once per sale, not once per keystroke. Never put phone numbers, emails or national ids in URLs or logs.
