Skip to main content

Authentication

All endpoints require the following headers unless otherwise noted:
Authorization
string
required
Bearer token (JWT) for end-user authentication. Format: Bearer YOUR_JWT_TOKEN
X-MAGIC-SECRET-KEY
string
required
Your Magic secret key for application-level authentication.

Place Buy Order

Place a BUY order on Polymarket for the authenticated user.
cURL
curl -X POST 'https://uoa-server.magic.xyz/account/polymarket/buy' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer USER_JWT_TOKEN' \
  -H 'X-MAGIC-SECRET-KEY: YOUR_MAGIC_SECRET_KEY' \
  -d '{
    "token_id": "71321045679252212...",
    "price": "0.55",
    "size": "10",
    "order_type": "GTC"
  }'
Response:
{
  "success": true,
  "side": "BUY",
  "token_id": "71321045679252212...",
  "price": "0.55",
  "size": "10",
  "order_type": "GTC",
  "order_id": "0xabc123...",
  "status": "filled",
  "message": "Order placed successfully",
  "error": null,
  "raw_response": null
}

Request Parameters

token_id
string
required
The Polymarket condition token ID for the outcome to trade.
price
string
required
The limit price (between 0 and 1, representing probability).
size
string
required
The order size in USDC.
order_type
string
default:"GTC"
Order type. Values: GTC (Good Till Cancelled), FOK (Fill or Kill), FAK (Fill and Kill).

Response Fields

success
boolean
Whether the order was placed successfully.
side
string
The order side (BUY).
order_id
string
The Polymarket order ID. null if the order failed.
status
string
The order status. null if the order failed.
message
string
Human-readable status message.
error
string
Error message if the order failed. null on success.

Place Sell Order

Place a SELL order on Polymarket. Uses the same request and response format as the buy endpoint.
cURL
curl -X POST 'https://uoa-server.magic.xyz/account/polymarket/sell' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer USER_JWT_TOKEN' \
  -H 'X-MAGIC-SECRET-KEY: YOUR_MAGIC_SECRET_KEY' \
  -d '{
    "token_id": "71321045679252212...",
    "price": "0.60",
    "size": "5",
    "order_type": "GTC"
  }'
The request parameters and response fields are identical to the Buy Order endpoint, with side set to SELL.