Skip to main content
PATCH
/
programs
/
{programId}
/
category-action-triggers
Incremental category trigger operations at program scope
curl --request PATCH \
  --url https://east.sandbox.spade.com/programs/{programId}/category-action-triggers \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "categoryTriggers": [
    {
      "id": "<string>",
      "categoryId": "<string>",
      "action": {
        "type": "<string>"
      }
    }
  ],
  "triggerIds": [
    "<string>"
  ]
}
'
import requests

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

payload = {
"categoryTriggers": [
{
"id": "<string>",
"categoryId": "<string>",
"action": { "type": "<string>" }
}
],
"triggerIds": ["<string>"]
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
categoryTriggers: [{id: '<string>', categoryId: '<string>', action: {type: '<string>'}}],
triggerIds: ['<string>']
})
};

fetch('https://east.sandbox.spade.com/programs/{programId}/category-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}/category-action-triggers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'categoryTriggers' => [
[
'id' => '<string>',
'categoryId' => '<string>',
'action' => [
'type' => '<string>'
]
]
],
'triggerIds' => [
'<string>'
]
]),
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}/category-action-triggers"

payload := strings.NewReader("{\n \"categoryTriggers\": [\n {\n \"id\": \"<string>\",\n \"categoryId\": \"<string>\",\n \"action\": {\n \"type\": \"<string>\"\n }\n }\n ],\n \"triggerIds\": [\n \"<string>\"\n ]\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://east.sandbox.spade.com/programs/{programId}/category-action-triggers")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"categoryTriggers\": [\n {\n \"id\": \"<string>\",\n \"categoryId\": \"<string>\",\n \"action\": {\n \"type\": \"<string>\"\n }\n }\n ],\n \"triggerIds\": [\n \"<string>\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://east.sandbox.spade.com/programs/{programId}/category-action-triggers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"categoryTriggers\": [\n {\n \"id\": \"<string>\",\n \"categoryId\": \"<string>\",\n \"action\": {\n \"type\": \"<string>\"\n }\n }\n ],\n \"triggerIds\": [\n \"<string>\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "status": "succeeded",
  "version": 123
}
{
"version": 123,
"categoryTriggers": [
{
"id": "<string>",
"categoryId": "<string>",
"action": {}
}
],
"totalCount": 123
}
{
"invalidField": [
"<string>"
]
}
{
"details": "<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 incremental category action trigger operations.

  • For add: categoryTriggers is required. triggerIds is optional and ignored if provided.
  • For remove: triggerIds is required and must be a non-empty list.
operation
enum<string>
required

The operation to perform:

  • add: Register new category triggers or update existing ones
  • remove: Remove category triggers (excluded from enrichment lookups)
Available options:
add,
remove
Example:

"add"

categoryTriggers
object[]

List of category triggers to add. Required for the add operation.

If a trigger ID already exists, the old registration is replaced (upsert behavior).

Field requirements:

  • id, categoryId, and action are always required
Required array length: 1 - 300 elements
triggerIds
string[] | null

List of trigger IDs to remove. Required and must be non-empty for the remove operation.

Trigger IDs that are not currently active are silently ignored (idempotent).

For add operations, this field is optional and ignored if provided — you may pass null, [], or omit it entirely.

Maximum string length: 512
Example:
["travel-reward-1", "block-gambling"]

Response

Remove operation completed successfully

Response for the remove PATCH operation.

status
enum<string>
Available options:
succeeded
Example:

"succeeded"

version
integer

The version number of this operation.

Example:

5