Skip to main content
POST
/
v1
/
orders
curl --request POST \
  --url 'https://mach-prod-536329393577.asia-northeast1.run.app/v1/orders' \
  --header 'Content-Type: application/json' \
  --data '{
    "chain": "optimism",
    "place_taker_tx": "0x50da55b159ccd423ebcb315dd2949202e584473960008274514c5088f3d26de7",
    "referral_code": "ABC"
  }'
{
  "id": "6368f169-d9ad-53ec-b797-81b4dc74c257",
  "taker_address": "0xb20094DFede30AbEe3a8d549BbA828b6fd771106",
  "maker_address": "0x123456789abcdef123456789abcdef123456789a",
  "src_asset_address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
  "dst_asset_address": "0x498Bf2B1e120FeD3ad3D42EA2165E9b73f99C1e5",
  "src_chain": "avalanche",
  "dst_chain": "arbitrum",
  "src_amount": 1000000,
  "dst_amount": 997000,
  "created_at": "2023-05-01T12:34:56Z",
  "filled_at": "2023-05-01T12:35:30Z",
  "expires_at": "2023-05-01T12:39:56Z",
  "completed": true,
  "place_tx": "0x50da55b159ccd423ebcb315dd2949202e584473960008274514c5088f3d26de7",
  "fill_tx": "0x60ea66b269ccd423ebcb315dd2949202e584473960008274514c5088f3d26ff8",
  "eta": 0,
  "order_type": "default"
}
This endpoint allows you to submit an order to Mach after receiving a confirmed transaction calling the PlaceTrade function on the Mach smart contract. The order will be processed and fulfilled by Mach’s market makers.

Request Body

chain
string
required
The chain where the transaction was submitted (e.g., “optimism”, “arbitrum”)
place_taker_tx
string
required
The transaction hash of the PlaceTrade call
referral_code
string
Optional referral code for tracking and rewards

Response

id
string
Unique identifier for the order
taker_address
string
The address that initiated the order
maker_address
string
The address that fulfilled the order (null if not yet fulfilled)
src_asset_address
string
Address of the token being sold
dst_asset_address
string
Address of the token being purchased
src_chain
string
The source chain of the order
dst_chain
string
The destination chain of the order
src_amount
integer
Amount of source token in the smallest unit
dst_amount
integer
Amount of destination token to be received
created_at
string
Timestamp when the order was created
filled_at
string
Timestamp when the order was filled (null if not yet filled)
expires_at
string
Timestamp when the order expires (null if no expiration)
completed
boolean
Whether the order has been completed
place_tx
string
Transaction hash of the order placement
fill_tx
string
Transaction hash of the order fulfillment (null if not yet fulfilled)
eta
integer
Estimated time in seconds until the order is completed
order_type
string
Type of the order (e.g., “default”, “cctp”)
curl --request POST \
  --url 'https://mach-prod-536329393577.asia-northeast1.run.app/v1/orders' \
  --header 'Content-Type: application/json' \
  --data '{
    "chain": "optimism",
    "place_taker_tx": "0x50da55b159ccd423ebcb315dd2949202e584473960008274514c5088f3d26de7",
    "referral_code": "ABC"
  }'
{
  "id": "6368f169-d9ad-53ec-b797-81b4dc74c257",
  "taker_address": "0xb20094DFede30AbEe3a8d549BbA828b6fd771106",
  "maker_address": "0x123456789abcdef123456789abcdef123456789a",
  "src_asset_address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
  "dst_asset_address": "0x498Bf2B1e120FeD3ad3D42EA2165E9b73f99C1e5",
  "src_chain": "avalanche",
  "dst_chain": "arbitrum",
  "src_amount": 1000000,
  "dst_amount": 997000,
  "created_at": "2023-05-01T12:34:56Z",
  "filled_at": "2023-05-01T12:35:30Z",
  "expires_at": "2023-05-01T12:39:56Z",
  "completed": true,
  "place_tx": "0x50da55b159ccd423ebcb315dd2949202e584473960008274514c5088f3d26de7",
  "fill_tx": "0x60ea66b269ccd423ebcb315dd2949202e584473960008274514c5088f3d26ff8",
  "eta": 0,
  "order_type": "default"
}

Status Codes

Status CodeDescription
200Success - Order submitted successfully
422Validation Error - Invalid parameters
500Internal Server Error - Something went wrong on the server