50,000
transactions in a single request and retrieve the enriched results once processing is complete. Below you’ll find the data types supported and their corresponding endpoints:
Card Enrichment
Transfers enrichment
Universal data enrichment
- /batches/transactions/universal/enrich
Getting Started
Let’s walk through the process of enriching a batch of transactions:Preparing your batch
Depending on the type of data you’re sending different fields may be required but regardless of whether you’re sending card, transfer or aggregated data we recommend the following: Using unique Transaction IDs Ensure each transaction in your batch has a uniquetransactionId
. Results are not guaranteed to be returned in the order in which they were submitted, so you can use the transactionId
to correlate transactions in the results with the original requests. Duplicate IDs will cause the batch enrichment request to fail.
Sending data in chronological order
We recommend sending your oldest transactions first as this can have an impact on the insights we can provide on transaction data such as recurrence.
Using Custom attributes
If you have additional data elements that you would like to associate to any transactions, you can use the customAttributes
object which will be passed back alongside enriched transaction data.
Sending your batch
Once you have prepared your batch(es) you can send up to 10 requests per second to our batch enrichment endpoints.Uploading large batches can take a while, so we recommend increasing the timeout of your client. We support up to a 120 second timeout window.
batchId
which you’ll use later to retrieve the enriched transactions.
Batch response
You must use the
batchId
to retreive enriched data, so make sure you are storing it!Handling failed batches
If your submitted batch fails we will return a400
response with error details. Below is an example of an error response with duplicate transactionIds
:
Checking batch status
A batch job can be in one of four states: *pending
: The batch has been accepted but processing hasn’t started
* running
: The batch is currently being processed
* completed
: All transactions have been enriched and results are ready
* failed
: The batch encountered an error and couldn’t be processed
We provide options for updates on the batch status either via webhooks or polling the status endpoint. We strongly recommend using webhooks as this reduces integration complexity as well as unnecessary API calls.
Using webhooks
If you provided a callbackUrl
in your batch submission, we’ll send a POST request to that URL when processing completes with the batchId
and the status
.
We will also include a token in the X-Webhook-Token
header that you should compare against the callback token provided to you by your Spade representative. Contact your Spade representative if you do not have this token.
Here is an example Flask endpoint you could use to receive callbacks.
completed
status. We recommend implementing an exponential backoff strategy when polling for status.
If the batch results in a
failed
status you will need to re-send the batch for processing.Retrieving enriched data
Once the batch status iscompleted
you can retrieve the enriched data by calling the /results endpoint.
The
/batches/{batchId}/results
endpoint will only return results when the batch status is completed
. If you request results before completion, you’ll receive a 202 status code indicating that the results aren’t yet available.batchId
in addition to a results
array that includes all of the transactions sent in the batch.
Each transaction object in the results
array will contain:
- Your original
transactionId
- Any
customAtrributes
provided in the transaction - A
status
code (either200
or400
) - If successful, the enriched transaction data will include an
enrichmentId
- If unsuccessful an error object
Handling errors:
For transactions that resulted in errors we will provide anerrors
object that includes detailed information that caused the error. An example is included below for a request that did not include a merchantName