For developers

SDK Examples and Plugins

Bubble Shooter API

You can view our detail APIs here: List of APIs

Upload your game

Fill the form here to upload your game: Upload a game

Javascript's plugin

This is the recommended way for using our APIs in Javascript. In this plugin, we will cover all API calling by using Axios and provide it with contextual data (like what is the current game, what is the id of the current player).
This plugin is powered by Axios and all it's function will return a Promise of Axios's response or error.
First, add this script to your index.html page.
<script type="text/javascript" src="https://www.bubbleshooter.com/api/plugins/BSApi.js"></script>
Then, initialize the plugin with your API key after adding the script above.
await BSApi.init('YOUR_API_KEY')
All your further actions must occur after BSApi is initialized. Or you can ensure this by calling.
BSApi.onReady(() => {
  // Put your code here
})
Every API will return an Axios's response with data look like this.
{
  status: 'success', // or 'fail' that indicate this operation has failed
  message: 'Something', // Message of operation
  data: [], // Data returned by operation if this operation is succeeded
}

External script support

We provide a way to use BSApi outside of Bubble Shooter's iframe. You can initialize BSApi by providing a context object.
await BSApi.init('YOUR_API_KEY', {game: 'bubble-spinner'})
BSApi will immediately use this context. This is how a valid context look like.
{
  game: 'game-slug', // or 'Game Name'
  user: 1 // ID of user
}

List games

You can list all your uploaded games like this.
await BSApi.listGames()

List achievements

You can list all your game's current achievements like this.
await BSApi.listAchievements()

Create achievements

You can create your game's achievements by doing this.
await BSApi.createAchievements([
  {
    name: 'Big man',
    description: 'Do something big!',
    experience: 123
  }
])

Update achievements

Same for updating your game's achievements.
await BSApi.updateAchievements([
  {
    id: 1,
    name: 'Not so big anymore',
    description: 'Just keep a low profile!',
    experience: 10
  }
])

Delete achievement

You can delete a achievement by doing this.
await BSApi.deleteAchievements([1, 2])

User context

We already cover this for you. User context (or data) is saved inside the API and ready to use at any time. If you want to manually request for user to login, you can call this API below.
await BSApi.requestForLogin()
Note that the on each reload, login popup will only show once, which means It won't show again if user decide to not login and close the popup. In this case, all your APIs which are required to login won't show the login popup again. If you want to show the popup again, you need to manually force to show it like this.
await BSApi.requestForLogin(true)
In any case, If user refuse to login and close the login popup, an error will be thrown.

Check if user is authenticated

You can check if user is authenticated (logged in) without throwing any exception by using this getter.
BSApi.isLoggedIn

Get user

You can easily get the player that currently playing by doing this.
await BSApi.getUser()
Moreover, you can pass a user's id in. This API does not need user to logged in.
await BSApi.getUser(2)

Retrieve user unlocked achievements

You can retrieve all achievement that has been unlocked by user like this.
await BSApi.getUserAchievements()

Update user score

For updating user's score, try this.
await BSApi.updateScore(666)

Get user score

For getting user's score, try this.
await BSApi.getScore()

Save user game progress

Game progress data (or game save) will be an object with multiple entry. The first parameter is the key of the entry. The second one is the value of the entry. You can update a game progress by doing this.
await BSApi.saveGameData('level', 1)
If you value is null or not present, this API will delete the entry by key instead. For example, do this will delete the 'level' entry of user's game save.
await BSApi.saveGameData('level')
This will be the same as following.
await BSApi.saveGameData('level', null)

Get user game progress

You can get a game save entry by passing a key as the first parameter to this API.
await BSApi.getGameData('level')
Moreover, the first parameter can also be null. In this case, you will get an whole object of game progress.
await BSApi.getGameData()

Unlock achievements

You can unlock achievements for an user by passing achievement's ids to this API.
await BSApi.unlockAchievements([1, 2])

Lock achievements

You can lock user's achievements by doing this.
await BSApi.lockAchievements([1, 2])

Reload game container

Sometimes, for some reason, you want to put another content into your game container (or the game iframe). Like when you game has multiple level. Each level will be serve with separate .html file (like level1.html, level2.html, ...).
In this case, you can call the method below to load your game container with different content.
await BSApi.reloadGameContainer('level2.html')
© 2025 Bubble Shooter. All rights reserved