Skip to main content
POST
/
orders
Create a new order
curl --request POST \
  --url https://mainnet.anyspend.com/orders \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "swap",
  "recipientAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1",
  "srcChain": 1,
  "dstChain": 8453,
  "srcTokenAddress": "0xA0b86a33E6441E8A91DEF8f5663ACb4C9B4a1234",
  "dstTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "srcAmount": "1000000",
  "payload": {
    "expectedDstAmount": "990000"
  },
  "metadata": {
    "srcToken": {
      "chainId": 8453,
      "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "symbol": "USDC",
      "name": "USD Coin",
      "decimals": 6,
      "metadata": {
        "logoURI": "https://polygonscan.com/token/images/usdc_32.png"
      }
    },
    "dstToken": {
      "chainId": 8453,
      "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "symbol": "USDC",
      "name": "USD Coin",
      "decimals": 6,
      "metadata": {
        "logoURI": "https://polygonscan.com/token/images/usdc_32.png"
      }
    }
  },
  "partnerId": "<string>",
  "clientReferenceId": "<string>",
  "onramp": {
    "vendor": "coinbase",
    "paymentMethod": "",
    "country": "SG",
    "redirectUrl": "https://www.anyspend.com"
  },
  "creatorAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1"
}
'
{
  "success": true,
  "message": "Created order successfully",
  "data": {
    "id": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
    "recipientAddress": "0xb34facb90a200251318e8841c05102366f2158cf",
    "globalAddress": "0xa640beaa78eeb64bb269f2baf8202b9a7316e123",
    "srcChain": 8453,
    "dstChain": 8453,
    "srcTokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "dstTokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "srcAmount": "93354000",
    "status": "executed",
    "errorDetails": "<string>",
    "createdAt": 1752505794679,
    "expiredAt": 1752506694679,
    "filledAt": 123,
    "receivedDepositAt": 123,
    "creatorAddress": "0xb34facb90a200251318e8841c05102366f2158cf",
    "partnerId": "<string>",
    "onrampMetadata": {
      "country": "US",
      "vendor": "stripe-web2",
      "paymentMethod": "",
      "redirectUrl": "https://www.anyspend.com",
      "stripeAmountInCents": 9900,
      "ipAddress": "192.168.1.1",
      "fingerprint": {
        "requestId": "fp_req_12345",
        "visitorId": "fp_visitor_67890"
      }
    },
    "oneClickBuyUrl": "<string>",
    "stripePaymentIntentId": "pi_3Rko0sJnoDg53PsP0PDLsHkR",
    "settlement": {
      "actualDstAmount": "990000",
      "relay": {
        "status": "success",
        "metadata": {
          "currencyOut": {
            "amount": "990000"
          }
        }
      }
    },
    "type": "swap",
    "payload": {
      "expectedDstAmount": "990000"
    },
    "metadata": {
      "srcToken": {
        "chainId": 8453,
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "symbol": "USDC",
        "name": "USD Coin",
        "decimals": 6,
        "metadata": {
          "logoURI": "https://polygonscan.com/token/images/usdc_32.png"
        }
      },
      "dstToken": {
        "chainId": 8453,
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "symbol": "USDC",
        "name": "USD Coin",
        "decimals": 6,
        "metadata": {
          "logoURI": "https://polygonscan.com/token/images/usdc_32.png"
        }
      }
    },
    "clientReferenceId": "<string>",
    "fee": {
      "type": "standard_fee",
      "feeVersion": 1,
      "tokenToCheckBalance": "0xb3b32f9f8827d4634fe7d973fa1034ec9fddb3b3",
      "recipientBalance": "302843673392800000000000",
      "anyspendFeeBps": 80,
      "anyspendWhaleDiscountBps": 5000,
      "anyspendPartnerDiscountBps": 0,
      "finalFeeBps": 40
    }
  },
  "statusCode": 200
}

Body

application/json

Swap order request

type
enum<string>
required

Order type

Available options:
swap
recipientAddress
string
required

Address to receive the destination tokens

Example:

"0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1"

srcChain
number
required

Source chain ID

Example:

1

dstChain
number
required

Destination chain ID

Example:

8453

srcTokenAddress
string
required

Source token contract address

Example:

"0xA0b86a33E6441E8A91DEF8f5663ACb4C9B4a1234"

dstTokenAddress
string
required

Destination token contract address

Example:

"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"

srcAmount
string
required

Amount of source tokens to swap

Example:

"1000000"

payload
object
required

Swap-specific payload

metadata
object
required

Swap metadata for display purposes

partnerId
string

Optional partner identifier

clientReferenceId
string

Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)

Maximum string length: 255
onramp
object

Optional onramp configuration

creatorAddress
string

Optional address of the order creator

Example:

"0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1"

Response

Order created successfully

success
boolean
required
Example:

true

message
string
required
Example:

"Created order successfully"

data
object
required

Base order fields

statusCode
number
required
Example:

200