credits.get_balance. Checking warning_low is a good place to prompt the operator for a code.
Parameters
string
required
The redeem code to apply, in its canonical format (for example
"SYN-XXXX-XXXX-XXXX-X"). Codes are case-sensitive.Returns
RedeemResult with the outcome of the redemption.
string
Stable identifier for this redemption. Use it to correlate with the matching ledger entry from
credits.get_ledger.float
Number of credits added to the wallet by this code.
float
Total wallet balance after the redemption, in credits.
datetime | None
When the newly funded bucket expires, if the code carries an expiry.
None means the granted credits do not expire.Example
Raises
InvalidInputError: when the code is malformed or unknown.InsufficientCreditsError: when the code has already been redeemed, has expired, or has been exhausted. The exception’sbalance_creditsfield isNonefor these cases, so you can surface the error message directly.SynapAuthError: when the API key is missing or invalid.