Skip to main content

Play vs random player

info

Endpoint API definition
Authorization through the X-Api-Key header containing your API key is required.

Empower your platform with random matchups against the players in our community. When you call our endpoint, you'll get a URL that can be embedded in your application with an iframe. Your user is automatically added to the queue and plays with the next available player.

In this mode, your player is sandboxed and won't be able to see Ads, chat with others players, or leave the game to visit papergames.io. The papergames.io logo doesen't appear either.

Common use-cases include platforms that wish to enrich their user experience with a quick and easy way to play games. You can for example add a button to your platform that says "Play now" and when the user clicks on it, they are matched with another player from our community.

Parameters

Our API allows you to specify the configuration that fit the needs of your App. Please refer to the endpoint definition section for API usage instructions.

ParameterTypeComments
gameTyperequiredEnum (TicTacToe, Connect4 , Gomoku, Battleships, Chess)
languagerequiredEnum (en, fr, es, vi, ru, pt-br, cz, id, de)
usernamerequiredStringThe username comming from your platform.
userIdrequiredStringThe user ID from your platorm. If a player with the given ID doesen't exist, we create a new user. Otherwise we reuse the same user to keep track of the game statistics.

Sample payload

{
"gameType": "TicTacToe",
"language": "en",
"username": "John Doe",
"userId": "123456789"
}

Sample response

{
"uid": "65d8a465f65f7d62c8274a1e",
"baseUrl": "https://papergames.io/en/play-online/65d8a465f65f7d62c8274a1e"
}

The baseUrl field contains an embeddable URL that can be integrated into an iframe for a user to play.
The uid field contains the identifier for the online play session.

Online play session expiration

For security reasons, the game session expire automatically after 1 hour.

warning

The online play session URLs automatically login existing users (if they exist). Keep in mind that the links are private and should never be shared publicly.