Skip to content

Backend API

The Backend is the primary API surface for the frontend application. It provides endpoints for authentication, market management, trading, user profiles, and file uploads.

Base URL: https://backend-production-ef0b.up.railway.app

Authentication

MechanismHeaderPurpose
API Keyx-api-key: YOUR_KEYRequired on most endpoints
JWT BearerAuthorization: Bearer TOKENRequired for authenticated user actions
bash
# Example: list all markets
curl -H "x-api-key: 019cccd3-bfc1-7503-ab84-25907019f053" \
  https://backend-production-ef0b.up.railway.app/markets

Endpoints

System

Operations


System health check

GET
/health

Authorizations

api-key
Type
API Key (header: x-api-key)

Responses

Playground

Server
Authorization

Samples


Create or update user after signature verification (Internal usage)

POST
/users/auth

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Request Body

application/json
JSON
{
  
"id": "string",
  
"username": "string",
  
"avatarUrl": "string",
  
"role": {
  
}
}

Responses

Playground

Server
Authorization
Body

Samples


Retrieve a user profile by wallet address

GET
/users/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Update your own user profile

PATCH
/users/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Request Body

application/json
JSON
{
  
"username": "string",
  
"avatarUrl": "string"
}

Responses

Playground

Server
Authorization
Variables
Key
Value
Body

Samples


Check if a username is currently available

GET
/users/check-username/{username}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

username*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Retrieve all markets

GET
/markets

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Responses

application/json
JSON
[
  
{
  
}
]

Playground

Server
Authorization

Samples


Create a new canonical app market and register it with the matcher when trading ids are present

POST
/markets

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Request Body

application/json
JSON
{
  
"question": "string",
  
"description": "string",
  
"image": "string",
  
"category": "string",
  
"endTimestamp": "string",
  
"resolutionSource": "string",
  
"conditionId": "string",
  
"questionId": "string",
  
"yesTokenId": "string",
  
"noTokenId": "string",
  
"outcomes": [
  
  
{
  
  
  
"name": "string",
  
  
  
"image": "string",
  
  
  
"sortOrder": 0,
  
  
  
"indexSet": "string",
  
  
  
"tokenId": "string",
  
  
  
"complementIndexSet": "string",
  
  
  
"complementTokenId": "string"
  
  
}
  
],
  
"outcomeSlotCount": 0
}

Responses

application/json
JSON
{
}

Playground

Server
Authorization
Body

Samples


Retrieve a single market by ID

GET
/markets/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

application/json
JSON
{
}

Playground

Server
Authorization
Variables
Key
Value

Samples


Permanently delete a market and all related data (Admin only)

DELETE
/markets/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Update a market (Admin only)

PATCH
/markets/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Request Body

application/json
JSON
{
  
"status": {
  
},
  
"winningOutcomeId": "string",
  
"resolvedAt": "string"
}

Responses

application/json
JSON
{
}

Playground

Server
Authorization
Variables
Key
Value
Body

Samples


Retrieve a market trading snapshot

GET
/markets/{id}/trading

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Retrieve both YES and NO orderbooks for a market

GET
/markets/{id}/orderbook

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Submit a signed order for a market

POST
/markets/{id}/orders

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

application/json
JSON
{
}

Playground

Server
Authorization
Variables
Key
Value

Samples


Trading


Cancel a matcher order by hash

POST
/orders/{hash}/cancel

Authorizations

api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

hash*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


List recent orders for an account

GET
/me/orders

Authorizations

api-key
Type
API Key (header: x-api-key)

Parameters

Query Parameters

account*
Type
string
Required

Responses

application/json
JSON
{
}

Playground

Server
Authorization
Variables
Key
Value

Samples


Uploads


Upload a market image to Google Cloud Storage

POST
/uploads/market-image

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Request Body

multipart/form-data
object
Format"binary"

Responses

Playground

Server
Authorization
Body

Samples


Create a new comment

POST
/comments

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Request Body

application/json
JSON
{
  
"content": "string",
  
"marketId": "string",
  
"authorId": "string",
  
"parentId": "string"
}

Responses

application/json
JSON
{
}

Playground

Server
Authorization
Body

Samples


Find all comments for a specific market

GET
/comments/market/{marketId}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

marketId*
Type
string
Required

Responses

application/json
JSON
[
  
{
  
}
]

Playground

Server
Authorization
Variables
Key
Value

Samples


Retrieve a single comment by ID

GET
/comments/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

application/json
JSON
{
}

Playground

Server
Authorization
Variables
Key
Value

Samples


Remove a comment (Author or Admin only)

DELETE
/comments/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Update a comment (Author only)

PATCH
/comments/{id}

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Request Body

application/json
JSON
{
  
"content": "string"
}

Responses

Playground

Server
Authorization
Variables
Key
Value
Body

Samples


Like a comment

POST
/comments/{id}/like

Authorizations

bearer
Type
HTTP (bearer)
or
api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

id*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Generate a SIWE nonce for a wallet address

GET
/auth/nonce/{address}

Authorizations

api-key
Type
API Key (header: x-api-key)

Parameters

Path Parameters

address*
Type
string
Required

Responses

Playground

Server
Authorization
Variables
Key
Value

Samples


Verify SIWE signature and return JWT tokens

POST
/auth/verify

Authorizations

api-key
Type
API Key (header: x-api-key)

Request Body

application/json
JSON
{
  
"message": "string",
  
"signature": "string"
}

Responses

Playground

Server
Authorization
Body

Samples


Refresh access token using a refresh token

POST
/auth/refresh

Authorizations

api-key
Type
API Key (header: x-api-key)

Request Body

application/json
JSON
{
  
"refreshToken": "string"
}

Responses

Playground

Server
Authorization
Body

Samples