BizKitHub
DokumentationAPI-ExplorerVoucher/api/v1/voucher/analyze
getVoucherÖffentliche API v1

/api/v1/voucher/analyze

Public mirror of /bff/voucher/analyze. Returns a lightweight snapshot of a voucher: whether it exists in the organisation and, if it does, its computed status (active / inactive / expired / not-yet-valid / limit-reached). Does NOT throw when the voucher is missing — the exists=false branch carries rejectionReason="code_not_found". When redeemContext is supplied, the response additionally carries the rejection reason this voucher would hit for that context. When identityId is supplied and resolves to a known contact, the engine also evaluates the "single use per customer" check. Read-only — never increments usedCount or writes an audit log.

VouchergetApiV1VoucherAnalyze

Parameter

5 in der Query

Query-Parameter

· 5
apiKeystringPflicht

Your BizKitHub API key (passed as GET parameter).

Key format: A 32-character string matching: ^(PROD|DEV_|ROOT)[A-Za-z0-9]{28}$
Prefixes: PROD (production key), DEV_ (individual developer), ROOT (system key with no limits). Learn more

BeispielPRODPGrFxpGEtrOZfuWhnoJohUYBXuOE
codestringPflicht

Voucher code to analyze. Server trims + uppercases.

BeispielSUMMER2024
redeemContextstringOptional

Optional redemption context. "order" = voucher is being added to a reservation/order; "voucher_page" = voucher is being redeemed on the dedicated voucher-redeem page. When present, the response includes rejectionReason/rejectionMessage reflecting what the order engine would answer today.

Beispielorder
identityIdstringOptional

Logged user identity (from your frontend cookies). Learn more

BeispielZ9CPkS2o3UV163VQn5OUv0T8BQi8Fvdg
customerRealIpstringOptional

User IP address used for GEO/IP intelligence.

Accepted formats:

  • IPv4 dot-decimal, e.g. 1.1.1.1 (4 octets, 0–255, no leading zeros).
  • IPv6 as defined by RFC 4291 — full 2001:0db8:0000:0000:0000:0000:0000:0001, zero-compressed 2001:db8::1, IPv4-mapped ::ffff:1.2.3.4, or scoped literals. Both upper- and lower-case hex are accepted.

Server-side canonicalization (ipNormalize in core/src/lib/network/ipNormalize.ts):

  • Valid IPv4 is passed through verbatim.
  • Valid IPv6 is lowercased (RFC 5952 §4.3).
  • IPv4-mapped IPv6 ::ffff:X.X.X.X is unwrapped to plain IPv4 (RFC 4291 §2.5.5.2) so 1.2.3.4 and ::ffff:1.2.3.4 share one brj__geo_ip row.
  • Loopback aliases (::1, 0.0.0.0, localhost, empty string) collapse to 127.0.0.1.
  • Junk values that fail both IPv4 and IPv6 validation are silently rejected and replaced with 127.0.0.1 (loopback).

On the wire: every response returns the canonicalized form — clients can safely rely on lowercase IPv6 and the plain-IPv4 unwrap when de-duping or joining. Server-originated writers (activity log, session log, ban list) resolve the visitor IP via resolveClientIp / resolveClientIpOrNull — always native IPv6 on Vercel Edge (there is no auto-mapping to ::ffff:X.X.X.X).

Enrichment: the system resolves reverse DNS, geolocation, ASN, mobile/proxy/hosting/Tor flags via our VikiTron GEO/IP resolver for both address families. Learn more

Beispiel1.1.1.1

Antwortschema

1 dokumentierter Statuscode

200ErfolgVoucher analysis result.
object | object

Voucher analysis result.

Eine von 2 Varianten:
Variante 1

Voucher not found.

exists"false"Pflicht

Voucher with this code does not exist.

rejectionReason"code_not_found"Pflicht

Always "code_not_found" for the exists=false branch.

rejectionMessagestringPflicht

Human-readable reason, pre-formatted for the frontend.

Variante 2

Voucher exists — snapshot with computed status.

exists"true"Pflicht
codestringPflicht

Voucher code (canonical, uppercase).

type"fixed" | "percentage" | "free-credit" | "free-product"Pflicht

Discount type.

valuestringPflicht

Discount value.

activebooleanPflicht

Database active flag (does NOT consider expiration/limit).

effectivelyActivebooleanPflicht

True if voucher is currently usable (active + within validity + below limit).

isValidbooleanPflicht

Alias of effectivelyActive — convenient flag for UI consumers.

status"active" | "inactive" | "expired" | "not-yet-valid" | "limit-reached"Pflicht

Computed status enum.

usedCountnumberPflicht

Number of times voucher has been used.

usageLimitnumber | nullPflicht

Maximum number of uses, or null if unlimited.

remainingUsagenumber | nullPflicht

Remaining uses, or null if unlimited.

validFromDate | string | string | numberPflicht

Validity start date.

Eine von 4 Varianten:
Variante 1
Date
Variante 2
stringdate-time
Variante 3
stringdate
Variante 4
number
validToDate | string | string | numberPflicht

Validity end date.

Eine von 4 Varianten:
Variante 1
Date
Variante 2
stringdate-time
Variante 3
stringdate
Variante 4
number
daysUntilExpirationnumber | nullPflicht

Days remaining until expiration, or null if no expiration or already expired.

lastUsedDateDate | string | string | numberPflicht

Last usage date.

Eine von 4 Varianten:
Variante 1
Date
Variante 2
stringdate-time
Variante 3
stringdate
Variante 4
number
notestringPflicht

Internal note (full content).

isOrderSingletonbooleanPflicht

If true, voucher cannot be combined with other vouchers inside a single order.

singleUsePerCustomerbooleanPflicht

If true, every customer may redeem this voucher on at most one order.

redeemableAtOrderbooleanPflicht

If true, voucher may be redeemed on the reservation / order form.

redeemableAtVoucherPagebooleanPflicht

If true, voucher may be redeemed on the dedicated "redeem voucher" page (typically used for free-credit vouchers).

rejectionReason"code_not_found" | "inactive" | "not_yet_valid" | "expired" | "usage_limit_reached" | "already_used_by_customer" | "wrong_redemption_context" | nullPflicht

Rejection reason the order engine would answer for this voucher in the supplied redeemContext. Null when the voucher would be accepted or when redeemContext was not supplied.

Eine von 8 Varianten:
Variante 1
"code_not_found"
Variante 2
"inactive"
Variante 3
"not_yet_valid"
Variante 4
"expired"
Variante 5
"usage_limit_reached"
Variante 6
"already_used_by_customer"
Variante 7
"wrong_redemption_context"
Variante 8
null
rejectionMessagestring | nullPflicht

Human-readable rejection message. Null when accepted or no context passed.

acceptedForContext"order" | "voucher_page" | nullPflicht

When the engine accepted the voucher this echoes the requested redeemContext; otherwise null.

Eine von 3 Varianten:
Variante 1
"order"
Variante 2
"voucher_page"
Variante 3
null

Antwortbeispiel

application/json
{
  "exists": false,
  "rejectionReason": "code_not_found",
  "rejectionMessage": "example_rejectionMessage"
}

Anfragebeispiel

GET /api/v1/voucher/analyze

get
curl -X GET "https://api.bizkithub.com/api/v1/voucher/analyze?apiKey=PRODPGrFxpGEtrOZfuWhnoJohUYBXuOE&code=SUMMER2024&redeemContext=order&identityId=Z9CPkS2o3UV163VQn5OUv0T8BQi8Fvdg&customerRealIp=1.1.1.1" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"

Sie brauchen einen API-Schlüssel?

Alle öffentlichen Endpunkte der BizKitHub-API authentifizieren per API-Schlüssel.

API-Schlüssel erhalten