Skip to main content

Quick Start

Overview

The Xmarket API provides programmatic access to:

  • Real-time orderbook data
  • Order creation and management
  • Market information
  • Position tracking
  • Trading operations

Base URLs

The API uses two base URLs depending on the endpoint type:

  • Public endpoints (read-only, no authentication required):

    https://engine.xmarket.app/api/v1

    Used for: Markets, Orderbook data

  • Authenticated endpoints (require API key):

    https://engine.xmarket.app/openapi/v1

    Used for: Orders, Positions, Trading operations

Prerequisites

Before you begin, you'll need:

  1. An Xmarket account
  2. An API key for authentication

Getting Your API Key

Step 1: Register an Account

Visit Xmarket and create your account if you haven't already.

Step 2: Generate API Key

  1. Navigate to your account Settings page
  2. Find the API Management section
  3. Click Generate New API Key
  4. Store your API key securely!
danger

Important: Keep your API key secure and never share it publicly or commit it to version control.

Authentication

All API requests require authentication using your API key in the x-api-key header:

x-api-key: YOUR_API_KEY

Making Your First Request

Let's start with a simple request to fetch orderbook data:

curl -X GET \
'https://engine.xmarket.app/api/v1/orderbook/{outcomeId}' \
-H 'x-api-key: YOUR_API_KEY'

Error Handling

The API uses standard HTTP status codes to indicate success or failure:

Status CodeDescription
200Success
201Resource created
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
404Not Found - Resource doesn't exist
500Internal Server Error

Error responses include a message explaining what went wrong:

{
"message": "Invalid market ID"
}

Rate Limits

To ensure fair usage and system stability, the API implements rate limiting:

  • Default limit: 100 requests per minute per API key

When you exceed the rate limit, you'll receive a 429 Too Many Requests response.

Next Steps

Now that you're set up, explore our detailed API documentation:

Support

If you encounter any issues or have questions:

  • Check our FAQs
  • Contact support through the platform