Skip to content
Lottery Feed API

Lottery Feed API

ResultsPersonalAPI DocsPricingContact
Sign inJoin the Free Beta
  1. Home
  2. /
  3. API docs
  4. /
  5. Quickstart

API documentation

Quickstart

Make the first authenticated request and copy starter snippets for common customer integrations.

Section

02 / 27

OpenAPI JSON
01Introduction02Quickstart03Polling and integration04Sandbox fixtures05SDK starter06Embeddable widgets07API playground08OpenAPI spec09Postman collection10API changelog11Authentication12API key scopes13Freshness levels14Source confidence15Status monitoring16Rate limiting17Get countries18Get states19Get lotteries20Get lottery21Get schedules22Draw years23Lottery results24History export25Number frequency26Result checker27Error handling

Live API examples

Jump from the docs to real public pages that use the same read models.

Latest results browserSee the compact public result model with filters and draw dates.
Lottery catalogFind game names, states, ball counts, latest numbers, and API guides.
Maryland Pick 3 API guideOpen a concrete endpoint example using the same game shown in snippets.
Pricing and limitsCompare freshness targets, request limits, and integration features.
Customer integration centerSign in to check API keys, usage, webhook delivery, plan limits, and the next recommended action.
OpenAPI contractUse the machine-readable contract for code generation and integration tests.

1. Choose the base URL

Use the versioned /v1 API namespace. In production this can run behind api.lotteryfeedapi.com; local and test environments can call the same app origin directly.

https://api.lotteryfeedapi.com/v1

2. Send a bearer token

Every production request should include Authorization: Bearer <token>. Create and rotate live tokens from the authenticated API keys page, and keep them in server-side secret storage.

curl -sS "https://api.lotteryfeedapi.com/v1/results/latest?state=MD&ball_count=3&short=1&limit=25" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"

Test from your account

Open Account -> API keys and choose an endpoint preset next to a key. The playground preselects the safe key prefix, lets you paste the raw token only in your browser session, runs latest/history/catalog/status/checker endpoints, and generates cURL, Node.js, PHP, and Python snippets for the same request. Snippets use an environment variable by default; inline-token snippets require an explicit browser-only toggle.

https://lotteryfeedapi.com/account/api-keys
https://lotteryfeedapi.com/api-docs/playground?endpoint=latest&state=MD&ball_count=3&limit=25&key_prefix=lf_live_...&short=1

Check integration health after sign-in

Use the private account integration center after the first request. It groups active keys, daily usage, webhook delivery status, plan freshness, and one next recommended action. Public docs link to this flow for handoff, but account pages stay noindex and never expose raw bearer tokens, request bodies, private request logs, or webhook secrets to crawlers.

https://lotteryfeedapi.com/account
https://lotteryfeedapi.com/account/api-keys
https://lotteryfeedapi.com/account/webhooks#delivery-log

Sandbox request

Use a reserved lf_sandbox_* bearer token when you need deterministic sample data without waiting for a live draw. The documented legacy demo token is lf_test_demo_sandbox; other lf_test_* values are not sandbox credentials. Sandbox requests return fixed fixtures, include x-lottery-feed-access: sandbox, do not read the live feed, and do not count as production usage. Use lf_live_* keys for real customer data and lf_dev_* for persisted development keys.

curl -sS "https://api.lotteryfeedapi.com/v1/results/latest?state=MD&ball_count=3&short=1&limit=25" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer lf_test_demo_sandbox"

Latest response

`generated_at` is the feed response timestamp. `draw_date` is the lottery result date customers should display and store. Store `numbers_formatted`, `source_confidence.level`, `provenance.role`, and the returned links instead of scraping public pages.

{
  "generated_at": "2026-06-03T17:20:00.000Z",
  "filters": {
    "state": "MD",
    "ball_count": "3"
  },
  "count": 1,
  "returned_count": 1,
  "total_count": 1,
  "limit": 25,
  "has_more": false,
  "data": [
    {
      "game_code": "md-pick3-midday",
      "name": "Maryland Pick 3 Midday",
      "state": "Maryland",
      "state_code": "MD",
      "ball_count": 3,
      "draw_date": "2026-06-03",
      "numbers": ["2", "3", "6"],
      "numbers_formatted": "2-3-6",
      "numbers_string": "2-3-6",
      "status": "official",
      "source_confidence": {
        "level": "official",
        "label": "Official source",
        "policy": "Numbers were published from the official or canonical lottery source path."
      },
      "provenance": {
        "label": "mdlottery.com",
        "role": "official",
        "provider": "mdlottery.com",
        "display": "mdlottery.com published this result."
      },
      "links": {
        "canonical": "/results/md-pick3-midday/2026-06-03",
        "lottery": "/lotteries/md-pick3-midday",
        "api": "/v1/results/latest/md-pick3-midday",
        "api_docs": "/api-docs/results",
        "api_integration": "/lotteries/md-pick3-midday/api-integration",
        "schedule_api": "/v1/schedules?game_code=md-pick3-midday&date=2026-06-03",
        "history": "/v1/results/history?date=2026-06-03&game_code=md-pick3-midday",
        "history_page": "/results/md-pick3-midday/2026-06-03"
      }
    }
  ]
}

Fast JSON feed link

For polling views or customer cache warmers, use a generated feed link such as /feeds/{feed_token}/lottery.json. It serves a compact JSON artifact with ETag and Last-Modified headers. Eligible feed links can carry optional public white-label branding stored on the feed link itself; branding is never accepted from query strings. Bearer /v1 requests and feed-link requests have separate access and usage policies.

curl -sS "https://api.lotteryfeedapi.com/feeds/YOUR_FEED_TOKEN/lottery.json" \
  -H "Accept: application/json" \
  -H "If-None-Match: \"sha256-...\""

JavaScript fetch

Use a server-side environment variable for the API key. Do not ship customer bearer tokens into browser bundles.

const response = await fetch('https://api.lotteryfeedapi.com/v1/results/latest?state=MD&ball_count=3&short=1&limit=25', {
  headers: {
    accept: 'application/json',
    authorization: `Bearer ${process.env.LOTTERY_FEED_API_KEY}`
  }
});

if (!response.ok) throw new Error(`Lottery Feed API failed: ${response.status}`);
const payload = await response.json();

Python

Keep timeouts explicit so customer jobs fail fast and can retry cleanly.

import os
import requests

response = requests.get(
    'https://api.lotteryfeedapi.com/v1/results/latest',
    params={'state': 'MD', 'ball_count': 3, 'limit': 25},
    headers={'Authorization': f"Bearer {os.environ['LOTTERY_FEED_API_KEY']}"},
    timeout=10,
)
response.raise_for_status()
payload = response.json()

PHP

The endpoint returns compact JSON read models, so clients can decode directly into arrays or DTOs.

$token = getenv('LOTTERY_FEED_API_KEY');
$url = 'https://api.lotteryfeedapi.com/v1/results/latest?state=MD&ball_count=3&short=1&limit=25';

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Accept: application/json',
        'Authorization: Bearer ' . $token,
    ],
    CURLOPT_TIMEOUT => 10,
]);

$payload = json_decode(curl_exec($ch), true, flags: JSON_THROW_ON_ERROR);
curl_close($ch);

Ruby

Use HTTPS, short read timeouts, and retry only idempotent GET requests.

require 'json'
require 'net/http'
require 'uri'

uri = URI('https://api.lotteryfeedapi.com/v1/results/latest')
uri.query = URI.encode_www_form(state: 'MD', ball_count: 3, limit: 25)

request = Net::HTTP::Get.new(uri)
request['Accept'] = 'application/json'
request['Authorization'] = "Bearer #{ENV.fetch('LOTTERY_FEED_API_KEY')}"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 10) do |http|
  http.request(request)
end

payload = JSON.parse(response.body)

Expected response

The latest endpoint returns bounded customer-facing rows. `draw_date` is the lottery result date and source confidence uses reviewed public labels.

{
  "generated_at": "2026-06-03T17:20:00.000Z",
  "filters": {
    "state": "MD",
    "ball_count": "3"
  },
  "count": 1,
  "data": [
    {
      "game_code": "md-pick3-midday",
      "name": "Maryland Pick 3 Midday",
      "state": "Maryland",
      "state_code": "MD",
      "ball_count": 3,
      "draw_date": "2026-06-03",
      "numbers": ["2", "3", "6"],
      "numbers_formatted": "2-3-6",
      "status": "official"
    }
  ]
}

Next: Polling and integration
Lottery Feed API

Normalized lottery draw results, history, schedules, source-confidence metadata, and descriptive analytics for integrations and personal analysis.

Independent software and data service. We do not sell lottery tickets, accept bets or player funds, operate draws, determine outcomes or pay prizes.Lottery names and trademarks belong to their respective owners. Lottery Feed API is an independent data service and is not affiliated with, endorsed by, sponsored by or operated by any lottery authority.
LotteriesDaily ArchiveCountriesStatesStatusResponsible UseAcceptable UseReport incorrect resultCompanyTermsPrivacyAccount