Przejdź do głównej zawartości

1. Getting started

Ta treść nie jest jeszcze dostępna w Twoim języku.

https://api.walletcraft.app/api/v1

Every request is HTTPS and JSON. Authenticate with an API key in the Authorization header:

Authorization: Bearer wc_…

API keys come with the Business plan (and Network); on Free and Start Create key answers plan-feature. Keys made earlier keep working if the plan changes — revoke the ones you no longer use.

  1. In the console, open API & webhooks (owners and admins see it).
  2. Give the key a name — where you’ll use it, e.g. “Website”.
  3. Choose its access:
    • Website — issue cards and read a card by its id (and its holder’s news consent). Nothing else: it can’t list or export customers, change cards or settings. Use it on websites.
    • Full access — everything except managing the team. Use it only in back-office systems you control.
  4. Copy the key. It’s shown once; we store only its hash. Lost it? Create a new one and revoke the old one.

A card is issued from a template you design in the console. Its id is in the template editor’s address: app.walletcraft.app/templates/<templateId>. Each field has a key (shown in the editor); values for fields without a default are required when you issue a card.

Errors are RFC 9457 problem details:

{
"type": "https://walletcraft.app/problems/not-enough-points",
"title": "Unprocessable Entity",
"status": 422,
"detail": "The card has 3 points"
}
Status Meaning
400 The request is malformed (e.g. a bad Idempotency-Key).
401 Missing, malformed or revoked API key.
403 The key’s access doesn’t allow this (e.g. a Website key listing cards).
404 Not found in your company.
409 Conflict with the current state (e.g. a voided card).
422 Invalid data (detail says what).
429 Too many requests — wait for Retry-After seconds.

The last part of type is a stable code your code can check (detail is for people and may change). Opening a type URL leads here. The codes integrations meet most:

Code Status What to do
validation-error 400 Fix the request; errors lists each field.
unauthorized 401 Send a valid key in Authorization: Bearer ….
forbidden 403 The key’s access doesn’t cover this route.
plan-feature 403 The company’s plan doesn’t include this feature.
plan-limit 403 The plan’s limit is reached (e.g. active cards).
contact-missing 403 Add the company’s address and a phone or email before issuing.
email-not-verified 403 The company’s owner hasn’t confirmed their email yet.
read-only 403 Payment is overdue: reading still works, changes don’t.
not-found 404 No such card, template or customer in your company.
pass-inactive 409 The card is voided or expired.
no-program 409 The card’s template has no loyalty program.
idempotency-key-in-progress 409 The first request with this key is still running: retry shortly.
not-enough-points 422 The balance is too low to redeem that many points.
reward-not-ready 422 The stamp card hasn’t reached its goal yet.
wrong-operation 422 That operation doesn’t fit the card’s program (e.g. a sale on points).
idempotency-key-reused 422 A different request used this key: make a new key.
rate-limited 429 Wait for Retry-After seconds.

Requests that create something (issue a card, record a purchase) accept an Idempotency-Key header. Repeating the same request with the same key within 24 hours returns the first response (with Idempotent-Replayed: true) instead of doing it twice — safe retries after timeouts. A different request with a used key answers 422.

Each key may send up to 600 requests per minute. Above that the API answers 429 with Retry-After.