Prophyt API Reference
Complete API documentation for the Prophyt indexer and Nautilus Trust Oracle.
Base URL
SHELLhttp://localhost:8000/api
Authentication
Currently, the API does not require authentication. In production, consider implementing API keys or OAuth.
Market Endpoints
List Markets
Get a list of all markets with optional filters.
Endpoint: GET /markets
Query Parameters:
| Parameter | Type | Description | Default |
|---|---|---|---|
status | string | Filter by market status | active |
protocolId | string | Filter by protocol ID | - |
limit | number | Number of results | 20 |
offset | number | Pagination offset | 0 |
Response:
JSON{ "success": true, "data": { "markets": [ { "marketId": "1", "question": "Will Bitcoin reach $100k by 2025?", "description": "Prediction market for Bitcoin price", "status": "active", "endDate": "2025-01-01T00:00:00Z", "isResolved": false, "outcome": null, "totalYesAmount": "1000000000", "totalNoAmount": "500000000", "totalYieldEarned": "50000000", "protocolId": "1", "createdAt": "2024-01-01T00:00:00Z" } ], "total": 100, "limit": 20, "offset": 0 } }
Get Market Details
Get detailed information about a specific market.
Endpoint: GET /markets/:marketId
Response:
JSON{ "success": true, "data": { "marketId": "1", "question": "Will Bitcoin reach $100k by 2025?", "description": "Prediction market for Bitcoin price", "status": "active", "endDate": "2025-01-01T00:00:00Z", "isResolved": false, "outcome": null, "totalYesAmount": "1000000000", "totalNoAmount": "500000000", "totalYieldEarned": "50000000", "protocolId": "1", "betCount": 25, "createdAt": "2024-01-01T00:00:00Z" } }
Seed Markets
Seed markets from external data sources.
Endpoint: POST /markets/seed
Request Body:
JSON{ "source": "adjacent", "count": 10 }
Bet Endpoints
Get Bet Details
Get information about a specific bet.
Endpoint: GET /bets/:betId
Response:
JSON{ "success": true, "data": { "betId": "1", "marketId": "1", "user": "0x123...", "position": true, "amount": "100000000", "netAmount": "99000000", "transactionFee": "1000000", "claimed": false, "yieldShare": "5000000", "timestamp": "2024-01-01T00:00:00Z" } }
Get User Bets
Get all bets for a specific user.
Endpoint: GET /bets/user/:address
Query Parameters:
| Parameter | Type | Description | Default |
|---|---|---|---|
limit | number | Number of results | 20 |
offset | number | Pagination offset | 0 |
Get Market Bets
Get all bets for a specific market.
Endpoint: GET /bets/market/:marketId
Query Parameters:
| Parameter | Type | Description | Default |
|---|---|---|---|
limit | number | Number of results | 20 |
offset | number | Pagination offset | 0 |
Generate Bet Image
Generate NFT image for a bet.
Endpoint: POST /bets/generate-bet-image
Request Body:
JSON{ "marketId": "1", "betId": "1", "position": true, "amount": "100000000" }
Response:
JSON{ "success": true, "data": { "imageUrl": "https://walrus...", "blobId": "abc123...", "blobAddress": "0x..." } }
User Endpoints
Get User Portfolio
Get user's betting portfolio and statistics.
Endpoint: GET /users/:address/bets
Response:
JSON{ "success": true, "data": { "user": "0x123...", "totalBets": 10, "activeBets": 5, "resolvedBets": 5, "totalWinnings": "500000000", "totalYieldEarned": "50000000", "bets": [...] } }
Get User Statistics
Get detailed statistics for a user.
Endpoint: GET /users/:address/stats
Response:
JSON{ "success": true, "data": { "user": "0x123...", "winRate": 0.6, "totalVolume": "1000000000", "totalProfit": "100000000", "averageBetSize": "10000000" } }
Oracle Endpoints
Get Latest Price
Get the latest SUI/USD price from CoinGecko.
Endpoint: GET /oracle/price/latest
Response:
JSON{ "success": true, "data": { "symbol": "SUI", "currency": "USD", "price": 1.25, "marketCap": 1000000000, "volume24h": 50000000, "change24h": 0.05, "timestamp": "2024-01-01T00:00:00Z" } }
Get Market Data
Get market data feed.
Endpoint: GET /oracle/markets
Chart Endpoints
Get Market Chart Data
Get chart data for a specific market.
Endpoint: GET /charts/market/:id
Query Parameters:
| Parameter | Type | Description | Default |
|---|---|---|---|
timeframe | string | Timeframe (1h, 24h, 7d, 30d) | 24h |
Response:
JSON{ "success": true, "data": { "marketId": "1", "timeframe": "24h", "data": [ { "timestamp": "2024-01-01T00:00:00Z", "yesAmount": "1000000000", "noAmount": "500000000", "totalVolume": "1500000000" } ] } }
Get Volume Analytics
Get volume analytics across all markets.
Endpoint: GET /charts/volume
Nautilus Endpoints
Health Check
Check Nautilus server health.
Endpoint: GET /nautilus/health
Response:
JSON{ "success": true, "data": { "healthy": true, "serverUrl": "http://localhost:8080", "enabled": true } }
Get Pending Markets
Get markets pending resolution from Nautilus server.
Endpoint: GET /nautilus/pending-markets
Response:
JSON{ "success": true, "data": { "markets": [ { "market_id": "1", "question": "Will Bitcoin reach $100k?", "end_date": "2024-01-01T00:00:00Z", "external_link": "https://example.com/data" } ] } }
Resolve Market
Manually trigger market resolution using Nautilus.
Endpoint: POST /nautilus/resolve/:marketId
Request Body:
JSON{ "useNautilus": true, "dataSourceUrl": "https://api.example.com/data" }
Response:
JSON{ "success": true, "message": "Market 1 resolution initiated" }
Resolve All Markets
Trigger resolution for all expired markets.
Endpoint: POST /nautilus/resolve-all
Request Body:
JSON{ "useNautilus": true }
Get Resolutions
Get resolution history.
Endpoint: GET /nautilus/resolutions
Query Parameters:
| Parameter | Type | Description | Default |
|---|---|---|---|
marketId | string | Filter by market ID | - |
limit | number | Number of results | 50 |
offset | number | Pagination offset | 0 |
Response:
JSON{ "success": true, "data": [ { "market_id": "1", "outcome": true, "source_data": "Bitcoin price: $105,000", "source_data_hash": "abc123...", "resolution_timestamp": 1735689600, "media_hash": "def456...", "signature": "sig123...", "public_key": "pubkey123...", "created_at": "2024-01-01T00:00:00Z" } ] }
Get Statistics
Get Nautilus statistics.
Endpoint: GET /nautilus/stats
Response:
JSON{ "success": true, "data": { "totalResolutions": 100, "recentResolutions": [ { "outcome": true, "count": 60 }, { "outcome": false, "count": 40 } ], "serverHealthy": true, "serverUrl": "http://localhost:8080", "enabled": true } }
Error Responses
All endpoints return errors in the following format:
JSON{ "success": false, "error": "Error message description" }
HTTP Status Codes:
200: Success400: Bad Request404: Not Found500: Internal Server Error
Rate Limiting
Currently, there are no rate limits. In production, consider implementing rate limiting to prevent abuse.
Pagination
Endpoints that return lists support pagination via limit and offset query parameters.
Example:
SHELLGET /api/markets?limit=10&offset=20
This returns results 21-30.
Data Formats
- Timestamps: ISO 8601 format (e.g.,
2024-01-01T00:00:00Z) - Amounts: String representation of numbers (to avoid precision loss)
- Addresses: Sui address format (0x...)
