Create Vendor Redemption

Vendor Redemption API enables a brand to interact with third-party vendor systems for redeeming rewards. For example a brand wants to issue a gift card through a third-party vendor, ABC. This API provides the necessary details to the ABC vendor to process the reward redemption.

Example request

curl --location 'https://eu.api.capillarytech.com/api_gateway/rewards/core/v1/vendor/redemption/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic aWFtc2hpdmblahblahNjI3YjJlODM4ZjhlMzRkNWI1YTI5MWY=' \
--data '{
    "brandId": 1,
    "vendorId": 36,
    "name": "Miles",
    "redemptionType": "MILES",
    "actions": [
        {
            "name": "add good will points",
            "execOrder": 1,
            "apiUrl": "https://crm-nightly-new.cc.capillarytech.com/v1.1/request/add?program_id=2851",
            "apiType": "POST",
            "apiHeaders": {
                "accept": "application/json",
                "Content-Type": "application/json",
                "Authorization": "Basic bHVjaWF1dG9fdGlsbF8xMDoyMDJjYjk2MmFjNTkwNzViOTY0YjA3MTUyZDIzNGI3MA=="
            },
             "apiBody" : "{\"transactionId_property\": \"${rewardTransactionId}\",\"customFields_property\": {\"customField_1_property\": \"${customfield_CF1}\"}, \"fulfillmentStatus_property\": \"${fulfillmentStatus}\"}",
            "contextKeys": {
                "voucher": "response.requests.request.get(0).id"
            }
        }
    ],
    "responseKeys": [
        "voucher"
    ]
}'

Pre-requisites

  • Authentication: Basic or OAuth authentication.
  • Default access group

Rate limit

  • Demo and Testing Clusters: 1,000 requests per minute per API key
  • Other Organizations: The rate limit is brand-specific.

To modify the limit, create a ticket with the Capillary Product support team.

Body parameters

Field

Type

Required

Description

brandId

Integer

Yes

The unique ID of the brand.

vendorId

String

Yes

The unique ID of the vendor.

name

String

Optional

The name defined by the brand for the vendor reward.

redemptionType

Enum

Optional

Defines the method by which a customer can redeem rewards.

.actions

Array of Objects

Optional

An array containing action objects to be executed.

..name

String

Optional

The name of the action to be executed.

..execOrder

Integer

Optional

The execution order of the action.

..apiUrl

String

Optional

The URL to which the API request is made.

..apiType

String

Optional

The HTTP method to be used for the API request.

.apiHeaders

Object

Optional

An object containing the headers to be sent with the API request.

..accept

String

Optional

Indicates the expected response format.

..Content-Type

String

Optional

Indicates the format of the request body.

..Authorization

String

Optional

Defines the authentication credentials.

.apiBody

String

Optional

Defines the API body for the external API endpoint, allowing you to include additional data like custom fields, fulfillment status, and the reward transaction ID.

.contextKeys

Object

Optional

An object containing context keys for extracting values from the response.

..voucher

String

Optional

Defines a temporary variable to hold data from an API's response for use in subsequent API calls. Example: An API returns the discount code "SAVE20". You store this as "voucher" to pass into the next API to activate the code, and then another API to send it via SMS.

.responseKeys

Array of Strings

Optional

An array of keys to be extracted from the API response for subsequent use.

..voucher

String

Optional

Defines what data is returned in the final response to the client. ** Example:** After collecting "voucher", "status", and "transactionId", setting responseKeys to show just the voucher ensures the customer only sees "Your code SAVE20 is active," ensuring internal details are secure.

Example response

{
    "status": {
        "success": true,
        "code": 5012,
        "message": "Vendor redemption created successfully"
    },
    "redemption": {
        "id": 27802,
        "name": "jotest",
        "redemptionType": "VOUCHER",
        "enabled": true,
        "lastUpdatedOn": 1748344737000,
        "lastUpdatedOnDateTime": "2025-05-27T11:18:57Z",
        "actionCount": 1,
        "createdBy": 75161973,
        "lastUpdatedBy": 75161973,
        "createdOn": 1748344737000,
        "createdOnDateTime": "2025-05-27T11:18:57Z"
    }
}

Response parameters

FieldTypeDescription
successBooleanIndicates whether the API call was successful or not.
codeIntegerThe code associated with the response.
messageStringA message providing details about the response.
idIntegerThe unique identifier for the redemption object.
nameStringThe name associated with the redemption object.
redemptionTypeEnumThe type of redemption.
enabledBooleanIndicates whether the redemption is currently enabled.
lastUpdatedOnDateIndicates the timestamp when the vendor redemption was updated. The timestamp is in Epoch time format.
actionCountIntegerThe count of the number of redemptions.
lastUpdatedByLongThe unique identifier of the user who last updated the vendor redemption record.
createdByStringThe unique identifier of the user who created the vendor redemption.
createdOnStringIndicates the timestamp when the vendor redemption was created. The timestamp is in Epoch time format.

Error codes

CodeDescription
400Invalid Request. Check the required parameters.
500Unexpected error. An internal server error occurred. Retry the request after a short delay. If the issue persists, contact support with the request details.
5013Unable to create vendor redemption.There was an issue during the creation process. Review your request payload for any errors or conflicts, and try again.
Language
URL
Click Try It! to start a request and see the response here!