Skip to content

Loyalty club members

These routes act on the restaurant’s loyalty club: the members, their tiers and the visits that move them up. A ticket system or a sign-up form on a website enrols guests one at a time; a loyalty system the restaurant is leaving transfers its members in batches. Nothing here sends a guest a message or issues a reward.

RouteScopeWhat it does
GET /customers/{customerRef}/loyaltyloyalty:readReads one guest’s membership
POST /loyalty/membersloyalty:writeEnrols one guest, found or created by phone
POST /loyalty/members/importloyalty:importTransfers up to 100 members from another system

All three need the loyalty club app installed on the tenant. Without it every one of them answers 409 loyalty-not-installed, and the same request succeeds unchanged once an Owner installs the app:

{
"type": "https://ninetables.io/problems/loyalty-not-installed",
"title": "Loyalty Club Not Installed",
"status": 409,
"detail": "The loyalty club app is not installed for this restaurant. The same request succeeds once an Owner installs the app in Nine Tables.",
"code": "LOYALTY_NOT_INSTALLED"
}

A club that is installed but switched off is not that: it reads, enrols and transfers as usual, so members can be in place before the restaurant switches the club on.

GET /customers/{customerRef}/loyalty takes any customer reference (see Addressing). A member you transferred is also addressable by the key the import filed them under, {source_system}-member:{member_id}, so GET /customers/diller-member:M-1001/loyalty reads the member your system calls M-1001.

{
"member": true,
"membership": {
"id": "0198a5b0-5e1f-7c21-9a44-2b6d7e8f9a01",
"customer_id": "0198a5b0-7c2e-7d31-b7c4-1f4dcaa1e001",
"status": "active",
"tier": { "id": "0198a5b0-3c4d-7e5f-8a6b-7c8d9e0f1a2b", "name": "Silver" },
"visits": { "period": 4, "total": 11 },
"period_start": "2026-03-01T00:00:00.000000Z",
"renews_at": "2027-03-01T00:00:00.000000Z",
"joined_at": "2025-03-01T00:00:00.000000Z",
"joined_via_restaurant_id": "0198a5b0-1234-7abc-8def-0123456789ab",
"join_source": "student",
"imported_from": "diller"
}
}

visits.period is the count the tiers read, and it starts again at renews_at; renews_at is null for a club whose period never resets. A guest who is not a member answers 200 with "member": false and "membership": null, and a guest who does not exist, or belongs to another tenant, answers 404.

POST /loyalty/members
Content-Type: application/json
Idempotency-Key: signup-7c1f0a3e
{"phone": "+4790000001", "first_name": "Kari", "marketing_consent": true, "source": "student"}
  • The phone identifies the guest. The guest holding the number is enrolled, and a guest is created when nobody does. Send it with + or 00 and the country code; a Norwegian mobile number is also accepted without it (90000001), while a Swedish or Danish number needs its code. Anything else answers 400 validation-failed on phone.

  • Names and email fill only what is empty. They never overwrite what the restaurant holds, and the email never identifies the guest.

  • Consent. marketing_consent: true records the guest’s marketing consent, with source api, on a guest who has none; an existing consent is never changed. A club that asks for consent to join refuses an enrolment without it:

    {
    "type": "https://ninetables.io/problems/validation-failed",
    "title": "Validation Failed",
    "status": 400,
    "detail": "Request validation failed",
    "code": "VALIDATION_FAILED",
    "errors": [
    {
    "key": "marketing_consent",
    "code": "invalid_value",
    "detail": "This club asks for marketing consent to join, so send `marketing_consent: true` once the guest has given it."
    }
    ]
    }
  • Where the guest joined. restaurant_id names the restaurant, by its id from GET /restaurants. A key limited to one restaurant joins through that one when you omit it, and a key limited to several must send it. A restaurant of another tenant, one outside your key and an inactive one (disabled or demo) are refused alike, 400 on restaurant_id; so is an enrolment that would create a guest while the tenant has no live restaurant. source is a campaign or channel code such as student.

  • 201 with created: true for a new membership, 200 with created: false for a guest already in the club, both with the membership and a Location that reads it back.

Enrolling issues nothing. No SMS is sent and no reward is given, not even the club’s welcome reward: that comes with the guest’s first visit, or with a visit the restaurant registers in the app, exactly as for a guest who joined there. An enrolment therefore works whatever country the phone is in.

POST /loyalty/members/import moves members from another loyalty system with their visit counts, join dates and the rewards that system already gave. It follows the rules of the file import in the Nine Tables app, and takes the same fields, so a restaurant can move some members by file and the rest through you.

POST /loyalty/members/import
Content-Type: application/json
Idempotency-Key: diller-transfer-0001
{
"source_system": "diller",
"extracted_at": "2026-10-28T06:00:00Z",
"restaurant_map": { "Katla": "0198a5b0-1234-7abc-8def-0123456789ab" },
"dry_run": true,
"members": [
{
"member_id": "M-1001",
"phone": "+4791234567",
"first_name": "Kari",
"consent": true,
"joined_at": "2025-10-22",
"period_start": "2026-03-01",
"period_visits": 7,
"total_visits": 12,
"department": "Katla",
"rewarded_thresholds": [5]
}
]
}
  • source_system names your system, in lower case. The members are filed under it, so a later import of the same system updates the members this one brought in, and the restaurant can undo the import in the app.
  • extracted_at is when the members were taken out of your system. Visits in Nine Tables from then on are added on top of the counts you send, so a visit is never counted twice. It cannot be in the future.
  • restaurant_map translates each department value to the restaurant it names, or to null for a department that is no venue (a web shop). Every id must be one of the tenant’s restaurants; a department the map does not name is kept as the member’s source.
  • members carries 1 to 100 members, in the fields below.

Each member is handled on its own. The guest holding its phone is found, or created; a guest already in the club through Nine Tables or another system is left as it is; a member an earlier import of the same source_system brought in is updated. A member the import cannot use, for a phone it cannot read or a date in the future, is rejected on its own line with a reason, and the rest are imported. The answer has one line per member, in request order:

{
"dry_run": false,
"import_job_id": "0198a5b0-9d8e-7f6a-8b5c-4d3e2f1a0b9c",
"summary": {
"members": 2,
"created": 1,
"updated": 0,
"skipped": 0,
"rejected": 1
},
"members": [
{ "row": 1, "member_id": "M-1001", "status": "created" },
{
"row": 2,
"member_id": "M-1002",
"status": "rejected",
"reason": "invalid_phone"
}
]
}
FieldRequiredWhat it holds
member_idnoThe member’s id in your system, at most 128 characters; without it the phone is the key
phoneyes+ or 00 and the country code, or a Norwegian mobile number without it
first_namenoStored on a new guest, and on a known one only where empty
last_namenoAs first_name
emailnoAs first_name; one that is no address is ignored with a warning
sms_consentnotrue or false: marketing by SMS
email_consentnotrue or false: marketing by email
consentnoOne answer for both channels
consent_atnoWhen the member consented; joined_at stands in without it
joined_atyesWhen the member joined your club
period_startyesWhen the current earning period began, no later than extracted_at
period_visitsyesVisits in the current period, the count the tiers read
total_visitsnoEvery visit since joining, at least period_visits
departmentnoThe venue the member joined through, as your system names it
sourcenoA campaign or channel code, folded to lower case and hyphens
rewarded_thresholdsnoThe tier thresholds, in visits, whose reward your system already gave this period

A date is an ISO 8601 date (2025-10-22) or local date and time (2025-10-22 16:35), read in the account’s time zone, the one membership years are counted in, or an instant with its offset (2025-10-22T16:35:20+02:00). A member with a field the table does not have refuses the whole call, as every request body here is strict.

"dry_run": true writes nothing and answers what the import would do: the numbers the dry run in the app shows, and a decision per member (create_customer, create_membership, update, skip_existing_member or rejected) with any warnings. It never carries a name, an email, or the values a known guest’s details differ in; conflicts counts those guests instead. Run it on every batch before the real call: a dry run and an import of the same members decide alike, as long as nothing changed in between.

An import sends no SMS or email and issues no gift card or reward. The rewards your system already gave this period, rewarded_thresholds, are recorded as given so they are never paid again, and an imported member’s welcome counts as settled. Without rewarded_thresholds, every tier the member’s count reaches counts as rewarded already; an empty list, [], says your system rewarded none.

A member whose count reaches a tier your system never rewarded would be paid that reward at their next visit. Such a member is rejected with first_visit_reward_not_allowed, unless the call sets "allow_first_visit_rewards": true; the dry run counts them under first_visit_rewards. A threshold no tier of the club is at refuses the whole call before anything is written:

{
"type": "https://ninetables.io/problems/validation-failed",
"title": "Validation Failed",
"status": 400,
"detail": "Request validation failed",
"code": "VALIDATION_FAILED",
"errors": [
{
"key": "members.0.rewarded_thresholds",
"code": "invalid_value",
"detail": "No tier of this club is at 7 visits; its tiers are at 3, 5 and 10 visits."
}
]
}

A guest the import creates gets marketing consent when consent, or both sms_consent and email_consent, is true, dated consent_at or else joined_at, with source import. A guest the restaurant already has keeps the consent Nine Tables holds, whatever your system says; the dry run counts the guests on whom the two disagree, so the restaurant can settle them itself.

A call carries 1 to 100 members, and each member costs one rate-limit token, as each item of POST /batch does. At the default limit of 120 a minute, a full call of 100 members followed at once by another answers 429; wait for Retry-After and send it again with the same Idempotency-Key. A call with more members than your key’s rate_limit_per_min could never fit a window, so it answers 400 instead.

For a large transfer, ask the restaurant for a key with a higher rate limit, or have them import your export as a file in the Nine Tables app, which takes a whole file at once. A call with an Idempotency-Key replays its answer and writes nothing more, so retry a lost answer with the key it was sent with.

The import key must reach every restaurant, because a transfer acts on guests of the whole tenant. A key limited to some restaurants is refused:

{
"type": "https://ninetables.io/problems/tenant-wide-key-required",
"title": "Tenant-Wide Key Required",
"status": 403,
"detail": "A loyalty import acts on every guest of the tenant, so it needs a key that reaches every restaurant; this key is limited to some",
"code": "TENANT_WIDE_KEY_REQUIRED"
}

Every call that is not a dry run is one import job, import_job_id in the answer, which the restaurant’s Owner can undo in the app within 48 hours, while the club is switched off and has not been on since the import: once it has been live, members may have earned on the imported counts. An import that updated members an earlier import brought in cannot be undone, since nothing recorded their state before it; the way back is a new import of the right data. A later import of the club stands in the way of an earlier one, since the undo would delete memberships the later import may have changed: the jobs of a transfer sent in several calls are undone newest first.

StatusWhen
400 validation-failedA field fails its rule, a restaurant is outside the tenant or the key, or a threshold no tier is at
403 insufficient-scopeThe key lacks the route’s loyalty: scope
403 tenant-wide-key-requiredAn import with a key limited to some restaurants
404 not-foundGET …/loyalty of a guest who does not exist
409 loyalty-not-installedThe tenant has not installed the loyalty club app
429 rate-limitedThe members of an import did not fit the key’s window

A rejected member is never an error: it is a line of the 200. See Errors for the problem body and which errors to retry.