Determines and saves winners for a completed trivia challenge based on participant scores.How it works:
1.
Retrieves all participants sorted by score (DESC) and finish time (ASC)
2.
Gets the best participant per user (deduplicates multiple attempts)
3.
Selects top N winners (N = challenge.numberOfWinners)
4.
Calculates prize amount for each position based on sharing formula:
EQUAL: Total prize ÷ number of winners
TOP_HEAVY: 50% to 1st, 30% to 2nd, 20% to 3rd, rest split equally
PROPORTIONAL: Prize decreases proportionally by position
CUSTOM: Uses configured prize tiers from trivia_prize_tiers table
5.
Saves winners to trivia_winners table
Important Notes:
This endpoint does NOT credit prizes to wallets
If auto-credit is enabled (trivia.auto-credit-prizes=true), prizes will be automatically credited
If auto-credit is disabled, you must call /credit-prizes endpoint separately
Winners can only be processed once per challenge (idempotent operation)
If winners already exist, returns existing winners without reprocessing
Request
Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Path Params
Request Code Samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl--location--request POST 'https://mock.apidog.com/m1/918700-0-default/v1/trivia/challenges/1/process-winners' \
--header'Authorization: Bearer <token>'
Responses
🟢200OK
application/json
Winners processed successfully
Body
Example
{"timestamp":"2024-01-15T10:30:00Z","status":200,"success":true,"message":"Winners processed successfully","data":"Winners have been saved for challenge 1"}