Scratch-On API Documentation

Table of Contents

Authentication

Authentication type: Bearer Token

POST /api/login

{
    "email": "string",
    "password": "string"
}

Endpoints

GET /api/lottery-tickets

Retrieve all lottery tickets

Requires authentication

Parameters:

{
    "per_page": "integer (optional, default: 15)",
    "ticket_price": "string\/number (optional, default: \"All\")",
    "prize_amount": "string\/number (optional, default: \"All\")"
}

Example Response:

{
    "current_page": 1,
    "data": [
        {
            "id": 1,
            "ticket_price": 5,
            "created_at": "2024-03-20T10:00:00Z",
            "updated_at": "2024-03-20T10:00:00Z",
            "prize_counts": [
                {
                    "prize_amount": 10,
                    "count": 5
                },
                {
                    "prize_amount": 20,
                    "count": 3
                }
            ]
        }
    ],
    "total": 50,
    "per_page": 15
}
GET /api/prize-counts

Get counts of available prizes

Requires authentication

Example Response:

[
    {
        "id": 1,
        "ticket_id": 1,
        "prize_amount": 10,
        "count": 5,
        "lottery_ticket": {
            "id": 1,
            "ticket_price": 5
        }
    }
]
GET /api/prize-odds

Get odds for each prize

Requires authentication

Example Response:

[
    {
        "id": 1,
        "ticket_id": 1,
        "prize_amount": 10,
        "odds": "1:500",
        "lottery_ticket": {
            "id": 1,
            "ticket_price": 5
        }
    }
]
GET /api/rankings

Get current rankings

Requires authentication

Example Response:

[
    {
        "id": 1,
        "ticket_id": 1,
        "rank": 1,
        "score": 95,
        "lottery_ticket": {
            "id": 1,
            "ticket_price": 5
        }
    }
]
GET /api/hit-alerts

Get recent hit alerts

Requires authentication

Example Response:

[
    {
        "id": 1,
        "ticket_id": 1,
        "prize_amount": 100,
        "timestamp": "2024-03-20T10:00:00Z",
        "lottery_ticket": {
            "id": 1,
            "ticket_price": 5
        }
    }
]
GET /api/prize-amounts

Get unique prize amounts

Requires authentication

Example Response:

[
    5,
    10,
    20,
    50,
    100
]
GET /api/ticket-prices

Get unique ticket prices

Requires authentication

Example Response:

[
    1,
    2,
    5,
    10
]
GET /api/lottery-tickets/{id}

Get detailed information for a specific ticket

Requires authentication

Parameters:

{
    "id": "integer (required)"
}

Example Response:

{
    "id": 1,
    "ticket_price": 5,
    "created_at": "2024-03-20T10:00:00Z",
    "updated_at": "2024-03-20T10:00:00Z",
    "url": "http:\/\/service.scratchon.com\/ticket\/1",
    "prize_counts": [
        {
            "prize_amount": 10,
            "count": 5
        },
        {
            "prize_amount": 20,
            "count": 3
        }
    ],
    "prize_odds": [
        {
            "prize_amount": 10,
            "odds": "1:500"
        },
        {
            "prize_amount": 20,
            "odds": "1:1000"
        }
    ],
    "rankings": [
        {
            "rank": 1,
            "score": 95
        }
    ],
    "hit_alerts": [
        {
            "prize_amount": 100,
            "timestamp": "2024-03-20T10:00:00Z"
        }
    ]
}
GET /api/unique-values

Get both unique prize amounts and ticket prices

Requires authentication

Example Response:

{
    "prize_amounts": [
        5,
        10,
        20,
        50,
        100
    ],
    "ticket_prices": [
        1,
        2,
        5,
        10
    ]
}