Overview
Spade’s realtime action triggers allow you to register rules that trigger custom actions when transactions match your criteria. When a transaction matches one of your registered triggers, the enrichment response includes your customaction data.
Common use cases:
- Merchant rewards: Identify transactions at specific merchants to trigger reward multipliers
- Transaction flagging: Flag transactions for review based on merchant or category
Coming soon: Category-based triggers will allow you to trigger actions based on Spade categories (e.g., “Crypto”, “Gambling”).
Quick Start
- Ensure the actions feature is enabled - Contact your Spade representative if you need access
- Register your triggers using the PUT endpoint with your trigger configuration
- Wait for registration to complete - Check the GET endpoint until status is
succeeded - Enrich transactions - Matched triggers appear in the
actionsfield
Registration Scopes
Action triggers can be registered at three different scopes, with higher scopes cascading down to lower scopes:| Scope | Endpoint | Applies To | Limit |
|---|---|---|---|
| Account | /merchant-action-triggers | All transactions for all users in your account | 100,000 triggers per request |
| User | /users/{userId}/merchant-action-triggers | All transactions for all cards belonging to that user | 100 triggers per request |
| Card | /users/{userId}/cards/{cardId}/merchant-action-triggers | Only transactions for that specific card | 100 triggers per request |
- Card-level triggers (for that card)
- User-level triggers (for that user)
- Account-level triggers (for your account)
Registering Merchant Triggers
Use the PUT endpoint to register merchant triggers for action matching.Two matching modes for merchant triggers:
- Location-based: Provide
merchantName+ location fields (address, city, etc.) - Website-based: Provide
merchantName+websitewhen location data is unavailable
Example: Register Merchant Triggers
Response
Checking Registration Status
Use the GET endpoint to check the status of your action trigger registration.Status Values
| Status | Description |
|---|---|
pending | Registration received, processing not yet started |
running | Registration is being processed (for batch registrations) |
succeeded | Registration complete, triggers are now active |
failed | Registration failed, check your request and retry |
deleted | Trigger scope has been cleared via DELETE |
Example: Check Status
Batch Registrations (Account Scope Only)
Account-scope registrations with more than 100 merchant triggers are processed asynchronously as a batch job. Batch processing workflow:- Submit your account-scope registration via PUT - returns immediately with
status: "pending" - Poll the GET endpoint to monitor progress
- Status changes from
pending→running→succeeded(orfailed) - Once
succeeded, triggers are active for new enrichment requests
For large account-scope trigger lists, we recommend implementing a polling loop with exponential backoff. Most batch registrations complete within a few minutes.
Example: Polling for Completion
python
Clearing Triggers
Use the DELETE endpoint to clear all triggers at a given scope.DELETE creates a new version with an empty trigger list and sets the status to
deleted. The version number is incremented, not reset.Example: Clear Triggers
Receiving Triggered Actions
When a transaction matches one or more of your registered triggers, the enrichment response includes theactions field.
Triggered Action Response Fields
| Field | Description |
|---|---|
id | Your trigger ID (as provided during registration) |
type | The type of trigger that matched (e.g., merchant_trigger) |
action | Your custom action data from registration |
scope | The scope at which this trigger was registered (account, user, or card) |
Example: Enrichment Response with Triggered Actions
The
actions field is null when no triggers match, and is omitted entirely if your account does not have the actions feature enabled.Best Practices
Unique Trigger IDs
Always use unique IDs for each trigger. If duplicate IDs are submitted in a single request, the registration will fail.Action Structure
Design youraction schema upfront. This is your custom data - use it to store reward amounts, offer IDs, or any information you need when processing matched transactions.
The type field is required. There is currently one reserved keyword:
REWARD- For reward-based actions (e.g., cashback, points multipliers)
Scope Selection
- Use account scope for triggers that apply to all users (e.g., card-linked offer partners)
- Use user scope for user-specific preferences
- Use card scope for card-specific programs (e.g., category-specific rewards cards)
- All higher scope triggers will apply to lower scopes
Error Handling
- Implement retry logic for 5xx errors
- Handle 409 Conflict by waiting for the in-progress registration to complete
- Validate your trigger data before submission to avoid 400 errors
