{"openapi":"3.0.3","info":{"title":"Admin API","description":"Administration API for the FanDuel Reward Machine.\nProvides endpoints for managing games, entries, segments, prize groups, players,\nsites, clients, and admin users/groups.\n\n## Authentication\nAll endpoints except `POST /user/login` and `PUT /user/resetPassword` require a valid\nadmin JWT in the `Authorization: Bearer <token>` header.\n\nJWTs are RS256-signed using a 4096-bit RSA key pair stored in AWS Secrets Manager\n(`<prefix>-admin-token-private-key` / `<prefix>-admin-token-public-key`).\nObtain a token by calling `POST /user/login`.\n\n**Local dev:** Set `PRIVATE_KEY_SECRET_NAME` and `PUBLIC_KEY_SECRET_NAME` in `backend/.env`,\nthen start the backend with `npm run dev` (port 3003).\nThe admin frontend proxy rewrites `/slotapi` → `http://localhost:3003/admin`.\n\n## Base URL\n| Environment | URL |\n|---|---|\n| Local dev | `http://localhost:3003` |\n| Deployed | `https://{admin-host}/slotapi/admin` (ALB listener priority 30, path `/slotapi*`) |\n\n## Password complexity\nPasswords must be 8–128 characters and satisfy at least **3 of the following 4** rules:\nuppercase letter, lowercase letter, digit, special character from `!@$%^&*<>|{}`.\n\n## Account lockout\nAfter **3 consecutive failed login attempts** the account is locked.\nLocked accounts return the same `invalid-login-credentials` error as bad passwords\n(to avoid leaking account existence). Use `PUT /user/resetPassword` to unlock.\n","version":"1.0.0"},"servers":[{"url":"http://localhost:3003","description":"Local development (backend on default port)"},{"url":"https://{adminHost}/slotapi/admin","description":"Deployed environment (replace {adminHost} with your admin ALB domain)","variables":{"adminHost":{"default":"your-admin-domain.example.com","description":"ALB or CloudFront hostname for the admin UI"}}}],"tags":[{"name":"auth","description":"Admin authentication and user session management"},{"name":"users","description":"Admin user management"},{"name":"groups","description":"Admin group and permission management"},{"name":"games","description":"Game creation and management"},{"name":"entries","description":"Player entry inspection and administration"},{"name":"segments","description":"Player segment management"},{"name":"prizeGroups","description":"Prize group and prize group template management"},{"name":"players","description":"Player data lookup"},{"name":"sites","description":"Site configuration lookup"},{"name":"clients","description":"Client configuration lookup"},{"name":"reports","description":"Analytics and reporting"}],"paths":{"/user/login":{"post":{"tags":["auth"],"summary":"Log in as an admin user","description":"Authenticates the admin user with username and password.\nReturns an RS256 JWT and the user's permission list on success.\n\n**Status code note:** All auth failures (wrong password, locked account, inactive\naccount, validation errors) intentionally return HTTP `500` — not `401` — to avoid\nleaking whether an account exists. Inspect `errorCode` to distinguish failure reasons.\n\n**Lockout:** After 3 consecutive failures the account is locked.\nA locked account returns the same `invalid-login-credentials` error as a wrong password.\nUse `PUT /user/resetPassword` to unlock and issue a new temporary password.\n","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"type":"string","format":"email","minLength":4,"maxLength":64,"description":"Admin user's email address (trimmed and lowercased before comparison)","example":"admin@example.com"},"password":{"type":"string","format":"password","minLength":1,"maxLength":128,"description":"Admin user's current password","example":"S3cur3P@ss!"}}}}}},"responses":{"200":{"description":"Login successful","content":{"application/json":{"schema":{"type":"object","required":["userId","token","permissions","clientId"],"properties":{"userId":{"$ref":"#/components/schemas/UserId"},"token":{"type":"string","description":"RS256 JWT — include as `Authorization: Bearer <token>` on subsequent requests","example":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJhYmMxMjMifQ.signature"},"permissions":{"type":"array","description":"Permission codes granted to this user","items":{"type":"string"},"example":["ViewAdminUsers","ViewReelMoney","ManageReelMoney"]},"clientId":{"$ref":"#/components/schemas/ClientId"}}},"example":{"userId":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2","token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJhYmMxMjMifQ.signature","permissions":["ViewAdminUsers","ViewReelMoney"],"clientId":"fanduel1"}}}},"400":{"description":"Missing or invalid request fields (username/password failed format check)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorValidation"},"example":{"errorCode":"validation-errors","errorMessage":"Error logging in","errors":[{"field":"username","code":"required-field-not-set","description":"username not set"}]}}}},"500":{"description":"Auth failure (intentionally uses 500 to avoid leaking account existence).\nCovers: wrong password, locked account, inactive account.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"invalid-credentials":{"summary":"Wrong password or locked account","value":{"errorCode":"invalid-login-credentials","errorMessage":"Error logging in"}}}}}}}}},"/user/resetPassword":{"put":{"tags":["auth"],"summary":"Request a password reset","description":"Generates a new random 10-character password (satisfying complexity rules) and\nemails it to the user via SES. Also **unlocks a locked account** automatically.\n\nAlways returns HTTP `200` regardless of whether the email address exists,\nto avoid leaking account existence.\n\nThe generated password is temporary; the user should change it immediately\nvia `POST /user/changePassword`.\n","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["username"],"properties":{"username":{"type":"string","format":"email","description":"Email address of the account to reset","example":"admin@example.com"}}}}}},"responses":{"200":{"description":"Request processed (email sent if account exists)","content":{"application/json":{"schema":{"type":"object"},"example":{}}}}}}},"/users":{"get":{"tags":["users"],"summary":"List admin users","description":"Returns a paginated list of admin users.\nRequires the `ViewAdminUsers` permission.\nUsers without `ManageCrossClientUsers` only see users in their own client.\n\n**Permission note:** `insufficient-permissions` returns HTTP `400` (not `403`).\n","parameters":[{"name":"pageSize","in":"query","description":"Number of users per page (max 20, default 10)","schema":{"$ref":"#/components/schemas/PageSize"}},{"name":"pageNumber","in":"query","description":"Page number to retrieve (1-based, default 1)","schema":{"$ref":"#/components/schemas/PageNumber"}}],"responses":{"200":{"description":"Users retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["paging","users"],"properties":{"paging":{"$ref":"#/components/schemas/PagingExtended"},"users":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserSummary"}}}},"example":{"paging":{"pageSize":10,"pageNumber":1,"hasNextPage":false,"hasPreviousPage":false,"totalRecords":2,"totalPages":1},"users":[{"userId":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2","username":"admin@example.com","userStatus":"active","userRegistrationTime":1587758760000},{"userId":"b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2a1","username":"viewer@example.com","userStatus":"inactive","userRegistrationTime":1587758800000}]}}}},"400":{"description":"Invalid input or insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"insufficient-permissions":{"summary":"Missing ViewAdminUsers permission (returns 400 not 403)","value":{"errorCode":"insufficient-permissions","errorMessage":"Insufficient permissions"}},"invalid-page-size":{"summary":"pageSize out of range","value":{"errorCode":"invalid-page-size","errorMessage":"Invalid page size"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/user/details":{"get":{"tags":["users"],"summary":"Get the authenticated user's profile","description":"Returns the full profile of the currently authenticated admin user,\nincluding their permissions, client, and status.\n","responses":{"200":{"description":"User details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserFull"},"example":{"userId":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2","username":"admin@example.com","userStatus":"active","userRegistrationTime":1587758760000,"clientId":"fanduel1","clientName":"FanDuel","permissions":["ManageAdminUsers","ViewAdminUsers","ViewReelMoney"]}}}},"400":{"description":"Invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"invalid-token","errorMessage":"Invalid token"}}}}},"security":[{"adminToken":[]}]}},"/user/changePassword":{"put":{"tags":["users"],"summary":"Change the authenticated user's password","description":"Changes the password for the currently authenticated admin user.\nReturns a refreshed JWT on success.\n\n**Password complexity rules** (same for all password fields in this API):\nPassword must be 8–128 characters long and satisfy at least **3 of the following 4** categories:\n- Uppercase letter: `[A-Z]`\n- Lowercase letter: `[a-z]`\n- Digit: `[0-9]`\n- Special character: `!@$%^&*<>|{}`\n\nThe new password must differ from the current password.\nFailed attempts do **not** count toward the lockout counter.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["password","newPassword"],"properties":{"password":{"type":"string","format":"password","minLength":8,"maxLength":128,"description":"Current password","example":"OldP@ssw0rd!"},"newPassword":{"type":"string","format":"password","minLength":8,"maxLength":128,"description":"New password (must meet complexity rules and differ from current).\n8–128 chars; ≥3 of: uppercase, lowercase, digit, special `!@$%^&*<>|{}`\n","example":"NewP@ssw0rd!"}}}}}},"responses":{"200":{"description":"Password changed successfully","content":{"application/json":{"schema":{"type":"object","required":["userId","token"],"properties":{"userId":{"$ref":"#/components/schemas/UserId"},"token":{"type":"string","description":"Refreshed RS256 JWT","example":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJhYmMxMjMifQ.signature"}}},"example":{"userId":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2","token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJhYmMxMjMifQ.signature"}}}},"400":{"description":"Invalid request or missing fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorValidation"},"example":{"errorCode":"validation-errors","errorMessage":"Error changing password","errors":[{"field":"newPassword","code":"invalid-password-complexity","description":"Password does not meet complexity requirements"}]}}}},"500":{"description":"Invalid current password","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"invalid-login-credentials","errorMessage":"Error changing password"}}}}}}},"/user":{"post":{"tags":["users"],"summary":"Create a new admin user","description":"Creates a new admin user for the given client. Requires the `ManageAdminUsers` permission. A temporary password is generated and emailed to the new user. The user is automatically added to all default groups for the client.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["clientId","username"],"properties":{"clientId":{"$ref":"#/components/schemas/ClientId"},"username":{"type":"string","format":"email","description":"Email address for the new admin user","example":"newadmin@example.com"}}}}}},"responses":{"200":{"description":"User created successfully. A temporary password is generated and emailed to the new user.","content":{"application/json":{"schema":{"type":"object","required":["userId"],"properties":{"userId":{"$ref":"#/components/schemas/UserId"}}}}}},"400":{"description":"Invalid input or insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/user/{userId}":{"put":{"tags":["users"],"summary":"Update an admin user's status","description":"Updates the status of the specified admin user (e.g. activate or lock the account).\nRequires the `ManageAdminUsers` permission.\n\n**Status code note:** `insufficient-permissions` maps to HTTP `403` (actual forbidden)\nfor this endpoint. User not found maps to HTTP `400` (via `not-found` error code).\n","parameters":[{"name":"userId","in":"path","required":true,"description":"ID of the admin user to update","schema":{"$ref":"#/components/schemas/UserId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userStatus"],"properties":{"userStatus":{"$ref":"#/components/schemas/UserStatus"}}},"example":{"userStatus":"active"}}}},"responses":{"200":{"description":"User updated successfully","content":{"application/json":{"schema":{"type":"object","required":["userId","userStatus"],"properties":{"userId":{"$ref":"#/components/schemas/UserId"},"userStatus":{"$ref":"#/components/schemas/UserStatus"}}},"example":{"userId":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2","userStatus":"active"}}}},"400":{"description":"User not found (note: `not-found` error code maps to HTTP 400)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"not-found","errorMessage":"User not found"}}}},"403":{"description":"Insufficient permissions to modify admin users","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"insufficient-permissions","errorMessage":"Insufficient permissions"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/permissions":{"get":{"tags":["groups"],"summary":"List all available permissions","description":"Returns all permission codes that can be assigned to admin groups.\n\n**Full permission list** (sourced from `AdminPermissionsService` + `appConstants`):\n| Permission code | Description |\n|---|---|\n| `ViewAdminUsers` | View admin users |\n| `ManageAdminUsers` | Create and modify admin users |\n| `ManageCrossClientUsers` | Manage admin users and groups across all clients |\n| `ViewReelMoney` | View reel money game entries and game configuration |\n| `ManageReelMoney` | Create and edit reel money games |\n| `GenerateReelMoneyReports` | Run reports for reel money games |\n| `ManageReelMoneySegments` | Edit reel money player segments |\n| `ViewReelMoneySegments` | View reel money player segments |\n| `ManageReelMoneySpins` | Manually adjust entry spins for reel money games |\n| `ViewRaffleGame` | View raffle game entries and game configuration |\n| `ManageRaffleGame` | Create and edit raffle games |\n| `GenerateRaffleGameReports` | Run reports for raffle games |\n| `ManageRaffleGameSegments` | Edit raffle player segments |\n| `ViewRaffleGameSegments` | View raffle player segments |\n","responses":{"200":{"description":"Permissions retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["permissions"],"properties":{"permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}}}},"example":{"permissions":[{"code":"ViewAdminUsers","description":"View admin users"},{"code":"ManageAdminUsers","description":"Create and modify admin users"},{"code":"ViewReelMoney","description":"View reel money game entries and game configuration"},{"code":"ManageReelMoney","description":"Create and edit reel money games"},{"code":"GenerateReelMoneyReports","description":"Run reports for reel money games"}]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/groups":{"get":{"tags":["groups"],"summary":"List admin groups","description":"Returns all admin groups visible to the authenticated user.\nUsers without `ManageCrossClientUsers` only see groups for their own client.\n","responses":{"200":{"description":"Groups retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["groups"],"properties":{"groups":{"type":"array","items":{"$ref":"#/components/schemas/AdminGroup"}}}},"example":{"groups":[{"groupId":1,"name":"Administrators","description":"Full access group","isDefault":true,"client":{"clientId":"fanduel1","name":"FanDuel"}},{"groupId":2,"name":"Operators","description":"Standard operator access","isDefault":false,"client":{"clientId":"fanduel1","name":"FanDuel"}}]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/group":{"post":{"tags":["groups"],"summary":"Create an admin group","description":"Creates a new admin group for the specified client.\nUsers without `ManageCrossClientUsers` can only create groups for their own client.\n\n**Status code note:** Returns HTTP `201` (Created) on success.\n`insufficient-permissions` for cross-client violation returns HTTP `403`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminGroupInput"},"example":{"clientId":"fanduel1","name":"Operators","description":"Standard operator access","isDefault":false,"users":[{"userId":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"}],"permissions":["ViewReelMoney","ManageReelMoney"]}}}},"responses":{"201":{"description":"Group created successfully (HTTP 201 Created)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminGroup"},"example":{"groupId":42,"name":"Operators","description":"Standard operator access","isDefault":false,"client":{"clientId":"fanduel1","name":"FanDuel"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorValidation"},"example":{"errorCode":"validation-errors","errorMessage":"Errors in request","errors":[{"field":"name","code":"max-length-exceeded","description":"name length cannot be longer than 32"}]}}}},"403":{"description":"Attempting to create a group for another client without `ManageCrossClientUsers`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"insufficient-permissions","errorMessage":"Insufficient permissions"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/group/{groupId}":{"get":{"tags":["groups"],"summary":"Get an admin group","description":"Returns the full details of a group, including its users and permissions.\n","parameters":[{"name":"groupId","in":"path","required":true,"description":"ID of the group","schema":{"$ref":"#/components/schemas/GroupId"}}],"responses":{"200":{"description":"Group retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"$ref":"#/components/schemas/AdminGroupFull"}}}}}},"404":{"description":"Group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]},"put":{"tags":["groups"],"summary":"Update an admin group","description":"Replaces the group's name, description, isDefault flag, user list, and permission list. Omitting `users` or `permissions` leaves them unchanged.\n","parameters":[{"name":"groupId","in":"path","required":true,"description":"ID of the group to update","schema":{"$ref":"#/components/schemas/GroupId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminGroupInput"}}}},"responses":{"200":{"description":"Group updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminGroup"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorValidation"}}}},"404":{"description":"Group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]},"delete":{"tags":["groups"],"summary":"Delete an admin group","description":"Deletes the group. The group must have no users assigned, must not be\nmarked as default, and must not be the client's last remaining group.\n\n**Status code note:** Returns HTTP `204` (No Content) with an empty body on success.\n","parameters":[{"name":"groupId","in":"path","required":true,"description":"ID of the group to delete","schema":{"$ref":"#/components/schemas/GroupId"}}],"responses":{"204":{"description":"Group deleted successfully (no response body)"},"400":{"description":"Cannot delete (group has users, is default, or is the only group)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"has-users":{"summary":"Group still has users assigned","value":{"errorCode":"cannot-delete-non-empty-group","errorMessage":"Cannot delete group with users"}},"is-default":{"summary":"Group is marked as default","value":{"errorCode":"cannot-delete-default-group","errorMessage":"Cannot delete the default group"}},"last-group":{"summary":"Only group remaining for this client","value":{"errorCode":"cannot-delete-last-group","errorMessage":"Cannot delete the last group"}}}}}},"404":{"description":"Group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"not-found","errorMessage":"Group not found"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/games":{"get":{"tags":["games"],"summary":"List games","description":"Returns a paginated, filterable list of games ordered by close time.","parameters":[{"name":"pageSize","in":"query","schema":{"$ref":"#/components/schemas/PageSize"}},{"name":"pageNumber","in":"query","schema":{"$ref":"#/components/schemas/PageNumber"}},{"name":"gameType","in":"query","schema":{"$ref":"#/components/schemas/GameType"}},{"name":"gameName","in":"query","description":"Filter by game name (partial match)","schema":{"type":"string"}},{"name":"gameId","in":"query","description":"Filter by one or more game IDs","explode":true,"schema":{"type":"array","items":{"type":"integer"}}},{"name":"sortBy","in":"query","description":"Fields to sort by","explode":true,"schema":{"type":"array","items":{"type":"string","enum":["closeTime","gameName","openTime"],"default":"closeTime"}}},{"name":"sortOrder","in":"query","schema":{"type":"string","enum":["asc","desc"],"default":"asc"}},{"name":"includeFutureGames","in":"query","schema":{"type":"boolean","default":true}}],"responses":{"200":{"description":"Games retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/Paging"},"games":{"type":"array","items":{"$ref":"#/components/schemas/Game"}}}},"example":{"paging":{"pageSize":10,"pageNumber":1,"hasNextPage":false,"hasPreviousPage":false},"games":[{"gameId":42,"gameType":"reelmoney","gameName":"Game w/c 5/10/2020","openTime":1601510400000,"closeTime":1602115200000,"displayStartTime":1601510400000,"displayEndTime":1602115200000,"startTime":1601510400000,"endTime":1602115200000,"active":true,"maxPlayerEntries":1,"defaultPlayerMaxSpins":3,"positionCount":13,"siteIds":["3e19dab8"]}]}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]},"post":{"tags":["games"],"summary":"Create a game","description":"Creates a new game, optionally based on a game template.","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GameFull"},{"type":"object","properties":{"gameTemplateId":{"type":"number","description":"Optional ID of a game template to base this game on"}}}]}}}},"responses":{"200":{"description":"Game created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GameFull"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/game/{gameId}":{"get":{"tags":["games"],"summary":"Get a game","description":"Returns the full details of the specified game.","parameters":[{"name":"gameId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/GameId"}}],"responses":{"200":{"description":"Game retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GameFull"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]},"put":{"tags":["games"],"summary":"Update a game","description":"Updates the specified game. The `gameType` field is read-only and cannot be changed.\n","parameters":[{"name":"gameId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/GameId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GameFull"}}}},"responses":{"200":{"description":"Game updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GameFull"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/game/{gameId}/paytable":{"put":{"tags":["games"],"summary":"Cache game paytable","description":"Triggers a rebuild and caching of the paytable for the specified game.","parameters":[{"name":"gameId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/GameId"}}],"responses":{"200":{"description":"Paytable cached successfully"},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/gameTemplates":{"get":{"tags":["games"],"summary":"List game templates","description":"Returns game templates, optionally filtered by site and game type.","parameters":[{"name":"siteId","in":"query","explode":true,"description":"Filter to templates for these site IDs","schema":{"type":"array","items":{"$ref":"#/components/schemas/X-IG-SiteId"}}},{"name":"gameType","in":"query","schema":{"$ref":"#/components/schemas/GameType"}}],"responses":{"200":{"description":"Game templates retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"gameTemplates":{"type":"array","items":{"$ref":"#/components/schemas/GameTemplate"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/entries":{"get":{"tags":["entries"],"summary":"List entries","description":"Returns a paginated list of player entries with optional filters.","parameters":[{"name":"fromTime","in":"query","description":"Filter entries created on or after this time (ms since epoch UTC)","schema":{"type":"integer","example":1587766673000}},{"name":"toTime","in":"query","description":"Filter entries created before this time (ms since epoch UTC)","schema":{"type":"integer","example":1587788933000}},{"name":"playerId","in":"query","description":"Filter by player ID","schema":{"$ref":"#/components/schemas/GUID"}},{"name":"gameType","in":"query","schema":{"$ref":"#/components/schemas/GameType"}},{"name":"pageSize","in":"query","schema":{"$ref":"#/components/schemas/PageSize"}},{"name":"pageNumber","in":"query","schema":{"$ref":"#/components/schemas/PageNumber"}}],"responses":{"200":{"description":"Entries retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/Paging"},"entries":{"type":"array","items":{"$ref":"#/components/schemas/GameEntry"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/entry/{receipt}":{"get":{"tags":["entries"],"summary":"Get an entry by receipt","description":"Returns the full entry details for the specified receipt.","parameters":[{"name":"receipt","in":"path","required":true,"schema":{"$ref":"#/components/schemas/GUID"}},{"name":"gameId","in":"query","schema":{"$ref":"#/components/schemas/GameId"}},{"name":"playerId","in":"query","schema":{"$ref":"#/components/schemas/PlayerId"}}],"responses":{"200":{"description":"Entry retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GameEntry"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/entry/{receipt}/{selNumber}":{"put":{"tags":["entries"],"summary":"Update an entry selection","description":"Manually reveals or expires an entry selection. Used for admin correction of stuck or failed entries.\n","parameters":[{"name":"receipt","in":"path","required":true,"schema":{"$ref":"#/components/schemas/GUID"}},{"name":"selNumber","in":"path","required":true,"description":"Selection number within the entry (1-based)","schema":{"type":"integer","minimum":1,"example":3}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GameEntrySelection"}}}},"responses":{"200":{"description":"Selection updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GameEntrySelection"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"invalid-input","errorMessage":"Invalid input"}}}},"422":{"description":"Selection has expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"errorCode":"selection-expired","errorMessage":"Selection has expired"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/segments":{"get":{"tags":["segments"],"summary":"List segments","description":"Returns a paginated list of player segments ordered by display order.","parameters":[{"name":"pageSize","in":"query","schema":{"$ref":"#/components/schemas/PageSize"}},{"name":"pageNumber","in":"query","schema":{"$ref":"#/components/schemas/PageNumber"}},{"name":"gameType","in":"query","schema":{"$ref":"#/components/schemas/GameType"}}],"responses":{"200":{"description":"Segments retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/Paging"},"segments":{"type":"array","items":{"$ref":"#/components/schemas/Segment"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/segment/{segmentId}":{"get":{"tags":["segments"],"summary":"Get a segment","description":"Returns the full details of a segment including external mappings, values, and distributions.","parameters":[{"name":"segmentId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/SegmentId"}}],"responses":{"200":{"description":"Segment retrieved successfully","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Segment"},{"type":"object","properties":{"hash":{"type":"string","description":"Hash of the segment configuration for cache invalidation"}}}]}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/prizegroups":{"get":{"tags":["prizeGroups"],"summary":"List prize groups","description":"Returns a paginated list of prize groups, optionally filtered by game.","parameters":[{"name":"gameType","in":"query","required":true,"schema":{"$ref":"#/components/schemas/GameType"}},{"name":"gameId","in":"query","description":"Filter to prize groups linked to this specific game","schema":{"$ref":"#/components/schemas/GameId"}},{"name":"pageSize","in":"query","schema":{"allOf":[{"$ref":"#/components/schemas/PageSize"},{"default":20}]}},{"name":"pageNumber","in":"query","schema":{"allOf":[{"$ref":"#/components/schemas/PageNumber"},{"default":1}]}}],"responses":{"200":{"description":"Prize groups retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/Paging"},"prizeGroups":{"type":"array","items":{"$ref":"#/components/schemas/PrizeGroup"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/prizegroup/{prizeGroupId}":{"get":{"tags":["prizeGroups"],"summary":"Get a prize group","description":"Returns the full details of a prize group, including its prizes and segment mappings.","parameters":[{"name":"prizeGroupId","in":"path","required":true,"description":"ID of the prize group","schema":{"type":"integer","example":13}}],"responses":{"200":{"description":"Prize group retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrizeGroupFull"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/prizegrouptemplates":{"get":{"tags":["prizeGroups"],"summary":"List prize group templates","description":"Returns all prize group templates for the given game type.","parameters":[{"name":"gameType","in":"query","required":true,"schema":{"$ref":"#/components/schemas/GameType"}},{"name":"pageSize","in":"query","schema":{"allOf":[{"$ref":"#/components/schemas/PageSize"},{"default":100}]}},{"name":"pageNumber","in":"query","schema":{"allOf":[{"$ref":"#/components/schemas/PageNumber"},{"default":1}]}}],"responses":{"200":{"description":"Prize group templates retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"prizeGroupTemplates":{"type":"array","items":{"$ref":"#/components/schemas/PrizeGroupTemplate"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/prizegrouptemplate/{prizeGroupTemplateId}":{"get":{"tags":["prizeGroups"],"summary":"Get a prize group template","description":"Returns the full details of a prize group template including its prize tiers.","parameters":[{"name":"prizeGroupTemplateId","in":"path","required":true,"description":"ID of the prize group template","schema":{"type":"integer","example":13}}],"responses":{"200":{"description":"Prize group template retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrizeGroupTemplateFull"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/players":{"get":{"tags":["players"],"summary":"List players","description":"Returns a paginated list of players. Users without `ManageCrossClient` can only view players for their own client.\n","parameters":[{"name":"pageSize","in":"query","description":"Number of players per page (max 200, default 10)","schema":{"allOf":[{"$ref":"#/components/schemas/PageSize"},{"maximum":200}]}},{"name":"pageNumber","in":"query","description":"Page number to retrieve (1-based, default 1)","schema":{"$ref":"#/components/schemas/PageNumber"}},{"name":"playerId","in":"query","description":"Filter by player ID","schema":{"$ref":"#/components/schemas/GUID"}},{"name":"extAcctId","in":"query","description":"Filter by external account ID","schema":{"type":"string","example":9876543}},{"name":"clientId","in":"query","description":"Filter by client ID (requires `ManageCrossClient` permission to query another client's players)","schema":{"$ref":"#/components/schemas/ClientId"}}],"responses":{"200":{"description":"Players retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/Paging"},"players":{"type":"array","items":{"$ref":"#/components/schemas/Player"}}}}}}},"400":{"description":"Invalid input or insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/player/{playerId}":{"get":{"tags":["players"],"summary":"Get a player","description":"Returns the details of a specific player by player ID.","parameters":[{"name":"playerId","in":"path","required":true,"description":"Player ID to look up","schema":{"$ref":"#/components/schemas/PlayerId"}}],"responses":{"200":{"description":"Player retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Player"}}}},"400":{"description":"Invalid player ID or player not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"invalid-id":{"value":{"errorCode":"invalid-input","errorMessage":"Invalid player ID"}},"not-found":{"value":{"errorCode":"player-not-found","errorMessage":"Player not found"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/sites":{"get":{"tags":["sites"],"summary":"List sites","description":"Returns a paginated, sortable list of sites. Users without `ManageCrossClient` can only view sites for their own client.\n","parameters":[{"name":"pageSize","in":"query","description":"Number of sites per page (max 200, default 10)","schema":{"allOf":[{"$ref":"#/components/schemas/PageSize"},{"maximum":200}]}},{"name":"pageNumber","in":"query","description":"Page number to retrieve (1-based, default 1)","schema":{"$ref":"#/components/schemas/PageNumber"}},{"name":"orderBy","in":"query","description":"Sort order (`name` or `date`, default `name`)","schema":{"type":"string","enum":["name","date"],"default":"name"}},{"name":"clientId","in":"query","description":"Filter by client ID (requires `ManageCrossClient` permission to query another client's sites)","schema":{"$ref":"#/components/schemas/ClientId"}}],"responses":{"200":{"description":"Sites retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/Paging"},"sites":{"type":"array","items":{"$ref":"#/components/schemas/Site"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permissions to view sites for another client","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/clients":{"get":{"tags":["clients"],"summary":"List clients","description":"Returns a paginated, sortable list of integrated clients.","parameters":[{"name":"pageSize","in":"query","description":"Number of clients per page (max 20, default 10)","schema":{"allOf":[{"$ref":"#/components/schemas/PageSize"},{"maximum":20}]}},{"name":"pageNumber","in":"query","description":"Page number to retrieve (1-based, default 1)","schema":{"$ref":"#/components/schemas/PageNumber"}},{"name":"orderBy","in":"query","description":"Sort order (`name` or `date`, default `name`)","schema":{"type":"string","enum":["name","date"],"default":"name"}}],"responses":{"200":{"description":"Clients retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/Paging"},"clients":{"type":"array","items":{"$ref":"#/components/schemas/Client"}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}},"/admin/report":{"post":{"tags":["reports"],"summary":"Run a report","description":"Triggers a report run. Requires the game-type-specific `GenerateReelMoneyReports`\nor `GenerateRaffleGameReports` permission (checked via `canRunReport`).\n\n**Report is generated asynchronously**: the response confirms the request was\naccepted; results are delivered by email as a CSV file via AWS SES to the\nconfigured recipients.\n\n**Available report types:**\n| reportType | Description |\n|---|---|\n| `gameSpins` | All spins for a given game |\n| `reward` | Successful reward payouts for a game |\n| `failedReward` | Failed reward attempts for a game |\n| `simulation` | Paytable simulation results |\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"},"example":{"reportType":"gameSpins","gameId":42,"compressed":true}}}},"responses":{"200":{"description":"Report triggered successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"},"example":{"reportType":"gameSpins","gameId":42,"compressed":true}}}},"400":{"description":"Invalid input or insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"insufficient-permissions":{"summary":"User lacks report permission","value":{"errorCode":"insufficient-permissions","errorMessage":"Insufficient permissions"}},"invalid-report-type":{"summary":"Unknown reportType value","value":{"errorCode":"invalid-input","errorMessage":"Invalid report type"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"adminToken":[]}]}}},"components":{"securitySchemes":{"adminToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"RS256-signed JWT obtained from `POST /user/login`.\n\n**Header format:**\n```\nAuthorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\n```\n\n**JWT details:**\n- Algorithm: RS256 (4096-bit RSA key pair)\n- Private key (signing): stored in AWS Secrets Manager as `<prefix>-admin-token-private-key`\n- Public key (verification): stored in AWS Secrets Manager as `<prefix>-admin-token-public-key`\n- Lambda env vars: `PRIVATE_KEY_SECRET_NAME`, `PUBLIC_KEY_SECRET_NAME`\n\n**To acquire a token for testing:**\n1. Call `POST /user/login` with valid admin credentials\n2. Extract the `token` field from the response\n3. Include it as `Authorization: Bearer <token>` on all subsequent requests\n\nAll authenticated endpoints return HTTP `400` with `errorCode: invalid-token`\nwhen the token is missing, malformed, or expired.\n"}},"schemas":{"X-IG-SiteId":{"type":"string","pattern":"^[a-f0-9]{8}$","description":"8-character hex site identifier","example":"00000000","minLength":8,"maxLength":8},"GameId":{"type":"integer","description":"Unique game identifier","readOnly":true,"minimum":1,"example":1},"GameType":{"type":"string","enum":["reelmoney","raffle"]},"CollectionType":{"type":"string","enum":["trophy","cherry","bell","seven"]},"CollectionTypeReveal":{"type":"string","enum":["blue","yellow","purple","green","red"]},"PrizeCode":{"type":"string","enum":["freespins","freebet","sitecredit","freebetincstake","igtoken","dynamic","casinobonus"],"example":"sitecredit"},"CurrencyCode":{"type":"string","description":"3-letter ISO 4217 currency code","minLength":3,"maxLength":3,"readOnly":true,"example":"USD"},"GUID":{"type":"string","minLength":40,"maxLength":40,"example":"1fd45e73eca22ce71a67e896598fb52fbfca4f7e"},"PlayerId":{"type":"string","minLength":40,"maxLength":40,"readOnly":true,"example":"5fd45e73eca22ce71a67e896598fb52fbfca4f7e"},"SegmentId":{"type":"integer","readOnly":true,"example":22},"PaytableId":{"type":"integer","readOnly":true,"example":11},"UserId":{"type":"string","minLength":40,"maxLength":40,"description":"SHA-1 hex user identifier","example":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"},"ClientId":{"type":"string","minLength":8,"maxLength":8,"description":"8-character client reference","example":"fanduel1"},"GroupId":{"type":"integer","description":"Admin group identifier","example":42},"PageSize":{"type":"integer","minimum":1,"example":10},"PageNumber":{"type":"integer","minimum":1,"example":1},"UserStatus":{"type":"string","enum":["active","locked","inactive"],"example":"active"},"Paging":{"type":"object","properties":{"pageSize":{"$ref":"#/components/schemas/PageSize"},"pageNumber":{"$ref":"#/components/schemas/PageNumber"},"hasNextPage":{"type":"boolean","example":true},"hasPreviousPage":{"type":"boolean","example":false}}},"PagingExtended":{"allOf":[{"$ref":"#/components/schemas/Paging"},{"type":"object","properties":{"totalRecords":{"type":"integer","example":150},"totalPages":{"type":"integer","example":15}}}]},"Error":{"type":"object","required":["errorCode","errorMessage"],"properties":{"errorCode":{"type":"string","description":"Machine-readable error identifier. Complete catalog:\n\n| errorCode | HTTP status | Description |\n|---|---|---|\n| `invalid-login-credentials` | 500 | Wrong password, locked account, or inactive account (500 is intentional to avoid leaking account existence) |\n| `validation-errors` | 400 | Request body failed schema validation (see `errors` array in ErrorValidation) |\n| `insufficient-permissions` | 400 | Authenticated user lacks the required permission (note: 400, not 403) |\n| `invalid-token` | 400 | JWT is missing, malformed, or expired |\n| `not-found` | 400 | Resource not found via generic lookup (note: 400, not 404) |\n| `not-found` | 404 | Group explicitly not found via group-specific lookup |\n| `player-not-found` | 400 | Specified player does not exist |\n| `invalid-input` | 400 | Request parameters failed validation |\n| `invalid-page-size` | 400 | `pageSize` query parameter is invalid |\n| `invalid-page-number` | 400 | `pageNumber` query parameter is invalid |\n| `invalid-playerid` | 400 | Provided player ID is malformed |\n| `selection-has-expired` | 422 | The requested entry selection has passed its expiry time |\n| `cannot-delete-default-group` | 400 | Attempted to delete a group marked as default |\n| `cannot-delete-non-empty-group` | 400 | Attempted to delete a group that still has users |\n| `cannot-delete-last-group` | 400 | Attempted to delete the client's only remaining group |\n| `unrecognised-method` | 400 | HTTP method not supported for this path |\n| `internal-error` | 500 | Unexpected server error |\n| `internal-server-error` | 500 | Unexpected server error (alias) |\n","example":"invalid-input"},"errorMessage":{"type":"string","description":"Human-readable description of the error","example":"Invalid input"}}},"ErrorValidation":{"type":"object","required":["errorCode","errorMessage","errors"],"properties":{"errorCode":{"type":"string","example":"validation-errors"},"errorMessage":{"type":"string","example":"Errors in request"},"errors":{"type":"array","items":{"type":"object","required":["field","code","description"],"properties":{"field":{"type":"string","description":"Name of the field that failed validation","example":"username"},"code":{"type":"string","description":"Machine-readable validation failure code","example":"required-field-not-set"},"description":{"type":"string","description":"Human-readable explanation","example":"username not set"}}}}}},"AdminUserSummary":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"username":{"type":"string","format":"email","example":"admin@example.com"},"userStatus":{"$ref":"#/components/schemas/UserStatus"},"userRegistrationTime":{"type":"integer","description":"Account creation time (ms since epoch UTC)","example":1587758760000}}},"AdminUserFull":{"allOf":[{"$ref":"#/components/schemas/AdminUserSummary"},{"type":"object","properties":{"clientId":{"$ref":"#/components/schemas/ClientId"},"clientName":{"type":"string","example":"FanDuel"},"permissions":{"type":"array","description":"Sorted list of permission codes granted to this user","items":{"type":"string","example":"ViewAdminUsers"}}}}]},"Permission":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable permission identifier","example":"ManageAdminUsers"},"description":{"type":"string","description":"Human-readable description of what the permission grants","example":"Allows creating and modifying admin users"}}},"AdminGroup":{"type":"object","properties":{"groupId":{"$ref":"#/components/schemas/GroupId"},"name":{"type":"string","maxLength":32,"example":"Operators"},"description":{"type":"string","maxLength":256,"example":"Standard operator access"},"isDefault":{"type":"boolean","description":"Whether new users for this client are automatically added to this group","example":false},"client":{"type":"object","properties":{"clientId":{"$ref":"#/components/schemas/ClientId"},"name":{"type":"string","example":"FanDuel"}}}}},"AdminGroupFull":{"allOf":[{"$ref":"#/components/schemas/AdminGroup"},{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"username":{"type":"string","format":"email"}}}},"permissions":{"type":"array","items":{"type":"string","description":"Permission code","example":"ViewAdminUsers"}}}}]},"AdminGroupInput":{"type":"object","required":["clientId","name","isDefault"],"properties":{"clientId":{"$ref":"#/components/schemas/ClientId"},"name":{"type":"string","maxLength":32,"example":"Operators"},"description":{"type":"string","maxLength":256,"example":"Standard operator access"},"isDefault":{"type":"boolean","example":false},"users":{"type":"array","description":"Users to assign to this group (replaces existing assignment on PUT)","items":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"}}}},"permissions":{"type":"array","description":"Permission codes to assign to this group (replaces existing on PUT)","items":{"type":"string","example":"ViewAdminUsers"}}}},"GameFeature":{"type":"object","properties":{"code":{"type":"string","example":"supercharge"},"active":{"type":"boolean","example":true}}},"GameStat":{"type":"object","properties":{"type":{"type":"string","readOnly":true,"enum":["totalActiveEntries","totalVoidEntries"]},"value":{"type":"number","readOnly":true,"example":32456}}},"RevealScheduleItem":{"type":"object","properties":{"selnNumber":{"type":"integer","minimum":1,"example":1},"revealTime":{"type":"integer","description":"Time this selection becomes available (ms since epoch UTC)","example":1601290800000},"expiryTime":{"type":"integer","description":"Time this selection expires (ms since epoch UTC)","example":1601377200000}}},"GameSite":{"type":"object","properties":{"siteId":{"$ref":"#/components/schemas/X-IG-SiteId"},"extGameType":{"type":"string","description":"External game type identifier used by the integrated site","example":"reelmoneygame"}}},"Game":{"type":"object","properties":{"gameId":{"$ref":"#/components/schemas/GameId"},"gameType":{"$ref":"#/components/schemas/GameType"},"gameName":{"type":"string","example":"Game w/c 5/10/2020"},"openTime":{"type":"integer","description":"Time game opens for entries (ms since epoch UTC)","example":1587758760000},"closeTime":{"type":"integer","description":"Time game closes for entries (ms since epoch UTC)","example":1587758760000},"displayStartTime":{"type":"integer","description":"Time game becomes visible on site (ms since epoch UTC)","example":1587758760000},"displayEndTime":{"type":"integer","description":"Time game is removed from display (ms since epoch UTC)","example":1587758760000},"startTime":{"type":"integer","description":"Time the first game event starts (ms since epoch UTC)","example":1587758760000},"endTime":{"type":"integer","description":"Time the last game event finishes (ms since epoch UTC)","example":1587758760000},"active":{"type":"boolean","description":"Whether the game is accepting entries"},"maxPlayerEntries":{"type":"integer","minimum":1,"example":1},"defaultPlayerMaxSpins":{"type":"integer","minimum":1,"example":3},"positionCount":{"type":"integer","minimum":1,"example":13},"siteIds":{"type":"array","items":{"type":"string","example":"3e19dab8"}},"collections":{"type":"array","items":{"$ref":"#/components/schemas/GameEntryCollection"}},"gameSites":{"type":"array","items":{"$ref":"#/components/schemas/GameSite"}}}},"GameFull":{"allOf":[{"$ref":"#/components/schemas/Game"},{"type":"object","properties":{"revealSchedule":{"type":"array","items":{"$ref":"#/components/schemas/RevealScheduleItem"}},"features":{"type":"array","items":{"$ref":"#/components/schemas/GameFeature"}}}}]},"GameTemplate":{"type":"object","properties":{"gameTemplateId":{"type":"number","example":5},"name":{"type":"string","example":"Example Game Template"},"gameType":{"$ref":"#/components/schemas/GameType"},"gameSiteTemplates":{"type":"array","items":{"type":"object","properties":{"siteId":{"$ref":"#/components/schemas/X-IG-SiteId"},"extGameType":{"type":"string","example":"reelmoneygame"},"gameTemplateId":{"type":"number","example":5}}}}}},"GameEntryCollection":{"type":"object","properties":{"collectionType":{"$ref":"#/components/schemas/CollectionType"},"amount":{"type":"integer","minimum":0},"targetAmount":{"type":"integer","minimum":0,"example":50},"prizes":{"type":"array","items":{"type":"object","properties":{"prizeCode":{"$ref":"#/components/schemas/PrizeCode"},"prizeAmount":{"type":"number"},"prizeMultiplier":{"type":"number"}}}}}},"GameEntrySelectionSpinResult":{"type":"object","properties":{"reelNumber":{"type":"integer","minimum":1,"example":1},"collectionType":{"$ref":"#/components/schemas/CollectionType"}}},"Prize":{"type":"object","properties":{"collectionType":{"$ref":"#/components/schemas/CollectionType"},"prizeCode":{"$ref":"#/components/schemas/PrizeCode"},"prizeCurrencyCode":{"$ref":"#/components/schemas/CurrencyCode"},"prizeAwardedTime":{"type":"integer","example":1587758760000},"prizeAmount":{"type":"number","format":"float","example":10.0},"prizeMultiplier":{"type":"number","format":"float","example":1.0},"prizeSettled":{"type":"boolean","example":false},"prizeSettledTime":{"type":"integer","example":1587758760000},"instantWin":{"type":"boolean","example":false},"collectionWin":{"type":"boolean","example":false},"manualPayment":{"type":"boolean","example":false}}},"GameEntrySelectionSpin":{"type":"object","properties":{"spinNumber":{"type":"integer","minimum":1,"readOnly":true},"receipt":{"readOnly":true,"allOf":[{"$ref":"#/components/schemas/GUID"}]},"status":{"type":"string","enum":["active","void"],"readOnly":true},"instantWin":{"type":"boolean","readOnly":true,"default":false},"collectionWins":{"type":"integer","readOnly":true,"default":0},"position":{"type":"integer","readOnly":true,"default":1},"results":{"type":"array","readOnly":true,"items":{"$ref":"#/components/schemas/GameEntrySelectionSpinResult"}},"prizes":{"type":"array","items":{"$ref":"#/components/schemas/Prize"}}}},"GameEntrySelection":{"type":"object","properties":{"selnNumber":{"type":"integer","minimum":1,"example":1,"readOnly":true},"revealTime":{"type":"integer","example":1601290800000,"readOnly":true},"expiryTime":{"type":"integer","example":1601377200000,"readOnly":true},"revealed":{"type":"boolean","readOnly":true},"revealedTime":{"type":"integer","readOnly":true},"totalSpins":{"type":"integer","readOnly":true,"minimum":0,"default":0},"maxSpins":{"type":"integer","minimum":0,"example":3},"additionalSpins":{"type":"integer","default":0},"spins":{"type":"array","readOnly":true,"items":{"$ref":"#/components/schemas/GameEntrySelectionSpin"}}}},"GameEntry":{"type":"object","properties":{"gameId":{"$ref":"#/components/schemas/GameId"},"gameType":{"$ref":"#/components/schemas/GameType"},"playerId":{"$ref":"#/components/schemas/PlayerId"},"receipt":{"readOnly":true,"allOf":[{"$ref":"#/components/schemas/GUID"}]},"status":{"type":"string","enum":["active","void"],"readOnly":true},"entryTime":{"type":"integer","readOnly":true,"example":1587758760000},"currencyCode":{"$ref":"#/components/schemas/CurrencyCode"},"settled":{"type":"boolean","readOnly":true,"example":false},"activeSelnNumber":{"type":"number","readOnly":true},"features":{"type":"array","readOnly":true,"items":{"$ref":"#/components/schemas/GameFeature"}},"collections":{"type":"array","readOnly":true,"items":{"$ref":"#/components/schemas/GameEntryCollection"}},"selections":{"type":"array","readOnly":true,"items":{"$ref":"#/components/schemas/GameEntrySelection"}}}},"ExternalMapping":{"type":"object","properties":{"id":{"type":"number","readOnly":true,"example":5},"name":{"type":"string","example":"Standard Direct (6%)"},"active":{"type":"boolean"},"code":{"type":"string","example":"casino-standard"},"displayOrder":{"type":"integer","example":13},"siteId":{"$ref":"#/components/schemas/X-IG-SiteId"},"siteName":{"type":"string","example":"IG Mock Site"}}},"SegmentValue":{"type":"object","properties":{"paytableId":{"$ref":"#/components/schemas/PaytableId"},"paytableName":{"type":"string","example":"Green"},"paytableActive":{"type":"boolean"},"collectionCode":{"$ref":"#/components/schemas/CollectionTypeReveal"},"prizeCode":{"$ref":"#/components/schemas/PrizeCode"},"collectionName":{"type":"string","example":"Green"},"currencyCode":{"$ref":"#/components/schemas/CurrencyCode"},"value":{"type":"string","example":"10000"},"distribution":{"type":"string","example":"12"},"extPrizeId":{"type":"string"}}},"SegmentCollection":{"type":"object","properties":{"collectionType":{"$ref":"#/components/schemas/CollectionType"},"targetAmount":{"type":"integer"},"prizeCode":{"$ref":"#/components/schemas/PrizeCode"},"displayOrder":{"type":"integer"}}},"SegmentDistribution":{"type":"object","properties":{"collectionType":{"type":"string","example":"Cherry"},"distribution":{"type":"number","example":7},"active":{"type":"boolean"}}},"Segment":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/SegmentId"},"active":{"type":"boolean"},"gameType":{"$ref":"#/components/schemas/GameType"},"name":{"type":"string","example":"VIP xProduct"},"displayOrder":{"type":"integer","example":13},"externalMappings":{"type":"array","items":{"$ref":"#/components/schemas/ExternalMapping"}},"values":{"type":"array","items":{"$ref":"#/components/schemas/SegmentValue"}},"distribution":{"type":"array","items":{"$ref":"#/components/schemas/SegmentDistribution"}},"collections":{"type":"array","items":{"$ref":"#/components/schemas/SegmentCollection"}}}},"PrizeGroup":{"type":"object","properties":{"prizeGroupId":{"type":"number","example":123},"default":{"type":"boolean","example":false},"playerSegmentGroupId":{"type":"number","example":456},"playerSegmentGroupName":{"type":"string","example":"Example Group"},"gameType":{"$ref":"#/components/schemas/GameType"},"gameId":{"$ref":"#/components/schemas/GameId"}}},"PrizeGroupFull":{"allOf":[{"$ref":"#/components/schemas/PrizeGroup"},{"type":"object","properties":{"playerSegmentGroupActive":{"type":"boolean","example":true},"segments":{"type":"array","items":{"type":"object","properties":{"playerSegmentId":{"$ref":"#/components/schemas/SegmentId"},"name":{"type":"string","example":"VIP xProduct"},"active":{"type":"boolean"}}}},"prizes":{"type":"array","items":{"type":"object","properties":{"minPosition":{"type":"number","example":1},"maxPosition":{"type":"number","example":1},"prizeCode":{"$ref":"#/components/schemas/PrizeCode"},"description":{"type":"string","example":"Prize for 1st place"},"autoPayout":{"type":"boolean","example":true},"currencies":{"type":"array","items":{"type":"object","properties":{"currencyCode":{"$ref":"#/components/schemas/CurrencyCode"},"value":{"type":"number","format":"float","example":10.0}}}}}}}}}]},"PrizeGroupTemplate":{"type":"object","properties":{"prizeGroupTemplateId":{"type":"number","example":123},"default":{"type":"boolean","example":true},"playerSegmentGroupId":{"type":"number","example":456},"playerSegmentGroupName":{"type":"string","example":"Example Group"},"gameType":{"$ref":"#/components/schemas/GameType"}}},"PrizeGroupTemplateFull":{"allOf":[{"$ref":"#/components/schemas/PrizeGroupTemplate"},{"type":"object","properties":{"playerSegmentGroupActive":{"type":"boolean","example":true},"segments":{"type":"array","items":{"type":"object","properties":{"playerSegmentId":{"$ref":"#/components/schemas/SegmentId"},"name":{"type":"string","example":"VIP xProduct"},"active":{"type":"boolean"}}}},"prizes":{"type":"array","items":{"type":"object","properties":{"minPosition":{"type":"number","example":1},"maxPosition":{"type":"number","example":1},"prizeCode":{"$ref":"#/components/schemas/PrizeCode"},"description":{"type":"string","example":"Prize for 1st place"},"autoPayout":{"type":"boolean","example":true},"currencies":{"type":"array","items":{"type":"object","properties":{"currencyCode":{"$ref":"#/components/schemas/CurrencyCode"},"value":{"type":"number","format":"float","example":10.0}}}}}}}}}]},"Player":{"type":"object","description":"Player record as seen from the admin panel","properties":{"playerId":{"$ref":"#/components/schemas/PlayerId"},"extAcctId":{"type":"string","description":"External account ID from the integrated platform","example":"9876543"},"clientId":{"$ref":"#/components/schemas/ClientId"},"clientName":{"type":"string","example":"FanDuel"}}},"Site":{"type":"object","description":"An integrated site / brand configuration","properties":{"siteId":{"$ref":"#/components/schemas/X-IG-SiteId"},"name":{"type":"string","example":"FanDuel Casino US"},"clientId":{"$ref":"#/components/schemas/ClientId"},"clientName":{"type":"string","example":"FanDuel"},"createdAt":{"type":"integer","description":"Site creation time (ms since epoch UTC)","example":1587758760000}}},"Client":{"type":"object","description":"An integrated client (operator)","properties":{"clientId":{"$ref":"#/components/schemas/ClientId"},"name":{"type":"string","example":"FanDuel"},"createdAt":{"type":"integer","description":"Client creation time (ms since epoch UTC)","example":1587758760000}}},"Report":{"type":"object","required":["reportType","gameId"],"properties":{"reportType":{"type":"string","enum":["gameSpins","reward","failedReward","simulation"],"description":"Type of report to generate:\n- `gameSpins` — All spins for a game\n- `reward` — Successful reward payouts\n- `failedReward` — Failed reward attempts\n- `simulation` — Paytable simulation results\n","example":"gameSpins"},"gameId":{"type":"integer","description":"ID of the game to report on","minimum":1,"example":42},"compressed":{"type":"boolean","description":"Whether to compress the CSV before emailing (gzip). Defaults to true.","default":true}}}}}}