Skip to main content

GET /api/v1/loterias

Retrieves a list of all loterias (lotteries) with support for pagination, filtering, and search.

Authentication

Requires authentication. Available to all roles.

Query Parameters

page
integer
default:"1"
Page number for pagination (min: 1)
pageSize
integer
default:"10"
Number of items per page (min: 1, max: 100)
isActive
boolean
Filter by active status.
  • true: Show only active loterias
  • false: Show only inactive loterias
  • Omit: Show all loterias
Search by loteria name (case-insensitive).Min: 1 character, Max: 100 characters

Response

success
boolean
Indicates if the operation was successful
data
array
Array of loteria objects
meta
object
Pagination metadata

Example Request

curl "https://api.example.com/api/v1/loterias?page=1&pageSize=20&isActive=true" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "success": true,
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Lotto",
      "rulesJson": {
        "digits": 2,
        "drawSchedule": {
          "frequency": "diario",
          "times": ["12:55", "18:55"]
        },
        "reventadoConfig": {
          "enabled": true
        },
        "autoCreateSorteos": true
      },
      "isActive": true,
      "createdAt": "2025-03-03T10:00:00-06:00",
      "updatedAt": "2025-03-03T10:00:00-06:00"
    },
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "name": "Tica",
      "rulesJson": {
        "digits": 2,
        "drawSchedule": {
          "frequency": "diario",
          "times": ["13:00", "19:00"]
        },
        "reventadoConfig": {
          "enabled": true
        },
        "autoCreateSorteos": true
      },
      "isActive": true,
      "createdAt": "2025-03-03T10:00:00-06:00",
      "updatedAt": "2025-03-03T10:00:00-06:00"
    }
  ],
  "meta": {
    "total": 5,
    "page": 1,
    "pageSize": 20,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPrevPage": false
  }
}
curl "https://api.example.com/api/v1/loterias?search=lotto" \
  -H "Authorization: Bearer YOUR_TOKEN"

Filtering Options

curl "https://api.example.com/api/v1/loterias"

Understanding rulesJson

The rulesJson field contains loteria configuration:
Number of digits for winning numbers.
  • 2: Times/Tiempos (00-99)
  • 3: Monazos (000-999)
Defines when sorteos are created automatically.
{
  "frequency": "diario",
  "times": ["12:55", "18:55"],
  "daysOfWeek": [1, 3, 5]
}
REVENTADO (extra multiplier) settings.
{
  "enabled": true
}
Whether sorteos are auto-generated.
  • true: Automatic via cron job
  • false: Manual creation only

Use Cases

# Used by vendedor UI to show available lotteries
curl "https://api.example.com/api/v1/loterias?isActive=true"

Get Loteria

Get a single loteria by ID

Create Loteria

Create a new loteria

Update Loteria

Update loteria configuration

List Sorteos

Get sorteos for a loteria

Build docs developers (and LLMs) love