Overview
The Events API allows you to create new trading events and retrieve event information. Trading events represent binary opinion markets where users can trade YES or NO positions.Create Event
Endpoint:
POST /events/createCreates a new trading event in the platform.Request Body
The title of the trading event. Must be unique.Example: “Will Bitcoin reach $100k by 2026?”
Detailed description of the event and trading conditions.Example: “This event will resolve to YES if Bitcoin reaches $100,000 USD by December 31, 2026.”
ISO 8601 formatted date-time when trading begins.Format:
YYYY-MM-DDTHH:mm:ss.sssZExample: “2026-01-01T00:00:00.000Z”ISO 8601 formatted date-time when trading ends and the event expires.Format:
YYYY-MM-DDTHH:mm:ss.sssZExample: “2026-12-31T23:59:59.999Z”Minimum bet amount in INR.Example:
10Maximum bet amount in INR.Example:
1000Source or type of the event (e.g., “crypto”, “sports”, “politics”).Example: “crypto”
Total quantity of contracts available for trading.Example:
10000Response
Always
true for successful creationHTTP status code:
201Success message: “Event created successfully”
Generated event code (event ID)
Example Request
Example Response
201 - Success
409 - Event Already Exists
422 - Validation Error
Get Trade Summary
Endpoint:
GET /events/tradeSummaryRetrieves trade summary and WebSocket subscription details for an event.Query Parameters
The unique event ID (event code) to retrieve trade summary for.Example: “3169798”
Response
Always
true for successful requestsHTTP status code:
200Success message: “Trade summary fetched successfully”
Trade summary data containing orderbook configuration
Order book details for the event
Configuration for orderbook WebSocket subscription
WebSocket event configuration
Message name to subscribe:
"subscribe_orderbook"Message name to unsubscribe:
"unsubscribe_orderbook"Channel name to listen for updates:
"event_orderbook_{eventId}"Event ID for subscription
Example Request
Example Response
200 - Success
404 - Event Not Found
Event Types
Based on the source code atpackages/types/src/index.ts:29-42, here are the event type definitions:
Implementation Notes
Source Code Reference:
- Event routes:
apps/server/src/router/eventRouter.ts - Event handlers:
apps/server/src/controllers/event/index.ts - Type definitions:
packages/types/src/index.ts:29-42
Event Slug Generation
The API automatically generates a URL-friendly slug from the event title. For example:- Title: “Will Bitcoin reach $100k by 2026?”
- Generated slug: “will-bitcoin-reach-100k-by-2026”