Skip to main content

Introduction

Welcome to the Opinix Trade API documentation. The Opinix Trade API provides programmatic access to create trading events, place orders, and retrieve market data for real-time opinion trading.

Base URL

All API requests should be made to:
https://api.opinix.trade

Authentication

Authentication is currently in development. All endpoints will require JWT-based authentication in production.
Future authentication will use JWT tokens passed in the Authorization header:
Authorization: Bearer YOUR_JWT_TOKEN

Request Format

All requests should be made with the following headers:
Content-Type: application/json
Accept: application/json

Response Format

Success Response

All successful API responses follow this structure:
status
boolean
required
Always true for successful responses
code
number
required
HTTP status code (e.g., 200, 201)
message
string
required
Human-readable success message
additional
object
Optional additional data returned by the endpoint

Example Success Response

{
  "status": true,
  "code": 201,
  "message": "Event created successfully",
  "additional": {
    "eventId": "EVT12345"
  }
}

Error Response

All error responses follow this structure:
status
boolean
required
Always false for error responses
code
number
required
HTTP error code (400, 401, 404, 422, 500, etc.)
name
string
required
Error name describing the type of error
message
string
required
Detailed error message

Example Error Response

{
  "status": false,
  "code": 422,
  "name": "Unprocessable entity",
  "message": "l1_expected_price: Order price must be a positive integer"
}

Error Codes

The API uses standard HTTP status codes:
CodeNameDescription
400Bad RequestInvalid request parameters
401UnauthorizedAuthentication required or failed
403ForbiddenInsufficient permissions
404Not FoundResource not found
408Request TimeoutRequest took too long to process
409ConflictResource conflict (e.g., duplicate event)
422Unprocessable EntityValidation error
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer-side error
502Network ErrorNetwork connectivity issue
503Service UnavailableService temporarily unavailable
504Gateway TimeoutGateway timeout

Rate Limiting

Rate limiting is not currently enforced but will be implemented in production.

API Endpoints

The API is organized into the following resource groups:

SDK Support

You can use any HTTP client to interact with the API. Examples below show usage with cURL, JavaScript fetch, and TypeScript.

Quick Start Example

curl -X POST https://api.opinix.trade/events/create \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Will Bitcoin reach $100k by 2026?",
    "description": "Trade on Bitcoin price predictions",
    "start_date": "2026-01-01T00:00:00Z",
    "end_date": "2026-12-31T23:59:59Z",
    "min_bet": 10,
    "max_bet": 1000,
    "sot": "crypto",
    "quantity": 10000
  }'

Need Help?

If you have questions or need assistance:
  • Check out the Events API documentation
  • Explore Orders API documentation
  • Learn about WebSocket API for real-time data
  • Review code examples in each endpoint documentation