{"openapi":"3.1.0","info":{"title":"NiuNiu Game Provider API","version":"2026-11-24","description":"Operator integration contract for white-label NiuNiu cells. Signed connectivity, one-use launches, transfer-wallet funding and transaction reconciliation are live per certified operator. Seamless-wallet callbacks and settled-round reports remain certification-gated."},"servers":[{"url":"https://{brand-game-host}/provider/v1","variables":{"brand-game-host":{"default":"play.example.com"}}}],"tags":[{"name":"Foundation","description":"Connectivity, version and capability discovery."},{"name":"Sessions","description":"One-use player launch sessions."},{"name":"Wallet","description":"Idempotent transfer-wallet operations."},{"name":"Reports","description":"Round and transaction reconciliation."}],"paths":{"/status":{"get":{"tags":["Foundation"],"summary":"Verify credentials and discover capabilities","operationId":"providerStatus","security":[{"NiuNiuHmac":[]}],"responses":{"200":{"description":"The operator credentials are valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/sessions":{"post":{"tags":["Sessions"],"summary":"Create a one-use game launch URL","operationId":"createSession","security":[{"NiuNiuHmac":[]}],"x-niuniu-stage":"live","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSessionRequest"}}}},"responses":{"201":{"description":"A short-lived, one-use launch URL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSessionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/IdempotencyConflict"}}}},"/players/{playerId}/balance":{"get":{"tags":["Wallet"],"summary":"Read the game-wallet balance","operationId":"getBalance","security":[{"NiuNiuHmac":[]}],"x-niuniu-stage":"live","parameters":[{"name":"playerId","in":"path","required":true,"schema":{"type":"string","maxLength":100}}],"responses":{"200":{"description":"Balance in integer minor units.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Balance"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/transfers/in":{"post":{"$ref":"#/components/pathItems/TransferIn"}},"/transfers/out":{"post":{"$ref":"#/components/pathItems/TransferOut"}},"/transactions/{operatorTransactionId}":{"get":{"tags":["Reports"],"summary":"Reconcile one operator transaction","operationId":"getTransaction","security":[{"NiuNiuHmac":[]}],"x-niuniu-stage":"live","parameters":[{"name":"operatorTransactionId","in":"path","required":true,"schema":{"type":"string","maxLength":100}}],"responses":{"200":{"description":"The immutable transaction result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No transaction exists for this operator and id."}}}},"/rounds/{roundId}":{"get":{"tags":["Reports"],"summary":"Read one settled round","operationId":"getRound","security":[{"NiuNiuHmac":[]}],"x-niuniu-stage":"certification","parameters":[{"name":"roundId","in":"path","required":true,"schema":{"type":"string","maxLength":100}}],"responses":{"200":{"description":"Operator-scoped round and wager lines."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"The round does not exist or does not belong to this operator."}}}}},"components":{"securitySchemes":{"NiuNiuHmac":{"type":"apiKey","in":"header","name":"X-NiuNiu-Signature","description":"Send X-NiuNiu-Key-Id, X-NiuNiu-Timestamp, X-NiuNiu-Nonce and X-NiuNiu-Signature. Sign: NIUNIU-HMAC-SHA256\\nMETHOD\\nPATH_WITH_QUERY\\nTIMESTAMP\\nNONCE\\nLOWERCASE_SHA256_HEX_OF_RAW_BODY."}},"pathItems":{"TransferIn":{"tags":["Wallet"],"summary":"Move operator credit into the game wallet","operationId":"transferIn","security":[{"NiuNiuHmac":[]}],"x-niuniu-stage":"live","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferRequest"}}}},"responses":{"200":{"description":"The original immutable transfer result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/IdempotencyConflict"}}},"TransferOut":{"tags":["Wallet"],"summary":"Move game credit back to the operator","operationId":"transferOut","security":[{"NiuNiuHmac":[]}],"x-niuniu-stage":"live","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferRequest"}}}},"responses":{"200":{"description":"The original immutable transfer result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/IdempotencyConflict"}}}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":16,"maxLength":100},"description":"Unique within this operator. Reusing it with different request bytes is rejected."}},"schemas":{"Money":{"type":"object","required":["currency","amountMinor"],"additionalProperties":false,"properties":{"currency":{"type":"string","const":"MYR"},"amountMinor":{"type":"integer","minimum":0,"description":"Sen, never a decimal amount."}}},"Status":{"type":"object","required":["ok","apiVersion","operatorId","requestId","capabilities"],"additionalProperties":false,"properties":{"ok":{"type":"boolean","const":true},"apiVersion":{"type":"string"},"operatorId":{"type":"string"},"requestId":{"type":"string"},"capabilities":{"type":"object","additionalProperties":{"type":"boolean"}}}},"CreateSessionRequest":{"type":"object","required":["playerId","displayName","currency"],"additionalProperties":false,"properties":{"playerId":{"type":"string","minLength":1,"maxLength":100},"displayName":{"type":"string","minLength":1,"maxLength":80},"currency":{"type":"string","const":"MYR"},"language":{"type":"string","enum":["en","zh"]},"returnUrl":{"type":"string","format":"uri"}}},"CreateSessionResponse":{"type":"object","required":["launchUrl","expiresAt","requestId"],"additionalProperties":false,"properties":{"launchUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"},"requestId":{"type":"string"}}},"Balance":{"type":"object","required":["playerId","balance","requestId"],"additionalProperties":false,"properties":{"playerId":{"type":"string"},"balance":{"$ref":"#/components/schemas/Money"},"requestId":{"type":"string"}}},"TransferRequest":{"type":"object","required":["operatorTransactionId","playerId","money"],"additionalProperties":false,"properties":{"operatorTransactionId":{"type":"string","minLength":1,"maxLength":100},"playerId":{"type":"string","minLength":1,"maxLength":100},"money":{"$ref":"#/components/schemas/Money"}}},"Transaction":{"type":"object","required":["operatorTransactionId","playerId","status","money","requestId"],"additionalProperties":false,"properties":{"operatorTransactionId":{"type":"string"},"playerId":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","rejected"]},"money":{"$ref":"#/components/schemas/Money"},"balanceAfter":{"$ref":"#/components/schemas/Money"},"requestId":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Missing, invalid, expired or replayed signature."},"IdempotencyConflict":{"description":"The idempotency key already exists with different request bytes."}}}}