POST /orders
Creates a new order for token transactions across chains

Request Body required

application/json
One of:
Option 1
type string REQUIRED
Order type
Enum: swap
recipientAddress string REQUIRED
Address to receive the destination tokens
srcChain number REQUIRED
Source chain ID
dstChain number REQUIRED
Destination chain ID
srcTokenAddress string REQUIRED
Source token contract address
dstTokenAddress string REQUIRED
Destination token contract address
srcAmount string REQUIRED
Amount of source tokens to swap
payload object REQUIRED
Swap-specific payload
expectedDstAmount string REQUIRED
Expected amount of destination tokens
metadata object REQUIRED
Swap metadata for display purposes
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 2
type string REQUIRED
Order type
Enum: x402_swap
recipientAddress string REQUIRED
Address to receive the destination tokens
srcChain number REQUIRED
Source chain ID
dstChain number REQUIRED
Destination chain ID
srcTokenAddress string REQUIRED
Source token contract address
dstTokenAddress string REQUIRED
Destination token contract address
srcAmount string REQUIRED
Amount of source tokens to swap
payload object REQUIRED
Swap-specific payload
expectedDstAmount string REQUIRED
Expected amount of destination tokens
metadata object REQUIRED
Swap metadata for display purposes
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 3
type string REQUIRED
Order type
Enum: hype_duel
recipientAddress string REQUIRED
Address to receive the destination tokens
srcChain number REQUIRED
Source chain ID
dstChain number REQUIRED
Destination chain ID
srcTokenAddress string REQUIRED
Source token contract address
dstTokenAddress string REQUIRED
Destination token contract address
srcAmount string REQUIRED
Amount of source tokens for HypeDuel
payload object REQUIRED
HypeDuel-specific payload
expectedDstAmount string REQUIRED
Expected amount of destination tokens
metadata object REQUIRED
HypeDuel metadata for display purposes
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 4
type string REQUIRED
Order type
Enum: custom
recipientAddress string REQUIRED
Address to receive any tokens or execute transaction
srcChain number REQUIRED
Source chain ID for payment
dstChain number REQUIRED
Destination chain ID where custom execution will occur
srcTokenAddress string REQUIRED
Payment token contract address
dstTokenAddress string REQUIRED
Token to be used in custom execution
srcAmount string REQUIRED
Payment amount
payload object REQUIRED
Custom execution payload
data string REQUIRED
Encoded transaction data
to string REQUIRED
Target contract address
spenderAddress string
Optional spender address for token approval
amount string REQUIRED
Amount for the custom operation
metadata object REQUIRED
Custom metadata for display purposes
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
action string
Optional custom action identifier
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 5
type string REQUIRED
Order type
Enum: custom_exact_in
recipientAddress string REQUIRED
Address to receive the destination tokens
srcChain number REQUIRED
Source chain ID for payment
dstChain number REQUIRED
Destination chain ID where execution will occur
srcTokenAddress string REQUIRED
Payment token contract address
dstTokenAddress string REQUIRED
Destination token contract address
srcAmount string REQUIRED
Payment amount
payload object REQUIRED
Custom exact in execution payload
amount string REQUIRED
Amount used when executing the destination function
expectedDstAmount string REQUIRED
Expected amount of destination tokens
functionAbi string REQUIRED
JSON stringified ABI that includes the destination function
functionName string REQUIRED
Destination function name
functionArgs string[] REQUIRED
Destination function arguments (template variables allowed)
Array of:
to string REQUIRED
Destination contract address
spenderAddress string
Optional spender address for token approval
value string
Native token value to send with the transaction (in wei)
action string
Optional action identifier used for display purposes
metadata object REQUIRED
Custom metadata for display purposes
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
action string
Optional custom action identifier
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 6
type string REQUIRED
Order type
Enum: mint_nft
recipientAddress string REQUIRED
Address to receive the NFT
srcChain number REQUIRED
Source chain ID for payment
dstChain number REQUIRED
Destination chain ID where NFT exists
srcTokenAddress string REQUIRED
Payment token contract address
dstTokenAddress string REQUIRED
NFT contract address
srcAmount string REQUIRED
Payment amount
payload object REQUIRED
NFT minting payload
contractAddress string REQUIRED
NFT contract address
tokenId number | null REQUIRED
Token ID (for ERC1155, null for ERC721)
contractType string REQUIRED
Type of NFT contract
Enum: erc721, erc1155
nftPrice string REQUIRED
Price to mint the NFT
metadata object REQUIRED
NFT metadata
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
nft unknown REQUIRED
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 7
type string REQUIRED
Order type
Enum: join_tournament
recipientAddress string REQUIRED
Participant's address
srcChain number REQUIRED
Source chain ID for payment
dstChain number REQUIRED
Destination chain for tournament contract
srcTokenAddress string REQUIRED
Payment token contract address
dstTokenAddress string REQUIRED
Tournament contract address
srcAmount string REQUIRED
Entry fee amount
payload object REQUIRED
Tournament joining payload
contractAddress string REQUIRED
Tournament contract address
entryPrice string REQUIRED
Tournament entry price
metadata object REQUIRED
Tournament metadata
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
tournament object REQUIRED
Tournament details
slug string REQUIRED
Tournament slug identifier
name string REQUIRED
Tournament name
description string REQUIRED
Tournament description
imageUrl string REQUIRED
Tournament image URL
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 8
type string REQUIRED
Order type
Enum: fund_tournament
recipientAddress string REQUIRED
Funder's address
srcChain number REQUIRED
Source chain ID for payment
dstChain number REQUIRED
Destination chain for tournament contract
srcTokenAddress string REQUIRED
Payment token contract address
dstTokenAddress string REQUIRED
Tournament contract address
srcAmount string REQUIRED
Funding amount
payload object REQUIRED
Tournament funding payload
contractAddress string REQUIRED
Tournament contract address
fundAmount string REQUIRED
Amount to fund the tournament
metadata object REQUIRED
Tournament metadata
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
tournament object REQUIRED
Tournament details
slug string REQUIRED
Tournament slug identifier
name string REQUIRED
Tournament name
description string REQUIRED
Tournament description
imageUrl string REQUIRED
Tournament image URL
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
onramp object
Optional onramp configuration
vendor string
Onramp vendor
Enum: coinbase, stripe, stripe-web2, none
paymentMethod string
Payment method for onramp
country string
Country code for the user
redirectUrl string
URL to redirect after payment
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.
Option 9
type string REQUIRED
Order type for deposit-first flow
Enum: deposit_first
recipientAddress string REQUIRED
Address to receive the destination tokens after swap
srcChain number REQUIRED
Source chain ID where deposit will be made
dstChain number REQUIRED
Destination chain ID for the swap
srcTokenAddress string REQUIRED
Token contract address that will be deposited
dstTokenAddress string REQUIRED
Token contract address to receive after swap
payload object REQUIRED
DepositFirst payload - empty at creation time, details determined after deposit is detected
metadata object REQUIRED
DepositFirst metadata for display purposes
srcToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
dstToken object REQUIRED
Token details
chainId number REQUIRED
Token chain ID
address string REQUIRED
Token contract address
symbol string REQUIRED
Token symbol
name string REQUIRED
Token name
decimals number REQUIRED
Token decimals
metadata object REQUIRED
logoURI string
Token logo URI
partnerId string
Optional partner identifier
clientReferenceId string
Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars)
creatorAddress string
Optional address of the order creator
checkoutSessionId string (uuid)
Optional checkout session ID to link this order to. Session must exist and be open.

Responses

200 Order created successfully
application/json
success boolean REQUIRED
message string REQUIRED
data unknown REQUIRED
statusCode number REQUIRED
400 Bad request
curl -X POST 'https://mainnet.anyspend.com/orders' \
  -H 'Content-Type: application/json' \
  -d '{
  "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",
  "checkoutSessionId": "550e8400-e29b-41d4-a716-446655440000"
}'
const response = await fetch('https://mainnet.anyspend.com/orders', {
  method: 'POST',
  headers: {
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "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",
    "checkoutSessionId": "550e8400-e29b-41d4-a716-446655440000"
  })
});

const data = await response.json();
console.log(data);
import requests

response = requests.post('https://mainnet.anyspend.com/orders', json={
  "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",
  "checkoutSessionId": "550e8400-e29b-41d4-a716-446655440000"
})
print(response.json())
200 Response
{
  "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>",
    "clientReferenceId": "<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"
          }
        }
      }
    },
    "fee": {},
    "type": "swap",
    "payload": {
      "expectedDstAmount": "990000"
    },
    "metadata": {
      "srcToken": {
        "chainId": 8453,
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "symbol": "USDC",
        "name": "USD Coin",
        "decimals": 6,
        "metadata": {
          "logoURI": {}
        }
      },
      "dstToken": {
        "chainId": 8453,
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "symbol": "USDC",
        "name": "USD Coin",
        "decimals": 6,
        "metadata": {
          "logoURI": {}
        }
      }
    }
  },
  "statusCode": 200
}
POST /orders
Ask a question... ⌘I