Marai Labs API Reference

Welcome to the Marai Labs Efficiency Platform. Our API allows you to integrate high-frequency matching engines and sovereign banking ledgers directly into your application stack.

Base URL: https://marailabs.com/api/v1

Authentication

All API requests must be authenticated using your API Key. You can find your API key in the Settings Dashboard.

BASH / CURL
curl -X GET https://marailabs.com/api/v1/account \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
Security Warning: Never expose your API keys in client-side code (`public` folders, React apps). Always proxy requests through your own backend.

Place Order

Submit a new order to the matching engine. Execution is guaranteed to be processed within the current latency window (typically <1ms).

PYTHON
import requests

url = "https://marailabs.com/api/v1/orders"
payload = {
    "symbol": "BTC-USD",
    "side": "buy",
    "type": "limit",
    "quantity": "1.5",
    "price": "98500.00"
}
headers = {"Authorization": "Bearer YOUR_API_KEY"}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Response Parameters

Field Type Description
order_id string Unique identifier for the order (UUID)
status string `filled`, `partial`, or `open`
filled_price float Average execution price (if filled)

WebSocket Stream

Subscribe to real-time market data and user updates.

Endpoint: wss://marailabs.com/ws/v1

JAVASCRIPT
const socket = new WebSocket('wss://marailabs.com/ws/v1');

socket.onopen = () => {
    // Authenticate
    socket.send(JSON.stringify({
        op: "auth",
        args: ["YOUR_API_KEY"]
    }));

    // Subscribe to feed
    socket.send(JSON.stringify({
        op: "subscribe",
        channel: "ticker:BTC-USD"
    }));
};

socket.onmessage = (event) => {
    const data = JSON.parse(event.data);
    console.log(data);
};