Voor ontwikkelaars

Koppel Valucher aan je eigen systemen

Zapier, je kassasysteem of maatwerk — met de REST API geef je kaarten uit en boek je credits af vanuit elke tool. In zeven stappen live.

1API-sleutel aanmaken

Ga naar Account › API-sleutels en maak een nieuwe sleutel aan. Geef hem een naam die aangeeft waar hij voor wordt gebruikt (bijv. "Zapier" of "Kassasysteem"). De sleutel wordt precies één keer getoond — sla hem op voordat je het venster sluit.

Een API-sleutel geeft volledige toegang tot je account. Deel hem niet, sla hem niet op in versiebeheersystemen, en trek hem in zodra je hem niet meer nodig hebt.
Naar Account › API-sleutels

2Authenticatie

Voeg bij elk API-verzoek de sleutel toe als Authorization-header:

Authorization: Bearer <jouw-api-sleutel>

Test of de sleutel werkt door je profiel op te vragen:

curl https://valucher.com/api/v1/me \
  -H "Authorization: Bearer <jouw-api-sleutel>"

Een succesvolle respons heeft HTTP 200 met je gebruikersgegevens en de lijst van organisaties waarbij je bent aangesloten.

3Organisatie-ID ophalen

Het aanmaken en oplijsten van kaarten vereist een X-Organisation-Id-header, zodat de API weet onder welke organisatie de kaart hoort. Acties op een bestaande kaart (uitgeven, inwisselen, opvragen) hebben de header niet nodig — de kaart is al aan een organisatie gekoppeld. Je vindt je organisatie-ID's in de respons van GET /me:

curl https://valucher.com/api/v1/me \
  -H "Authorization: Bearer <jouw-api-sleutel>" \
  | jq '.data.organisations[] | {id, name}'

Sla het ID op voor stap 4. In de onderstaande voorbeelden staat 42 als voorbeeld.

4Kaart aanmaken

Een Valucher wordt aangemaakt als concept (issued: false). Je bepaalt zelf wanneer je hem uitgeeft (stap 5), zodat je hem eerst kunt controleren of de klantgegevens kunt koppelen.

VeldTypeBeschrijving
namestringNaam van de kaart (bijv. "10 lessen Yoga — Jan de Vries")
unit_namestringNaam van één strip (bijv. "les", "behandeling", "beurt")
unit_amountinteger ≥ 1Totaal aantal strippen
unit_valuedecimal ≥ 0.01Waarde per strip in euro
referencestring (optioneel)Jouw interne referentie (klantnummer, ordernummer)
expire_dateYYYY-MM-DD (optioneel)Vervaldatum
issueboolean (optioneel)Stuur true om de kaart direct uit te geven
curl -X POST https://valucher.com/api/v1/vouchers \
  -H "Authorization: Bearer <jouw-api-sleutel>" \
  -H "X-Organisation-Id: 42" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "10 lessen Yoga — Jan de Vries",
    "unit_name": "les",
    "unit_amount": 10,
    "unit_value": 9.50,
    "reference": "KLANT-1234"
  }'

De respons bevat de nieuwe kaart met zijn unieke code (8 tekens, bijv. TGD596BC). Die code heb je nodig voor stappen 5, 6 en 7.

5Kaart uitgeven

Uitgeven activeert de kaart en trekt credits af van je saldo (kosten = unit_amount × unit_value in euro's). Na het uitgeven is de kaart zichtbaar op valucher.com/code/<code> en kan hij worden ingewisseld. De organisatie wordt automatisch bepaald vanuit de kaart — geen header nodig.

curl -X POST https://valucher.com/api/v1/vouchers/TGD596BC/issue \
  -H "Authorization: Bearer <jouw-api-sleutel>"
Wil je aanmaken en uitgeven in één stap? Voeg "issue": true toe aan het verzoek van stap 4.

6Strip inwisselen

Wissel één of meer strippen in wanneer de klant gebruik maakt van de kaart. De description verschijnt in de gebruikshistorie op de kaart. De organisatie wordt automatisch bepaald vanuit de kaart — geen header nodig.

VeldTypeBeschrijving
unitsinteger ≥ 1Aantal in te wisselen strippen
descriptionstringOmschrijving (bijv. "Les dinsdag 01-07-2026")
curl -X POST https://valucher.com/api/v1/vouchers/TGD596BC/redeem \
  -H "Authorization: Bearer <jouw-api-sleutel>" \
  -H "Content-Type: application/json" \
  -d '{
    "units": 1,
    "description": "Les dinsdag 01-07-2026"
  }'

7Kaart opvragen

Haal de actuele stand van een kaart op, inclusief gebruikshistorie en resterende strippen. De organisatie wordt automatisch bepaald vanuit de kaart — geen header nodig.

curl https://valucher.com/api/v1/vouchers/TGD596BC \
  -H "Authorization: Bearer <jouw-api-sleutel>"

Relevante velden in de respons:

VeldBeschrijving
statusdraft · active · depleted · expired · archived
remainingResterend aantal strippen
usedAantal ingewisselde strippen
usesArray van inwisselingen met datum en omschrijving

Foutcodes

Alle foutresponsen hebben HTTP 4xx en bevatten een error.code-veld:

HTTPcodeBetekenis
401unauthorizedOngeldige of verlopen API-sleutel
403forbiddenGeen lid van de opgegeven organisatie, of onvoldoende rechten
404not_foundKaart bestaat niet
409insufficient_creditsOnvoldoende credits om de kaart uit te geven
422invalid_stateActie niet mogelijk in de huidige kaart­status (bijv. al uitgegeven)
422validationVerplicht veld ontbreekt of heeft een ongeldige waarde

Nog geen account?

Maak gratis een account aan en krijg direct 1.000 credits cadeau — goed voor €1.000 aan strippen­kaarten.

Gratis beginnen
For developers

Connect Valucher to your own systems

Zapier, your POS or a custom build — the REST API lets you issue cards and redeem credits from any tool. Live in seven steps.

1Create an API key

Go to Account › API keys and create a new key. Give it a name that describes its purpose (e.g. "Zapier" or "POS system"). The key is shown exactly once — copy it before closing the dialog.

An API key grants full access to your account. Do not share it, do not commit it to version control, and revoke it as soon as it is no longer needed.
Go to Account › API keys

2Authentication

Include your key in every request as an Authorization header:

Authorization: Bearer <your-api-key>

Verify the key works by fetching your profile:

curl https://valucher.com/api/v1/me \
  -H "Authorization: Bearer <your-api-key>"

A successful response is HTTP 200 with your user details and the list of organisations you belong to.

3Get your organisation ID

Creating and listing cards requires an X-Organisation-Id header so the API knows which organisation the card belongs to. Actions on an existing card (issue, redeem, view) do not need it — the card is already tied to an organisation. Find your organisation IDs in the GET /me response:

curl https://valucher.com/api/v1/me \
  -H "Authorization: Bearer <your-api-key>" \
  | jq '.data.organisations[] | {id, name}'

Save the ID for step 4. The examples use 42 as a placeholder.

4Create a card

A Valucher is created as a draft (issued: false). You control when to issue it (step 5), so you can review it or attach customer details first.

FieldTypeDescription
namestringCard name (e.g. "10 Yoga lessons — Jane Smith")
unit_namestringName of one unit (e.g. "lesson", "treatment", "session")
unit_amountinteger ≥ 1Total number of units on the card
unit_valuedecimal ≥ 0.01Value per unit in euros
referencestring (optional)Your internal reference (customer number, order ID)
expire_dateYYYY-MM-DD (optional)Expiry date
issueboolean (optional)Send true to issue the card immediately
curl -X POST https://valucher.com/api/v1/vouchers \
  -H "Authorization: Bearer <your-api-key>" \
  -H "X-Organisation-Id: 42" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "10 Yoga lessons — Jane Smith",
    "unit_name": "lesson",
    "unit_amount": 10,
    "unit_value": 9.50,
    "reference": "CUSTOMER-1234"
  }'

The response contains the new card including its unique code (8 characters, e.g. TGD596BC). You need this code for steps 5, 6, and 7.

5Issue a card

Issuing activates the card and deducts credits from your balance (cost = unit_amount × unit_value in euros). Once issued, the card is accessible at valucher.com/code/<code> and can be redeemed. The organisation is resolved from the card — no header needed.

curl -X POST https://valucher.com/api/v1/vouchers/TGD596BC/issue \
  -H "Authorization: Bearer <your-api-key>"
Want to create and issue in one call? Add "issue": true to the step 4 request body.

6Redeem a unit

Redeem one or more units when the customer uses their card. The description appears in the usage history on the card. The organisation is resolved from the card — no header needed.

FieldTypeDescription
unitsinteger ≥ 1Number of units to redeem
descriptionstringDescription (e.g. "Lesson Tuesday 01-07-2026")
curl -X POST https://valucher.com/api/v1/vouchers/TGD596BC/redeem \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "units": 1,
    "description": "Lesson Tuesday 01-07-2026"
  }'

7View a card

Fetch the current state of a card, including its usage history and remaining units. The organisation is resolved from the card — no header needed.

curl https://valucher.com/api/v1/vouchers/TGD596BC \
  -H "Authorization: Bearer <your-api-key>"

Key fields in the response:

FieldDescription
statusdraft · active · depleted · expired · archived
remainingUnits remaining on the card
usedUnits already redeemed
usesArray of individual redemptions with date and description

Error codes

All error responses are HTTP 4xx and include an error.code field:

HTTPcodeMeaning
401unauthorizedInvalid or expired API key
403forbiddenNot a member of the given organisation, or insufficient permissions
404not_foundCard does not exist
409insufficient_creditsNot enough credits to issue the card
422invalid_stateAction not possible in the card's current state (e.g. already issued)
422validationRequired field missing or invalid value

Don't have an account yet?

Sign up for free and get 1,000 credits instantly — enough for €1,000 worth of punch cards.

Get started free