Skip to main content
PUT
/
programs
/
{programId}
/
merchant-action-triggers
Register merchant triggers at program scope
curl --request PUT \
  --url https://east.sandbox.spade.com/programs/{programId}/merchant-action-triggers \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "merchantTriggers": [
    {
      "id": "<string>",
      "merchantName": "<string>",
      "action": {
        "type": "<string>"
      },
      "website": "<string>",
      "address": "<string>",
      "city": "<string>",
      "region": "<string>",
      "country": "<string>",
      "postalCode": "<string>",
      "latitude": 123,
      "longitude": 123,
      "customAttributes": {}
    }
  ]
}
'
import requests

url = "https://east.sandbox.spade.com/programs/{programId}/merchant-action-triggers"

payload = { "merchantTriggers": [
{
"id": "<string>",
"merchantName": "<string>",
"action": { "type": "<string>" },
"website": "<string>",
"address": "<string>",
"city": "<string>",
"region": "<string>",
"country": "<string>",
"postalCode": "<string>",
"latitude": 123,
"longitude": 123,
"customAttributes": {}
}
] }
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: '<string>',
merchantName: '<string>',
action: {type: '<string>'},
website: '<string>',
address: '<string>',
city: '<string>',
region: '<string>',
country: '<string>',
postalCode: '<string>',
latitude: 123,
longitude: 123,
customAttributes: {}
}
]
})
};

fetch('https://east.sandbox.spade.com/programs/{programId}/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/programs/{programId}/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' => '<string>',
'merchantName' => '<string>',
'action' => [
'type' => '<string>'
],
'website' => '<string>',
'address' => '<string>',
'city' => '<string>',
'region' => '<string>',
'country' => '<string>',
'postalCode' => '<string>',
'latitude' => 123,
'longitude' => 123,
'customAttributes' => [

]
]
]
]),
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/programs/{programId}/merchant-action-triggers"

payload := strings.NewReader("{\n \"merchantTriggers\": [\n {\n \"id\": \"<string>\",\n \"merchantName\": \"<string>\",\n \"action\": {\n \"type\": \"<string>\"\n },\n \"website\": \"<string>\",\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"region\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"customAttributes\": {}\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/programs/{programId}/merchant-action-triggers")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchantTriggers\": [\n {\n \"id\": \"<string>\",\n \"merchantName\": \"<string>\",\n \"action\": {\n \"type\": \"<string>\"\n },\n \"website\": \"<string>\",\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"region\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"customAttributes\": {}\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://east.sandbox.spade.com/programs/{programId}/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\": \"<string>\",\n \"merchantName\": \"<string>\",\n \"action\": {\n \"type\": \"<string>\"\n },\n \"website\": \"<string>\",\n \"address\": \"<string>\",\n \"city\": \"<string>\",\n \"region\": \"<string>\",\n \"country\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"customAttributes\": {}\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "version": 123,
  "merchantTriggers": [
    {
      "id": "<string>",
      "action": {}
    }
  ],
  "totalCount": 123
}
{
"invalidField": [
"<string>"
]
}
{
"details": "<string>"
}
{
"detail": "<string>"
}
{
"details": "<string>"
}

Authorizations

X-Api-Key
string
header
required

Path Parameters

programId
string
required

Your unique identifier for the program

Maximum string length: 512

Body

application/json

Request body for registering merchant action triggers.

merchantTriggers
object[]
required

List of merchant triggers to register for action matching. Each trigger must have a unique id.

Field requirements:

  • id, merchantName, and action are always required
  • If location fields (address, city) are NOT provided, website is required

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.

Required array length: 1 - 100000 elements

Response

Registration created successfully

Response containing the status of an action trigger registration.

status
enum<string>

The current status of the action trigger registration.

  • pending: Registration received, processing not yet started
  • running: Registration is being processed (for batch registrations with >100 triggers)
  • succeeded: Registration complete, triggers are now active
  • failed: Registration failed, check your request and retry
Available options:
pending,
running,
succeeded,
failed
Example:

"succeeded"

version
integer

The version number of this registration. Increments with each PUT, PATCH, or DELETE request to this scope.

Example:

1

merchantTriggers
object[]

The list of active merchant triggers registered for this scope. Present on GET responses; omitted on PUT and PATCH responses.

totalCount
integer

The total number of active merchant triggers registered for this scope. Present on GET responses; omitted on PUT and PATCH responses.

Example:

50000