Predexon API
  • Documentation
  • API Reference
Getting Started
Guides
    Error HandlingRate LimitsChangelog
Resources
    Predexon WebsiteJoin Discord
powered by Zudoku
Guides

Error Handling

The Predexon API uses standard HTTP status codes and returns consistent error responses to help you handle issues gracefully.

Error Response Format

All errors return a JSON object with error and message fields:

Code
{ "error": "Bad Request", "message": "Invalid parameter: limit must be between 1 and 100" }

HTTP Status Codes

Status CodeError TypeDescription
400Bad RequestInvalid parameters or malformed request
401UnauthorizedMissing or invalid API key
403ForbiddenAPI key doesn't have access to this resource
404Not FoundResource doesn't exist (market, wallet, etc.)
422Validation ErrorRequest validation failed
429Too Many RequestsRate limit exceeded
500Internal Server ErrorSomething went wrong on our end
503Service UnavailableService temporarily unavailable

Common Error Scenarios

Authentication Errors (401)

TerminalCode
curl -X GET "https://api.predexon.com/v1/polymarket/markets/active" \ -H "Authorization: Bearer invalid_key"
Code
{ "error": "Unauthorized", "message": "Invalid API key" }

Make sure your API key is prefixed with Bearer in the Authorization header.

Invalid Parameters (400)

TerminalCode
curl -X GET "https://api.predexon.com/v1/polymarket/markets/active?limit=500"
Code
{ "error": "Bad Request", "message": "limit must be between 1 and 100" }

Resource Not Found (404)

TerminalCode
curl -X GET "https://api.predexon.com/v1/matching-markets?polymarket_market_slug=nonexistent-market"
Code
{ "error": "Not Found", "message": "Market not found: nonexistent-market" }

Rate Limit Exceeded (429)

Code
{ "error": "Too Many Requests", "message": "Rate limit exceeded. Please wait before making more requests." }

When you receive a 429, check the RateLimit-Reset header for when you can retry.

Validation Errors (422)

For complex validation failures, the response includes details:

Code
{ "detail": [ { "loc": ["query", "granularity"], "msg": "field required", "type": "value_error.missing" } ] }

Handling Errors in Code

Python

Code
import requests def get_markets(): response = requests.get( "https://api.predexon.com/v1/polymarket/markets/active", headers={"Authorization": f"Bearer {API_KEY}"}, params={"limit": 10} ) if response.status_code == 200: return response.json() elif response.status_code == 401: raise Exception("Invalid API key") elif response.status_code == 429: retry_after = response.headers.get("RateLimit-Reset", 60) raise Exception(f"Rate limited. Retry after {retry_after}s") elif response.status_code == 400: error = response.json() raise Exception(f"Bad request: {error['message']}") else: response.raise_for_status()

JavaScript / TypeScript

Code
async function getMarkets() { const response = await fetch( "https://api.predexon.com/v1/polymarket/markets/active?limit=10", { headers: { Authorization: `Bearer ${API_KEY}` }, } ); if (response.ok) { return await response.json(); } const error = await response.json(); switch (response.status) { case 401: throw new Error("Invalid API key"); case 429: const retryAfter = response.headers.get("RateLimit-Reset") || 60; throw new Error(`Rate limited. Retry after ${retryAfter}s`); case 400: throw new Error(`Bad request: ${error.message}`); default: throw new Error(`API error: ${response.status}`); } }

Best Practices

Implement Exponential Backoff - When hitting rate limits, use exponential backoff with jitter to avoid thundering herd problems.

  1. Always check status codes - Don't assume requests succeed
  2. Parse error messages - They contain useful debugging information
  3. Handle 429s gracefully - Implement retry logic with backoff
  4. Log errors - Include the full error response for debugging
  5. Validate inputs client-side - Catch obvious errors before making requests

Getting Help

If you encounter unexpected errors:

  1. Check the API Reference for correct parameter usage
  2. Verify your API key is valid at predexon.com
  3. Join our Discord for support
  4. Email [email protected] with error details
Last modified on January 8, 2026
QuickstartRate Limits
On this page
  • Error Response Format
  • HTTP Status Codes
  • Common Error Scenarios
    • Authentication Errors (401)
    • Invalid Parameters (400)
    • Resource Not Found (404)
    • Rate Limit Exceeded (429)
    • Validation Errors (422)
  • Handling Errors in Code
    • Python
    • JavaScript / TypeScript
  • Best Practices
  • Getting Help
JSON
JSON
JSON
JSON
JSON
JSON
Javascript