Free to Play

Free To Play

Overview

Overview

Read-only public endpoints for the Free To Play daily ticket pool. Entries are free and limited to once per 6 hours or once per new jackpot round (whichever comes first). All addresses are validated and stored lowercase.

These endpoints are available to any valid API key and are read-only.

Get Started

Reach out to @patricklung on Telegram to get more info about using the Free To Play endpoints or running a giveaway.

Authentication

All API requests require a valid API key. Include your API key in one of these ways:

Header Method (Recommended):

curl -H "apikey: YOUR_API_KEY" \
  "https://api.megapot.io/api/v1/daily-ticket-pool/active-round"

Query Parameter Method:

curl "https://api.megapot.io/api/v1/daily-ticket-pool/active-round?apikey=YOUR_API_KEY"

API Endpoints

Active Round

GET /api/v1/daily-ticket-pool/active-round

Returns the active round id, latest pool transaction (if any), all entries for the round, and totalEntries for the round.

Example Request:

curl -H "apikey: YOUR_API_KEY" \
  "https://api.megapot.io/api/v1/daily-ticket-pool/active-round"

Success Response:

{
  "roundId": 124,
  "transaction": { "id": 1, "transactionHash": "0x...", "blockNumber": 12345678, "timestamp": "..." },
  "entries": [ { "id": 1, "address": "0x...", "timestamp": "..." } ],
  "totalEntries": 42
}

Notes:

  • Returns { "message": "No active round" } with status 200 if there is no active round.

Active Round (Wallet Filter)

GET /api/v1/daily-ticket-pool/active-round/{walletAddress}

Returns the active round id, latest pool transaction (if any), entries for the provided wallet only, and totalEntries for the round (not filtered by wallet).

Parameters:

  • walletAddress (path parameter): Ethereum wallet address

Example Request:

curl -H "apikey: YOUR_API_KEY" \
  "https://api.megapot.io/api/v1/daily-ticket-pool/active-round/0x1234..."

Success Response:

{
  "roundId": 124,
  "transaction": { "id": 1, "transactionHash": "0x...", "blockNumber": 12345678, "timestamp": "..." },
  "entries": [ { "id": 7, "address": "0xabc...", "timestamp": "..." } ],
  "totalEntries": 42
}

Common Error Responses:

{ "error": "Invalid wallet address" }

Latest Completed Round

GET /api/v1/daily-ticket-pool/round

Returns latest completed round data: pool transaction, entries, totalEntries, and winner.

Example Request:

curl -H "apikey: YOUR_API_KEY" \
  "https://api.megapot.io/api/v1/daily-ticket-pool/round"

Success Response:

{
  "roundId": 123,
  "transaction": { "id": 9, "transactionHash": "0x...", "blockNumber": 12345000, "timestamp": "..." },
  "entries": [ ... ],
  "totalEntries": 37,
  "winner": { "id": 5, "address": "0x...", "timestamp": "..." }
}

Specific Round

GET /api/v1/daily-ticket-pool/round/{roundId}

Returns a specific round’s pool transaction, entries, and totalEntries. Includes winner only if the round is not active.

Parameters:

  • roundId (path parameter): Jackpot round id

Example Request:

curl -H "apikey: YOUR_API_KEY" \
  "https://api.megapot.io/api/v1/daily-ticket-pool/round/120"

Success Response:

{
  "roundId": 120,
  "transaction": { ... },
  "entries": [ ... ],
  "totalEntries": 10,
  "winner": { ... }
}

Common Error Responses:

{ "error": "Invalid round id" }
{ "error": "Round not found" }

Specific Round (Wallet Filter)

GET /api/v1/daily-ticket-pool/round/{roundId}/{walletAddress}

Returns a specific round’s pool transaction and entries for the provided wallet address only, plus totalEntries for the round (not filtered by wallet). Includes winner only if the round is not active.

Parameters:

  • roundId (path parameter): Jackpot round id

  • walletAddress (path parameter): Ethereum wallet address

Example Request:

curl -H "apikey: YOUR_API_KEY" \
  "https://api.megapot.io/api/v1/daily-ticket-pool/round/120/0x1234..."

Success Response:

{
  "roundId": 120,
  "transaction": { "id": 9, "transactionHash": "0x...", "blockNumber": 12345000, "timestamp": "..." },
  "entries": [ { "id": 5, "address": "0xabc...", "timestamp": "..." } ],
  "totalEntries": 10,
  "winner": { "id": 7, "address": "0xdef...", "timestamp": "..." }
}

Common Error Responses:

{ "error": "Invalid round id" }
{ "error": "Invalid wallet address" }
{ "error": "Round not found" }

Wallet Entries (All Rounds)

GET /api/v1/daily-ticket-pool/{walletAddress}

Returns all Daily Ticket Pool entries for the provided wallet across rounds.

Parameters:

  • walletAddress (path parameter): Ethereum wallet address

Example Request:

curl -H "apikey: YOUR_API_KEY" \
  "https://api.megapot.io/api/v1/daily-ticket-pool/0x1234..."

Success Response:

{
  "entries": [ { "id": 1, "address": "0xabc...", "jackpotRoundId": 123, "timestamp": "..." } ]
}

Common Error Responses:

{ "error": "Invalid wallet address" }

Error Codes

Status Code
Error Message
Description

400

Invalid wallet address

The provided wallet address is not in valid Ethereum format

400

Invalid round id

The provided round id is invalid

404

Round not found

The specified round does not exist

500

Internal server error

An unexpected error occurred on the server

Eligibility Rules

A wallet is eligible to enter the Free To Play pool if either of the following is true:

  1. It has no entry in the current active jackpot round, or

  2. Its last entry (any round) was at least 6 hours ago

All Ethereum addresses are validated and stored in lowercase.

Usage Examples

JavaScript/Node.js

const getActiveRound = async (apiKey) => {
  const response = await fetch(
    `https://api.megapot.io/api/v1/daily-ticket-pool/active-round`,
    {
      headers: { 'apikey': apiKey }
    }
  );
  return response.json();
};

const getWalletRoundEntries = async (roundId, walletAddress, apiKey) => {
  const response = await fetch(
    `https://api.megapot.io/api/v1/daily-ticket-pool/round/${roundId}/${walletAddress}`,
    {
      headers: { 'apikey': apiKey }
    }
  );
  return response.json();
};

Best Practices

  1. Validate wallet addresses before making API calls

  2. Implement appropriate error handling for all possible response scenarios

  3. Secure your API keys; avoid exposing them in client-side code or public repositories

  4. Implement rate limiting to avoid overwhelming the API

Last updated