Skip to navigation

Get Voucher

Retrieves a single voucher definition for the authenticated SP Digital business.

Example curl:

curl --request POST '{{base_url}}/sp/vouchers/get' \
--header 'Authorization: Bearer {{access_token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"voucher_id": {{voucher_id}}
}'

Example success response shape:

{
"success": true,
"message": "OK",
"data": {
"voucher_id": 10,
"campaign_name": "Birthday Voucher",
"coupon_code": "BIRTHDAY10",
"coupon_value": 10,
"archived": false
},
"meta": {}
}

Example error response shape:

{
"success": false,
"message": "Voucher not found.",
"error": {
"code": "voucher_not_found",
"details": {}
}
}

Common platform errors:

  • sp_scope_not_granted
  • sp_token_scope_missing
  • sp_location_not_allowed
  • legacy_field_not_allowed
  • query_parameters_not_allowed
  • invalid_content_type

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Headers

AuthorizationstringOptional

Response

200 OK Example
successbooleanOptional
messagestringOptional
dataobjectOptional
metaobjectOptional