Skip to main content
Retrieves detailed information about a specific ticket by its UUID, including all jugadas, commission snapshots, sorteo details, and print configuration.

Authentication

Requires authentication. Available to roles: VENDEDOR, VENTANA, ADMIN.

Path Parameters

id
string
required
UUID of the ticket to retrieve.

Response Fields

id
string
Ticket UUID.
ticketNumber
string
Unique ticket number in format TYYMMDD-XXXXXX-CC (e.g., T260303-00042A-15).
totalAmount
number
Total amount of all jugadas.
status
string
Ticket status. Possible values:
  • ACTIVE: Ticket is active and valid
  • CANCELLED: Ticket was cancelled
  • EVALUATED: Sorteo completed, winners determined
  • PAID: Winner ticket fully paid
  • EXCLUDED: Excluded from reports
isActive
boolean
Whether the ticket is active.
isWinner
boolean
Whether the ticket has any winning jugadas.
loteriaId
string
UUID of the lottery.
sorteoId
string
UUID of the sorteo.
ventanaId
string
UUID of the ventana.
vendedorId
string
UUID of the vendedor who created the ticket.
clienteNombre
string
Customer name.
createdAt
string
ISO 8601 timestamp of ticket creation.
updatedAt
string
ISO 8601 timestamp of last update.
businessDate
string
Business date in Costa Rica timezone when ticket was created.
totalCommission
number
Total commission amount (sum of all jugada commissions).
totalPayout
number
Total payout amount for winning tickets. Null for non-winning tickets.
totalPaid
number
Total amount paid out so far (for winning tickets).
remainingAmount
number
Remaining payout amount for partially paid winners.
lastPaymentAt
string
ISO 8601 timestamp of last payment (for winners).
paymentMethod
string
Method of last payment: cash, transfer, check.
paymentNotes
string
Notes from the last payment.
paymentHistory
array
Complete history of payments for this ticket.
createdBy
string
UUID of the user who created the ticket (may differ from vendedorId if created via impersonation).
createdByRole
string
Role of the user who created the ticket: VENDEDOR, VENTANA, ADMIN.
isSorteoClosed
boolean
Whether the associated sorteo has been closed.
jugadas
array
Array of jugadas (bets) in this ticket.
loteria
object
Lottery details.
sorteo
object
Sorteo details with formatted name.
vendedor
object
Vendedor information with print configuration.
ventana
object
Ventana information with print configuration (same structure as vendedor).

Example Request

curl -X GET "https://api.example.com/api/v1/tickets/623e4567-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "success": true,
  "data": {
    "id": "623e4567-e89b-12d3-a456-426614174000",
    "ticketNumber": "T260303-00042A-15",
    "totalAmount": 1700,
    "status": "ACTIVE",
    "isActive": true,
    "isWinner": false,
    "loteriaId": "123e4567-e89b-12d3-a456-426614174000",
    "sorteoId": "223e4567-e89b-12d3-a456-426614174000",
    "ventanaId": "323e4567-e89b-12d3-a456-426614174000",
    "vendedorId": "423e4567-e89b-12d3-a456-426614174000",
    "clienteNombre": "Juan Pérez",
    "createdAt": "2026-03-03T14:30:00.000Z",
    "updatedAt": "2026-03-03T14:30:00.000Z",
    "businessDate": "2026-03-03",
    "totalCommission": 93.5,
    "totalPayout": null,
    "totalPaid": 0,
    "remainingAmount": 0,
    "lastPaymentAt": null,
    "paymentMethod": null,
    "paymentNotes": null,
    "paymentHistory": [],
    "createdBy": "423e4567-e89b-12d3-a456-426614174000",
    "createdByRole": "VENDEDOR",
    "isSorteoClosed": false,
    "jugadas": [
      {
        "id": "723e4567-e89b-12d3-a456-426614174000",
        "ticketId": "623e4567-e89b-12d3-a456-426614174000",
        "number": "05",
        "amount": 1000,
        "type": "NUMERO",
        "reventadoNumber": null,
        "multiplierId": "523e4567-e89b-12d3-a456-426614174000",
        "finalMultiplierX": 75,
        "isWinner": false,
        "payout": null,
        "commissionPercent": 5.5,
        "commissionAmount": 55,
        "commissionOrigin": "user",
        "commissionRuleId": "823e4567-e89b-12d3-a456-426614174000",
        "listeroCommissionAmount": 10,
        "isExcluded": false,
        "excludedAt": null,
        "excludedBy": null,
        "excludedReason": null,
        "isActive": true,
        "createdAt": "2026-03-03T14:30:00.000Z",
        "multiplier": {
          "id": "523e4567-e89b-12d3-a456-426614174000",
          "name": "Multiplicador Especial",
          "multiplierX": 75
        }
      },
      {
        "id": "823e4567-e89b-12d3-a456-426614174001",
        "ticketId": "623e4567-e89b-12d3-a456-426614174000",
        "number": "12",
        "amount": 500,
        "type": "NUMERO",
        "reventadoNumber": null,
        "multiplierId": null,
        "finalMultiplierX": 70,
        "isWinner": false,
        "payout": null,
        "commissionPercent": 5.5,
        "commissionAmount": 27.5,
        "commissionOrigin": "user",
        "commissionRuleId": "823e4567-e89b-12d3-a456-426614174000",
        "listeroCommissionAmount": 5,
        "isExcluded": false,
        "isActive": true,
        "createdAt": "2026-03-03T14:30:00.000Z",
        "multiplier": null
      },
      {
        "id": "823e4567-e89b-12d3-a456-426614174002",
        "number": "05",
        "amount": 200,
        "type": "REVENTADO",
        "reventadoNumber": "05",
        "multiplierId": null,
        "finalMultiplierX": 75,
        "isWinner": false,
        "payout": null,
        "commissionPercent": 5.5,
        "commissionAmount": 11,
        "commissionOrigin": "user",
        "commissionRuleId": "823e4567-e89b-12d3-a456-426614174000",
        "listeroCommissionAmount": 2,
        "isExcluded": false,
        "isActive": true,
        "createdAt": "2026-03-03T14:30:00.000Z"
      }
    ],
    "loteria": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "TICA",
      "rulesJson": {
        "minBet": 100,
        "maxBet": 10000,
        "digits": 2
      }
    },
    "sorteo": {
      "id": "223e4567-e89b-12d3-a456-426614174000",
      "name": "TICA 7:00 PM",
      "scheduledAt": "2026-03-03T19:00:00.000Z",
      "status": "SCHEDULED",
      "winningNumber": null,
      "hasWinner": false,
      "digits": 2
    },
    "vendedor": {
      "id": "423e4567-e89b-12d3-a456-426614174000",
      "name": "Carlos Rodríguez",
      "printName": "Vendedor #1",
      "printPhone": "+506 8888-8888",
      "printWidth": 48,
      "printFooter": "Gracias por su compra",
      "printBarcode": true,
      "printBluetoothMacAddress": "00:11:22:33:44:55"
    },
    "ventana": {
      "id": "323e4567-e89b-12d3-a456-426614174000",
      "name": "Ventana Central",
      "printName": "Ventana Central",
      "printPhone": "+506 2222-2222",
      "printWidth": 48,
      "printFooter": null,
      "printBarcode": true
    }
  }
}

Error Responses

404 Not Found

{
  "success": false,
  "error": "NOT_FOUND",
  "message": "Ticket no encontrado"
}

500 Internal Server Error - Invalid Sorteo

{
  "success": false,
  "error": "INTERNAL_ERROR",
  "message": "El ticket no tiene un sorteo asociado válido"
}

Notes

  • The sorteo name is formatted with scheduled time (e.g., “TICA 7:00 PM”)
  • Print configuration is extracted from vendedor and ventana settings JSON field
  • Commission snapshots are immutable and show the commission rates at ticket creation time
  • The finalMultiplierX shows the multiplier value at the time the ticket was created
  • No RBAC filtering is applied on single ticket retrieval (any authenticated user can view any ticket)
  • Payment history shows the complete audit trail of all payments and reversals

Build docs developers (and LLMs) love