Swap Callback

StraitsX sends a swapUpdated callback to your registered URL when a swap transaction status changes. Swaps are currency conversions between stablecoins (e.g., XSGD ↔ XUSD).

When this callback fires

TriggerDescription
Swap executedA swap quote is executed and enters processing
Swap completedCurrency conversion is successfully settled
Swap failedSwap could not be completed

Status values

StatusMeaning
pendingSwap is being processed
completedConversion settled — target currency credited to your account
failedSwap could not be completed


Payload structure

{
  "data": {
    "id": "contract_f6a7b8c9-d0e1-2345-f012-456789012345",
    "type": "swapTransaction",
    "attributes": {
      "idempotencyId": "swap-unique-key-001",
      "quoteId": "quote-uuid-abc123",
      "status": "completed",
      "swapPair": "XSGDXUSD",
      "sourceCurrency": "XSGD",
      "targetCurrency": "XUSD",
      "fixedSide": "source",
      "totalSourceCurrencyAmount": "1350.0",
      "sourceCurrencyAmount": "1350.0",
      "targetCurrencyAmount": "1000.0",
      "rate": "0.7407",
      "fees": [
        {
          "type": "TransactionFee",
          "amount": "0.0",
          "currency": "XSGD"
        }
      ],
      "createdAt": "2026-05-11T10:00:00+08:00",
      "updatedAt": "2026-05-11T10:00:05+08:00",
      "customerProfileId": null
    }
  }
}

Field Reference

Top-level fields

FieldTypeDescription
data.idStringUnique swap contract ID.
data.typeStringAlways swapTransaction.
data.attributes.idempotencyIdStringYour idempotency key from the swap execution request.
data.attributes.quoteIdStringThe quote ID that was executed.
data.attributes.statusStringSwap contract status.
data.attributes.swapPairStringCurrency pair (e.g., XSGDXUSD, XUSDXSGD).
data.attributes.sourceCurrencyStringSource currency code.
data.attributes.targetCurrencyStringTarget currency code.
data.attributes.fixedSideStringWhich side was fixed when quoting: source or target.
data.attributes.totalSourceCurrencyAmountStringTotal source amount deducted (including fees).
data.attributes.sourceCurrencyAmountStringSource amount (excluding fees).
data.attributes.targetCurrencyAmountStringTarget amount credited.
data.attributes.rateStringExchange rate applied.
data.attributes.feesArray of objectsFee breakdown. Empty array if no fees.
data.attributes.createdAtStringISO 8601 timestamp when the swap was created.
data.attributes.updatedAtStringISO 8601 timestamp when the status last changed.
data.attributes.customerProfileIdStringCustomer profile ID if the swap was executed on behalf of a customer. null for direct swaps.

fees[] items

FieldTypeDescription
typeStringFee type (e.g., TransactionFee).
amountStringFee amount.
currencyStringCurrency the fee is charged in.


Understanding fixedSide

The fixedSide field indicates which amount was locked when the quote was created:

fixedSideMeaningExample
sourceYou specified how much to sell"I want to sell exactly 1350 XSGD" → receive variable XUSD
targetYou specified how much to receive"I want to receive exactly 1000 XUSD" → sell variable XSGD

This affects how you reconcile: if fixedSide is source, the sourceCurrencyAmount is your known input and targetCurrencyAmount is the computed output (and vice versa).



Did this page help you?