Kongregate General Services API

The Kongregate Services API allows access to some common functions that you may find useful while developing your game. It can be used to get information about the player, including username, guest status, authentication token, etc.

API Functions


The connect function should be used as soon as you have access to the Kongregate API object in order to initialize the connection to our servers:


Checking if the user is a guest

The isGuest function can be called to determine if the player is currently signed into Kongregate or not:

var isGuest:Boolean = kongregate.services.isGuest();

Getting the player's Kongregate username

You can use the getUsername() function to retrieve the username of the current player. It will begin with Guest if the user is not signed in.

var username:String = kongregate.services.getUsername();

Getting the player's Kongregate user id

You can use the getUserId() function to retrieve the unique user id of the current player. It will return 0 if the user is not signed in.

var user_id:Number = kongregate.services.getUserId();

Getting the player's game authentication token

If you are using the Authentication API you can use the getGameAuthToken function to get the player's game authentication token:

var token:String = kongregate.services.getGameAuthToken();

Showing the sign-in box

If the player is a guest, and you want to display the sign-in/registration UI to them (for example, if you want to upsell them to buy an item or you want to use the authentication API), you can use the showSignInBox function:


Showing the registration box

This call works the same way as showSigninBox, but it focuses the registration form rather than the sign-in form.


Showing the shout box

If a player is logged-in and you want to allow them to post a shout on their profile page, you may bring up the shout box, optionally populated with some initial content.

  kongregate.services.showShoutBox("I accidentally the whole thing!");

Resizing the enclosing iframe

If you need to resize your game's enclosing container, you may do so with resizeGame call. The enclosing iframe will resize around your game. Games may not be resized smaller than their initial dimensions. (Please note: at the moment this API requires special permission to use - please email us at developer_support@kongregate.com to request access.)

resizeGame(x:Number, y:Number):void
kongregate.services.resizeGame(900, 650);

You can read the section on handling guests for more information on how to tell when a user completes registration or signing in.