Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.unitedmarket.ai/llms.txt

Use this file to discover all available pages before exploring further.

Use Sign-In with Ethereum (SIWE) when calling user-specific endpoints such as authenticated order management, comments, profile updates, or private account views. Order signing is separate from SIWE. SIWE proves the user owns a wallet session for backend auth; EIP-712 order signing proves the user authorized a specific trade.
NetworkBase URLChain ID
Mainnethttps://backend.themarketunited.com56
Testnethttps://backend-develop.themarketunited.com97
United Market is currently in sandbox/development stage. All funds, balances, markets, and trades are for testing only and do not represent real money.

1. Request a SIWE Nonce

curl "https://backend.themarketunited.com/auth/nonce/0xYourWallet"
Response:
{
  "nonce": "abc123"
}

2. Create and Sign the SIWE Message

import { SiweMessage } from "siwe";

const backendUrl = "https://backend.themarketunited.com";
const chainId = 56;

const siwe = new SiweMessage({
  domain: new URL(backendUrl).hostname,
  address: walletAddress,
  statement: "Sign in to trade.",
  uri: backendUrl,
  version: "1",
  chainId,
  nonce,
});

const message = siwe.prepareMessage();

const signature = await walletClient.signMessage({
  account: walletAddress,
  message,
});
For testnet, use https://backend-develop.themarketunited.com and chainId = 97.

3. Verify the Signature

curl -X POST "https://backend.themarketunited.com/auth/verify" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "SIWE_MESSAGE",
    "signature": "0xSIGNATURE"
  }'
Response:
{
  "accessToken": "jwt...",
  "refreshToken": "jwt...",
  "user": {
    "id": "0xYourWallet"
  }
}
Store the accessToken for authenticated requests. Store the refreshToken if your client supports refreshing sessions.

4. Use the Bearer Token

curl "https://backend.themarketunited.com/me/orders" \
  -H "Authorization: Bearer ACCESS_TOKEN"

5. Place an Order After Sign-in

Signing in does not replace order signing. Build and sign the EIP-712 order using the exchange address for the network you are trading on.
const domain = {
  name: "Polymarket CTF Exchange",
  version: "1",
  chainId,
  verifyingContract: exchangeAddress,
} as const;

const signature = await walletClient.signTypedData({
  account: walletAddress,
  domain,
  types,
  primaryType: "Order",
  message: order,
});
Then submit the signed order. Include the bearer token when your integration is using authenticated order routes or user-specific order management.
curl -X POST "https://backend.themarketunited.com/markets/{id}/orders" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "orderType": "GTC",
    "order": {
      "salt": "123456789",
      "maker": "0xYourWallet",
      "signer": "0xYourWallet",
      "taker": "0x0000000000000000000000000000000000000000",
      "tokenId": "TOKEN_ID",
      "makerAmount": "50000000",
      "takerAmount": "100000000",
      "expiration": "0",
      "nonce": "0",
      "feeRateBps": "0",
      "side": 0,
      "signatureType": 0,
      "signature": "0x..."
    }
  }'

6. Cancel an Order

Cancel by market and order hash:
curl -X POST "https://backend.themarketunited.com/markets/{id}/orders/cancel" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "orderHash": "0xORDER_HASH" }'
Some authenticated routes may also support cancelling directly by order hash:
curl -X POST "https://backend.themarketunited.com/orders/0xORDER_HASH/cancel" \
  -H "Authorization: Bearer ACCESS_TOKEN"

7. Refresh a Session

curl -X POST "https://backend.themarketunited.com/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{ "refreshToken": "REFRESH_TOKEN" }'
Use the returned accessToken for future authenticated requests.