Embed Games
Drop a tupic Game anywhere on the web. One iframe, mobile-ready, no plugins.
What you get
Every game on tupic Game ships a public embed endpoint that serves a stripped-down, chrome-free build of the game suitable for embedding. You get a full HTML5 game in an iframe -- no SDK toolbar, no surrounding navigation, no auth wall when the game is public.
- Pure HTML5: works on every modern browser, mobile and desktop.
- Touch controls and a responsive canvas are included automatically.
- Public games embed without auth. Private games require a share token.
- Score submissions and leaderboards keep working from inside the iframe.
Quick start
Replace {game_id} with the ID of your game (you can find it on the game detail page or via GET /api/v1/games):
<iframe
src="https://games.tupic.com/api/v1/games/{game_id}/embed"
width="800"
height="600"
frameborder="0"
allow="autoplay; fullscreen"
allowfullscreen
></iframe>That is the entire integration. The iframe loads the game; everything else (rendering, input, scoring) happens inside it.
Get the embed snippet via API
If you are integrating from your own backend, the API can return ready-made snippets for popular destinations:
GET https://games.tupic.com/api/v1/games/{game_id}/embed-codeThe response includes:
- iframe -- a copy-pasteable HTML iframe block.
- embed_url -- the URL the iframe points at, in case you want to build your own player around it.
- link -- the public share URL for the game detail page.
- telegram, whatsapp, twitter, facebook -- pre-formatted share-intent URLs you can drop into share buttons.
Responsive sizing
For a fluid layout, wrap the iframe in a container that maintains a 4:3 or 16:9 aspect ratio:
<div style="position: relative; padding-bottom: 75%; height: 0; overflow: hidden;">
<iframe
src="https://games.tupic.com/api/v1/games/{game_id}/embed"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
frameborder="0"
allow="autoplay; fullscreen"
allowfullscreen
></iframe>
</div>The game canvas inside the iframe will scale to fill the available space while preserving its own internal aspect ratio.
Embedding private games
By default, private games refuse embed requests from unauthenticated visitors. To share a private game without forcing every viewer to sign in, generate a share token:
POST https://games.tupic.com/api/v1/games/{game_id}/share
Authorization: Bearer <your_token>The response contains a share_token. Use the public play URL with that token instead of the embed endpoint:
<iframe
src="https://games.tupic.com/play/{share_token}"
width="800" height="600" frameborder="0"
allow="autoplay; fullscreen" allowfullscreen
></iframe>Share tokens can be rotated at any time by calling POST /api/v1/games/{game_id}/share again. The previous token stops working immediately.
Sandbox & performance notes
- The iframe needs
allow="autoplay; fullscreen"to use audio without a tap and to enter fullscreen on mobile. - If your site uses a strict
Content-Security-Policy, allowhttps://games.tupic.cominframe-src. - The embed loads its own assets from the same origin; no third-party requests are made from inside the iframe except to tupic Game.
- First load is typically under 1.5s on broadband; subsequent loads are cached and feel instant.
Content & compliance
Public games go through a moderation review before they can be embedded. Private games you own can be embedded immediately. By embedding a tupic Game on your site, you agree to the Terms of Service and confirm that your site complies with the host platform policies (Google Play, App Store) where applicable.