- Expiration time passes
- Redemption is being registered for the session
- Manual release using a dedicated API endpoint (for vouchers only: Release Validation Session)
- Manual release using the Validations Manager in the Dashboard to unlock sessions.
- If the code redemption limit is set to
4
, Voucherify will be able to lock up to four sessions. Next sessions will result in thequantity_exceeded
error. - If the code redemption limit is set to
unlimited
, Voucherify will allow any number of sessions.
How to Lock Code Usage
Step 1: Validate code with session key
You can establish the locking session while validating the code. Put thesession
object in your request by following the session object reference.
Parameter | Description | Example |
---|---|---|
session.typestring required | Type of the session. Required to establish a new session.Supported session types are listed in the table at the end of this guide. | ”session”:{“type”: “LOCK”} |
session.keystring optional | Unique session identifier. | ”session”: {“key”: “ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts”,“type”: “LOCK”} |
session.ttl_unitstring optional Default value for session is 7 days | Defines the type of unit for session time. Allowed values: DAYS , HOURS , MICROSECONDS , MILLISECONDS , MINUTES , NANOSECONDS , SECONDS | ”session”: {“type”: “LOCK”,“ttl”: 7,“ttl_unit”: “DAYS”} |
session.ttlnumber optional Default value for session is 7 days | Value for the period of time that the session is active. Units for this paremter are defines by session.ttl_unit | ”session”: {“type”: “LOCK”,“ttl”: 7,“ttl_unit”: “DAYS”} |
Example validation request
If you do not establish a session timeframe by passing the
session.ttl
and session.ttl_unit
, it will be active for 7 days.Step 2: Redeem the code with the session key
Usage of the code is locked and allowed only with the returned session key that identifies the session. Note that multiple requests with the same key will always override existing session values. When redeeming the code, the session object needs to definesession.type
and session.key
.
Step 3: Track redemption
If the redemption request includes a propersession.key
value, the request is validated and the redemption is executed. When Voucherify registers a new redemption for the locked resource, the session is automatically released.

Registering a session will record a temporary usage for the specified timeframe. This means it will influence other incoming validation and redemption requests until the session is released.Once redemption is successful the session is removed automatically.
Session Keys
The following table presents the type of sessions that can be established.Session Type | Behaviour |
---|---|
LOCK | Locks the following parameters within the session: - redemption quantity by 1 - redemption gift credits specified with the requests - redemption loyalty points specified with the request |
Go to Voucherify Postman Collection, where you can test the Locking Validation Session mechanism.