Skip to main content
If you don’t need realtime enrichment or are providing historical transaction data when first integrating with Spade you can use our batch endpoints instead of sending transactions individually. Batch enrichment allows you to process up to 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
Each batch endpoint also supports microbatching for use cases where you need to enrich a small number of records quickly. See the Microbatch enrichment guide for details.If you have a large number of records and need to optimize for throughput, the async batch enrichment system detailed below will provide better performance.

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 unique transactionId. 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.
Below we’ve provided an example request for reference.
Once successfully submitted we will send back a response object that includes the batchId which you’ll use later to retrieve the enriched transactions.
Batch response
You must use the batchId to retrieve enriched data, so make sure you are storing it!

Handling failed batches

If your submitted batch fails we will return a 400 response with error details. Below is an example of an error response with duplicate transactionIds:
Using the error details, make the changes required and re-submit the batch.

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.
Polling for status You can poll the status endpoint until the status changes to a 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 is completed 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.
The results endpoint will return the 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 originaltransactionId
  • Any customAttributes provided in the transaction
  • Astatus code (either 200 or 400)
  • If successful, the enriched transaction data will include an enrichmentId
  • If unsuccessful an error object
Below is an example response returned:

Handling errors:

For transactions that resulted in errors we will provide an errors object that includes detailed information that caused the error. An example is included below for a request that did not include a merchantName
See our enrichment guide for more details on handling errors from our API.