API Reference

Get all supported leagues

Returns a list of all valid leagues supported by the API, optionally filtered by sport

EQULS API - Get Leagues Endpoint

Overview

This endpoint retrieves a list of all valid leagues supported by the EQULS API, optionally filtered by sport.

Details

  • URL: /v1/getLeagues
  • Method: GET
  • Authentication: Required (API Key)

Request Parameters

  • apiKey: A required query parameter. It must be a valid 24-character hexadecimal API key for authentication.
  • sport: An optional query parameter to filter leagues by a specific sport.

Response

  • Success (200 OK):

    • Returns a JSON object containing an array of supported leagues.
    • Example (all leagues):
      {
        "leagues": ["NBA", "NFL", "MLB", "NHL", "EPL", ...]
      }
    • Example (filtered by sport):
      {
        "leagues": ["NBA", "WNBA", "NCAA"]
      }
  • Error (400 Bad Request):

    • Returned when an invalid sport parameter is provided.
    • Example:
      {
        "error": "Invalid sport",
        "validSports": ["basketball", "football", "baseball", "hockey", "soccer"]
      }
  • Error (401 Unauthorized):

    • Returned when the API key is missing or invalid.
    • Example:
      {
        "error": "Invalid API key",
        "details": [
          {
            "code": "invalid_string",
            "message": "Must be a valid ObjectID string",
            "path": ["apiKey"]
          }
        ]
      }

Notes

  • The API key must be a valid 24-character hexadecimal string in the MongoDB ObjectID format.
  • When no sport parameter is provided, all leagues from all sports are returned.
  • When a sport parameter is provided, only leagues for that specific sport are returned.
  • The leagues list is maintained in the configuration and may be updated as new leagues are added to the platform.
Language
Click Try It! to start a request and see the response here!