Skip to main content
POST
/
batches
/
transactions
/
cards
/
enrich
Enrich a batch of card transactions
curl --request POST \
  --url https://east.sandbox.spade.com/batches/transactions/cards/enrich \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "transactions": [
    {
      "merchantName": "<string>",
      "userId": "<string>",
      "transactionId": "transaction_id_123456789",
      "amount": 123,
      "currencyCode": "<string>",
      "occurredAt": "2023-11-07T05:31:56Z",
      "categoryCode": "<string>",
      "location": {
        "city": "<string>",
        "country": "<string>",
        "address": "<string>",
        "region": "<string>",
        "postalCode": "<string>",
        "latitude": 123,
        "longitude": 123
      },
      "organizationId": "<string>",
      "programId": "<string>",
      "cardId": "<string>",
      "cardFirstSix": "<string>",
      "cardLastFour": "<string>",
      "acquirerId": "<string>",
      "categoryType": "MCC",
      "customAttributes": {}
    }
  ],
  "callbackUrl": "<string>"
}
'
import requests

url = "https://east.sandbox.spade.com/batches/transactions/cards/enrich"

payload = {
    "transactions": [
        {
            "merchantName": "<string>",
            "userId": "<string>",
            "transactionId": "transaction_id_123456789",
            "amount": 123,
            "currencyCode": "<string>",
            "occurredAt": "2023-11-07T05:31:56Z",
            "categoryCode": "<string>",
            "location": {
                "city": "<string>",
                "country": "<string>",
                "address": "<string>",
                "region": "<string>",
                "postalCode": "<string>",
                "latitude": 123,
                "longitude": 123
            },
            "organizationId": "<string>",
            "programId": "<string>",
            "cardId": "<string>",
            "cardFirstSix": "<string>",
            "cardLastFour": "<string>",
            "acquirerId": "<string>",
            "categoryType": "MCC",
            "customAttributes": {}
        }
    ],
    "callbackUrl": "<string>"
}
headers = {
    "X-Api-Key": "<api-key>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    transactions: [
      {
        merchantName: '<string>',
        userId: '<string>',
        transactionId: 'transaction_id_123456789',
        amount: 123,
        currencyCode: '<string>',
        occurredAt: '2023-11-07T05:31:56Z',
        categoryCode: '<string>',
        location: {
          city: '<string>',
          country: '<string>',
          address: '<string>',
          region: '<string>',
          postalCode: '<string>',
          latitude: 123,
          longitude: 123
        },
        organizationId: '<string>',
        programId: '<string>',
        cardId: '<string>',
        cardFirstSix: '<string>',
        cardLastFour: '<string>',
        acquirerId: '<string>',
        categoryType: 'MCC',
        customAttributes: {}
      }
    ],
    callbackUrl: '<string>'
  })
};

fetch('https://east.sandbox.spade.com/batches/transactions/cards/enrich', 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/batches/transactions/cards/enrich",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'transactions' => [
        [
                'merchantName' => '<string>',
                'userId' => '<string>',
                'transactionId' => 'transaction_id_123456789',
                'amount' => 123,
                'currencyCode' => '<string>',
                'occurredAt' => '2023-11-07T05:31:56Z',
                'categoryCode' => '<string>',
                'location' => [
                                'city' => '<string>',
                                'country' => '<string>',
                                'address' => '<string>',
                                'region' => '<string>',
                                'postalCode' => '<string>',
                                'latitude' => 123,
                                'longitude' => 123
                ],
                'organizationId' => '<string>',
                'programId' => '<string>',
                'cardId' => '<string>',
                'cardFirstSix' => '<string>',
                'cardLastFour' => '<string>',
                'acquirerId' => '<string>',
                'categoryType' => 'MCC',
                'customAttributes' => [
                                
                ]
        ]
    ],
    'callbackUrl' => '<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/batches/transactions/cards/enrich"

	payload := strings.NewReader("{\n  \"transactions\": [\n    {\n      \"merchantName\": \"<string>\",\n      \"userId\": \"<string>\",\n      \"transactionId\": \"transaction_id_123456789\",\n      \"amount\": 123,\n      \"currencyCode\": \"<string>\",\n      \"occurredAt\": \"2023-11-07T05:31:56Z\",\n      \"categoryCode\": \"<string>\",\n      \"location\": {\n        \"city\": \"<string>\",\n        \"country\": \"<string>\",\n        \"address\": \"<string>\",\n        \"region\": \"<string>\",\n        \"postalCode\": \"<string>\",\n        \"latitude\": 123,\n        \"longitude\": 123\n      },\n      \"organizationId\": \"<string>\",\n      \"programId\": \"<string>\",\n      \"cardId\": \"<string>\",\n      \"cardFirstSix\": \"<string>\",\n      \"cardLastFour\": \"<string>\",\n      \"acquirerId\": \"<string>\",\n      \"categoryType\": \"MCC\",\n      \"customAttributes\": {}\n    }\n  ],\n  \"callbackUrl\": \"<string>\"\n}")

	req, _ := http.NewRequest("POST", 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.post("https://east.sandbox.spade.com/batches/transactions/cards/enrich")
  .header("X-Api-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"transactions\": [\n    {\n      \"merchantName\": \"<string>\",\n      \"userId\": \"<string>\",\n      \"transactionId\": \"transaction_id_123456789\",\n      \"amount\": 123,\n      \"currencyCode\": \"<string>\",\n      \"occurredAt\": \"2023-11-07T05:31:56Z\",\n      \"categoryCode\": \"<string>\",\n      \"location\": {\n        \"city\": \"<string>\",\n        \"country\": \"<string>\",\n        \"address\": \"<string>\",\n        \"region\": \"<string>\",\n        \"postalCode\": \"<string>\",\n        \"latitude\": 123,\n        \"longitude\": 123\n      },\n      \"organizationId\": \"<string>\",\n      \"programId\": \"<string>\",\n      \"cardId\": \"<string>\",\n      \"cardFirstSix\": \"<string>\",\n      \"cardLastFour\": \"<string>\",\n      \"acquirerId\": \"<string>\",\n      \"categoryType\": \"MCC\",\n      \"customAttributes\": {}\n    }\n  ],\n  \"callbackUrl\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://east.sandbox.spade.com/batches/transactions/cards/enrich")

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

request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"transactions\": [\n    {\n      \"merchantName\": \"<string>\",\n      \"userId\": \"<string>\",\n      \"transactionId\": \"transaction_id_123456789\",\n      \"amount\": 123,\n      \"currencyCode\": \"<string>\",\n      \"occurredAt\": \"2023-11-07T05:31:56Z\",\n      \"categoryCode\": \"<string>\",\n      \"location\": {\n        \"city\": \"<string>\",\n        \"country\": \"<string>\",\n        \"address\": \"<string>\",\n        \"region\": \"<string>\",\n        \"postalCode\": \"<string>\",\n        \"latitude\": 123,\n        \"longitude\": 123\n      },\n      \"organizationId\": \"<string>\",\n      \"programId\": \"<string>\",\n      \"cardId\": \"<string>\",\n      \"cardFirstSix\": \"<string>\",\n      \"cardLastFour\": \"<string>\",\n      \"acquirerId\": \"<string>\",\n      \"categoryType\": \"MCC\",\n      \"customAttributes\": {}\n    }\n  ],\n  \"callbackUrl\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "batchId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "batchSize": 2,
  "submittedAt": "2023-11-07T05:31:56Z"
}
{
  "invalidField": [
    "<string>"
  ]
}
{
  "details": "<string>"
}
{
  "details": "<string>"
}

Authorizations

X-Api-Key
string
header
required

Query Parameters

synchronous
boolean
default:false

When true, returns enriched results inline in the response instead of a batchId. Microbatches are capped to ensure timely processing. See the Microbatch enrichment guide for details.

Body

application/json
transactions
object[]
required

An array of transactions to enrich. Each transaction must have a unique transactionId. Maximum 50,000 transactions.

Maximum array length: 50000
callbackUrl
string<url>

Set this URL if you want to receive a notification when the batch job is complete.

Example:

"https://example.com/callback"

Callbacks

POST
{$request.body#/callbackUrl}batchStatusCallback

Body

application/json
batchId
string<uuid>
required

Unique identifier for the batch job

status
enum<string>
required

Final status of the batch job

Available options:
completed,
failed

Response

Your server returns this code if it accepts the callback

Response

Successful operation

batchId
string<uuid>
required

Unique identifier for the batch job

status
enum<string>
required

Current status of the batch job

Available options:
pending,
running,
completed,
failed
batchSize
integer
required

Number of transactions in the batch

Required range: x >= 1
Example:

1

submittedAt
string<date-time>
required

Timestamp of when the batch was submitted

Example:

"2024-11-21T20:07:20.213660Z"