Skip to main content
The Polyhush REST API provides direct access to trading functionality. Use these endpoints when building custom integrations or when the SDK doesn’t fit your needs.
For most use cases, we recommend using the Python SDK which provides a simpler interface with built-in error handling.

Base URL

https://api.polyhush.com

Authentication

All API requests require authentication via the X-API-Key header:
curl -H "X-API-Key: your-api-key" \
     https://api.polyhush.com/api/v1/trading/balance
Never expose your API key in client-side code or public repositories.

Try It Out

Each endpoint in this reference includes an interactive “Try It” section. To use it:
  1. Click the “Authorization” button in the top right
  2. Enter your API key
  3. Click “Try It” on any endpoint to make a live request

Endpoints

Balance & Positions

MethodEndpointDescription
GET/api/v1/trading/balanceGet USDC balance
GET/api/v1/trading/positionsGet current positions

Orders

MethodEndpointDescription
POST/api/v1/trading/ordersCreate a new order
DELETE/api/v1/trading/orders/{order_id}Cancel specific order
DELETE/api/v1/trading/ordersCancel all orders
POST/api/v1/trading/orders/{order_id}/syncSync specific order
POST/api/v1/trading/orders/sync-allSync all orders

Market Data

MethodEndpointDescription
GET/api/v1/markets/token/{token_id}/tickerGet price ticker

Request Format

All POST requests should use JSON:
curl -X POST https://api.polyhush.com/api/v1/trading/orders \
     -H "X-API-Key: your-api-key" \
     -H "Content-Type: application/json" \
     -d '{
       "token_id": "12345678901234567890",
       "side": "BUY",
       "shares": 100,
       "price": 0.55,
       "order_type": "GTC"
     }'

Response Format

Success Response (Order Example)

{
  "success": true,
  "orderID": "ord_abc123",
  "status": "live",
  "takingAmount": "0",
  "makingAmount": "55.00",
  "transactionsHashes": []
}

Error Response

{
  "detail": "Insufficient balance"
}

HTTP Status Codes

CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
403Forbidden - Action not permitted
404Not Found - Resource doesn’t exist
422Validation Error - Invalid input data
429Rate Limited - Too many requests
500Server Error - Internal error

Rate Limits

Endpoint TypeRate Limit
Read operations100 requests/minute
Write operations30 requests/minute
Order placement10 orders/second
When rate limited, you’ll receive a 429 response. Implement exponential backoff for retries.

SDK vs API

Use the SDK when...

  • Building Python applications
  • You want simpler error handling
  • You prefer a Pythonic interface

Use the API when...

  • Building in other languages
  • You need maximum control
  • Integrating with existing systems