Game
API Reference: https://api.opengameprotocol.com/api-reference
Authentication
For developer endpoints (🔒), you need HMAC authentication. See Games Management - Authentication for details on generating signatures.
Play Endpoints
Batch Save Points
POST /play/dev/batch-save-points 🔒
Save points for multiple players in a single request. This is the recommended way to update player scores from your game backend.
Headers:
Content-Type: application/json
x-auth-provider: hmac
Authorization: HMAC-SHA256 apiKey=... signature=... timestamp=...Request Body:
{
"gameApiKey": "your-game-owner-id",
"points": [
{
"playerId": "sol:9qdvVLY3vLhmvV7uBkLJsQKcHDjxhoUWJ9uZASYEfwwC",
"points": "1500"
},
{
"playerId": "email:[email protected]",
"points": "2300"
},
{
"playerId": "550e8400-e29b-41d4-a716-446655440000",
"points": "500"
}
]
}Player ID Formats:
Solana Wallet:
"sol:9qdvVLY..."or"solana:9qdvVLY..."Ethereum Wallet:
"eth:0x123..."or"ethereum:0x123..."Email:
"email:[email protected]"Privy ID:
"did:privy:abc123..."OGP User ID:
"550e8400-e29b-41d4-a716-446655440000"(raw UUID)
Response:
JavaScript Example:
Notes:
Points are cumulative - they add to existing points for the day
Users are automatically created if they don't exist (via Privy)
Cache the
playerIdToOgpIdmapping for better performance on subsequent requestsOnly the game owner/creator can save points
Get Player Points
GET /play/dev/points 🔒
Retrieve the current day's points for a specific player in your game.
Headers:
Query Parameters:
gameId(required) - Your game's UUIDplayerId(required) - Player identifier (same formats as batch-save-points)
Example Request:
Response:
JavaScript Example:
Get Game Leaderboard
GET /play/dev/leaderboard/{gameId} 🔒
Retrieve the leaderboard for your game. Returns top players ranked by points.
Headers:
Path Parameters:
gameId(required) - Your game's UUID
Query Parameters:
limit(optional, default: 10) - Number of entries to returndate(optional, default: today) - Date in YYYY-MM-DD format
Example Request:
Response:
JavaScript Example:
Notes:
Leaderboards are calculated per day
Only shows PLAYER type points (not referrer/distributor points)
Returns OGP user IDs - you may need to resolve these to player identifiers
Only the game owner/creator can access leaderboards
Rewards Endpoints
Get Game Rewards Pool
GET /rewards/game-rewards-pool/{gameId}
Get the total rewards pool value and breakdown by token for a specific game.
Path Parameters:
gameId(required) - Game UUID
Example Request:
Response:
JavaScript Example:
Error Responses
All endpoints may return the following error responses:
400 Bad Request:
401 Unauthorized:
403 Forbidden:
500 Internal Server Error:
Last updated