curl --request PUT \
--url https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"merchantTriggers": [
{
"id": "trigger-12345",
"merchantName": "Starbucks",
"action": {
"type": "REWARD",
"rewardPercent": 5,
"offerId": "offer-abc123"
},
"website": "https://www.starbucks.com",
"address": "123 Main St",
"city": "Seattle",
"region": "WA",
"country": "USA",
"postalCode": "98101",
"latitude": 47.6062,
"longitude": -122.3321,
"level": "corporation",
"customAttributes": {
"storeId": "store-789"
}
}
]
}
'import requests
url = "https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers"
payload = { "merchantTriggers": [
{
"id": "trigger-12345",
"merchantName": "Starbucks",
"action": {
"type": "REWARD",
"rewardPercent": 5,
"offerId": "offer-abc123"
},
"website": "https://www.starbucks.com",
"address": "123 Main St",
"city": "Seattle",
"region": "WA",
"country": "USA",
"postalCode": "98101",
"latitude": 47.6062,
"longitude": -122.3321,
"level": "corporation",
"customAttributes": { "storeId": "store-789" }
}
] }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantTriggers: [
{
id: 'trigger-12345',
merchantName: 'Starbucks',
action: {type: 'REWARD', rewardPercent: 5, offerId: 'offer-abc123'},
website: 'https://www.starbucks.com',
address: '123 Main St',
city: 'Seattle',
region: 'WA',
country: 'USA',
postalCode: '98101',
latitude: 47.6062,
longitude: -122.3321,
level: 'corporation',
customAttributes: {storeId: 'store-789'}
}
]
})
};
fetch('https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'merchantTriggers' => [
[
'id' => 'trigger-12345',
'merchantName' => 'Starbucks',
'action' => [
'type' => 'REWARD',
'rewardPercent' => 5,
'offerId' => 'offer-abc123'
],
'website' => 'https://www.starbucks.com',
'address' => '123 Main St',
'city' => 'Seattle',
'region' => 'WA',
'country' => 'USA',
'postalCode' => '98101',
'latitude' => 47.6062,
'longitude' => -122.3321,
'level' => 'corporation',
'customAttributes' => [
'storeId' => 'store-789'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers"
payload := strings.NewReader("{\n \"merchantTriggers\": [\n {\n \"id\": \"trigger-12345\",\n \"merchantName\": \"Starbucks\",\n \"action\": {\n \"type\": \"REWARD\",\n \"rewardPercent\": 5,\n \"offerId\": \"offer-abc123\"\n },\n \"website\": \"https://www.starbucks.com\",\n \"address\": \"123 Main St\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"country\": \"USA\",\n \"postalCode\": \"98101\",\n \"latitude\": 47.6062,\n \"longitude\": -122.3321,\n \"level\": \"corporation\",\n \"customAttributes\": {\n \"storeId\": \"store-789\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchantTriggers\": [\n {\n \"id\": \"trigger-12345\",\n \"merchantName\": \"Starbucks\",\n \"action\": {\n \"type\": \"REWARD\",\n \"rewardPercent\": 5,\n \"offerId\": \"offer-abc123\"\n },\n \"website\": \"https://www.starbucks.com\",\n \"address\": \"123 Main St\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"country\": \"USA\",\n \"postalCode\": \"98101\",\n \"latitude\": 47.6062,\n \"longitude\": -122.3321,\n \"level\": \"corporation\",\n \"customAttributes\": {\n \"storeId\": \"store-789\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchantTriggers\": [\n {\n \"id\": \"trigger-12345\",\n \"merchantName\": \"Starbucks\",\n \"action\": {\n \"type\": \"REWARD\",\n \"rewardPercent\": 5,\n \"offerId\": \"offer-abc123\"\n },\n \"website\": \"https://www.starbucks.com\",\n \"address\": \"123 Main St\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"country\": \"USA\",\n \"postalCode\": \"98101\",\n \"latitude\": 47.6062,\n \"longitude\": -122.3321,\n \"level\": \"corporation\",\n \"customAttributes\": {\n \"storeId\": \"store-789\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "succeeded",
"version": 1,
"merchantTriggers": [
{
"id": "merchant_123",
"action": {
"type": "REWARD",
"points": 200
}
}
],
"totalCount": 50000
}{
"invalidField": [
"This field is required."
]
}{
"details": "Incorrect authentication credentials."
}{
"detail": "An action trigger registration is already in progress for this scope."
}{
"details": "Internal server error."
}Register merchant triggers at user scope
Register merchant action triggers at the user scope.
User-level triggers apply to all transactions for all cards belonging to the specified user.
Field requirements:
id,merchantName, andactionare always required for each triggerleveldefaults tolocationif omitted- For
level: "location"(default): requires bothaddressandpostalCode, or bothlatitudeandlongitude - For
level: "corporation": requireswebsiteon its own, or bothaddressandpostalCode, or bothlatitudeandlongitude - Triggers that don’t meet these requirements are rejected with a
400error
Limit: A maximum of 100 merchantTriggers can be submitted per request at the user scope. Requests exceeding this limit will receive a 400 error.
Important: Triggers are only applied to enrichment responses when the status is succeeded.
To learn more about action triggers, please read the Merchant Action Triggers Guide.
curl --request PUT \
--url https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"merchantTriggers": [
{
"id": "trigger-12345",
"merchantName": "Starbucks",
"action": {
"type": "REWARD",
"rewardPercent": 5,
"offerId": "offer-abc123"
},
"website": "https://www.starbucks.com",
"address": "123 Main St",
"city": "Seattle",
"region": "WA",
"country": "USA",
"postalCode": "98101",
"latitude": 47.6062,
"longitude": -122.3321,
"level": "corporation",
"customAttributes": {
"storeId": "store-789"
}
}
]
}
'import requests
url = "https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers"
payload = { "merchantTriggers": [
{
"id": "trigger-12345",
"merchantName": "Starbucks",
"action": {
"type": "REWARD",
"rewardPercent": 5,
"offerId": "offer-abc123"
},
"website": "https://www.starbucks.com",
"address": "123 Main St",
"city": "Seattle",
"region": "WA",
"country": "USA",
"postalCode": "98101",
"latitude": 47.6062,
"longitude": -122.3321,
"level": "corporation",
"customAttributes": { "storeId": "store-789" }
}
] }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantTriggers: [
{
id: 'trigger-12345',
merchantName: 'Starbucks',
action: {type: 'REWARD', rewardPercent: 5, offerId: 'offer-abc123'},
website: 'https://www.starbucks.com',
address: '123 Main St',
city: 'Seattle',
region: 'WA',
country: 'USA',
postalCode: '98101',
latitude: 47.6062,
longitude: -122.3321,
level: 'corporation',
customAttributes: {storeId: 'store-789'}
}
]
})
};
fetch('https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'merchantTriggers' => [
[
'id' => 'trigger-12345',
'merchantName' => 'Starbucks',
'action' => [
'type' => 'REWARD',
'rewardPercent' => 5,
'offerId' => 'offer-abc123'
],
'website' => 'https://www.starbucks.com',
'address' => '123 Main St',
'city' => 'Seattle',
'region' => 'WA',
'country' => 'USA',
'postalCode' => '98101',
'latitude' => 47.6062,
'longitude' => -122.3321,
'level' => 'corporation',
'customAttributes' => [
'storeId' => 'store-789'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers"
payload := strings.NewReader("{\n \"merchantTriggers\": [\n {\n \"id\": \"trigger-12345\",\n \"merchantName\": \"Starbucks\",\n \"action\": {\n \"type\": \"REWARD\",\n \"rewardPercent\": 5,\n \"offerId\": \"offer-abc123\"\n },\n \"website\": \"https://www.starbucks.com\",\n \"address\": \"123 Main St\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"country\": \"USA\",\n \"postalCode\": \"98101\",\n \"latitude\": 47.6062,\n \"longitude\": -122.3321,\n \"level\": \"corporation\",\n \"customAttributes\": {\n \"storeId\": \"store-789\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchantTriggers\": [\n {\n \"id\": \"trigger-12345\",\n \"merchantName\": \"Starbucks\",\n \"action\": {\n \"type\": \"REWARD\",\n \"rewardPercent\": 5,\n \"offerId\": \"offer-abc123\"\n },\n \"website\": \"https://www.starbucks.com\",\n \"address\": \"123 Main St\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"country\": \"USA\",\n \"postalCode\": \"98101\",\n \"latitude\": 47.6062,\n \"longitude\": -122.3321,\n \"level\": \"corporation\",\n \"customAttributes\": {\n \"storeId\": \"store-789\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://east.sandbox.spade.com/users/{userId}/merchant-action-triggers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchantTriggers\": [\n {\n \"id\": \"trigger-12345\",\n \"merchantName\": \"Starbucks\",\n \"action\": {\n \"type\": \"REWARD\",\n \"rewardPercent\": 5,\n \"offerId\": \"offer-abc123\"\n },\n \"website\": \"https://www.starbucks.com\",\n \"address\": \"123 Main St\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"country\": \"USA\",\n \"postalCode\": \"98101\",\n \"latitude\": 47.6062,\n \"longitude\": -122.3321,\n \"level\": \"corporation\",\n \"customAttributes\": {\n \"storeId\": \"store-789\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "succeeded",
"version": 1,
"merchantTriggers": [
{
"id": "merchant_123",
"action": {
"type": "REWARD",
"points": 200
}
}
],
"totalCount": 50000
}{
"invalidField": [
"This field is required."
]
}{
"details": "Incorrect authentication credentials."
}{
"detail": "An action trigger registration is already in progress for this scope."
}{
"details": "Internal server error."
}Authorizations
Path Parameters
Your unique identifier for the user
512Body
Request body for registering merchant action triggers.
List of merchant triggers to register for action matching. Each trigger must have a unique id.
Field requirements:
id,merchantName, andactionare always requiredleveldefaults tolocationif omitted- For
level: "location"(default): requires bothaddressandpostalCode, or bothlatitudeandlongitude - For
level: "corporation": requireswebsiteon its own, or bothaddressandpostalCode, or bothlatitudeandlongitude - Triggers that don't meet these requirements are rejected with a
400error
Limits: User-scope and card-scope registrations are limited to 100 triggers. Account-scope and program-scope registrations with more than 100 triggers will be processed asynchronously as a batch job.
1 - 100000 elementsShow child attributes
Show child attributes
Response
Registration created successfully
Response containing the status of an action trigger registration.
The current status of the action trigger registration.
pending: Registration received, processing not yet startedrunning: Registration is being processed (for batch registrations with >100 triggers)succeeded: Registration complete, triggers are now activefailed: Registration failed, check your request and retry
pending, running, succeeded, failed "succeeded"
The version number of this registration. Increments with each PUT, PATCH, or DELETE request to this scope.
1
The list of active merchant triggers registered for this scope. Present on GET responses; omitted on PUT and PATCH responses.
Show child attributes
Show child attributes
The total number of active merchant triggers registered for this scope. Present on GET responses; omitted on PUT and PATCH responses.
50000

