Getting Started with PlayFab - Chapter 1

Welcome! This introductory tutorial will quickly get you up and running with PlayFab. By following this tutorial, you will go through the following steps:

Chapter 1 - Get started with players and tournaments

Chapter 2 - Set up your game's in-game economy

Chapter 3 - Explore automation

Chapter 4 - Try out content management

If you have already created an account with PlayFab, then this tutorial is also available in a special interactive version directly inside the Game Manager. If you plan on following along with these steps, then you may find that version more useful.

Let's get started!

Get started with players and tournaments

In this chapter you will:

  1. Getting Started & First API Call
  2. Update your Login Mechanism
  3. Using remote configuration data
  4. View a player profile using our management tool
  5. Create a basic leaderboard, and add the player to it
  6. View your game's analytics data in real-time

1. Getting Started & First API Call

We have SDKs for all major game engines and languages.

Choose an environment from the list below, and follow the link to the appropriate getting started guide.  This will guide you through installing your environment, creating a new test project, and making your first API call.

Pick your SDK:

2. Update your Login mechanism

The first step adding PlayFab to any game is always logging in the player. Logging in the player returns a security token that is needed for all other API calls.

The Guides in step 1 utilize a test titleId, but from now on, you should be using your own.  Create a title in Game Manager, and update your environment with your own titleId.

Obtaining your titleId

TitleId's are obtained from the Game Manager.  If you haven't already, register for a free PlayFab developer account, then login to the game manager.

Once logged in, click "Settings". You should see the titleId for your game:


The SDK guide you followed above should have included instructions on how to enter your Title ID.


PlayFab makes it easy to authenticate players. On a smartphone you can login with the iOS or Android device ID for easy authentication with zero friction for the player. We also support authentication with Windows, Google, Kongregate, Facebook, Steam, and Twitch accounts, as well as username/password, email/password, or an ID you generate.

For this tutorial, we'll demonstrate authentication using the last method - LoginWithCustomID, which uses an arbitrary string generated by your title, or your own game servers. It's worth noting, however, that the recommended path for most titles is to use authentication mechanisms that align to the devices and platforms on which your title is shipping. So, for example, on Android or iOS, use the device-specific login API calls to get players into the game quickly, and then incentivize them to add a cross-device authentication mechanism later as part of the game experience (as shown in this post).

After a login call, you can call other functions in the client API. Some, like UpdatePlayerStatistics and AddUserVirtualCurrency are disabled by default until you allow them on the API Features page in Game Manager (and you can specifically enable or disable any Client API calls using Permission Policies).

PRO TIP: If you look at the PlayStream Debugger on the Dashboard tab of the game manager, you will see several events connected to logging you in.

How your player appears in PlayStream.

You can click the "information" circle to view the raw JSON of that event.

The result of LoginWithCustomID

3. Using remote configuration data

Storing configuration information about your game on PlayFab is a smart idea, because you can then change that data at any time. This is much more useful than hard-coding that information in your game, and having to update your client to change anything.

Configuration data for your game is stored in what we call Title Data.

Examples of configuration data might include much XP a player earns from each match, a maximum movement speed, or a feedback URL. You can store JSON in the title data if your game requires more complex data.

  1. Go to Content > Title Data
  2. Add a few keys and values, doesn't matter what they are
  3. Click Save Title Data

Put in anything you like. You can delete it later.

That's all you have to do in the Game Manager.

  1. In your game, call GetTitleData
  2. You should see the keys and values you just added

Verify your title data returns successfully.

Title Data is a great way to tweak your game balance while it's in development, or to run special events post-launch.

4. View your player profile in the Game Manager

You should now have a new player created, identified with the Custom ID you configured earlier.

  1. Go to the Players tab
  2. You should see the player you just createdThe UserId is not the CustomId. Run a search for your CustomId if you have lots of players.
  3. If not, paste the Custom ID from above into the query box and click Search.
  4. Click on that player

From the Overview tab you can see the player's email address, when they were created (provisioned), change their statistics, look at login events, manage characters, check on their inventory, and much more. On the player's PlayStream tab you can watch their events come in live.

There are many ways to manage your player on this screen and its tabs.

Custom ID vs User ID

The player's Custom ID is not the same as their User ID. User ID is automatically generated by PlayFab and used to track the player if they login using different methods.

Some games do choose to expose the User ID to the player, however, to help with customer support requests.


5. Create a basic leaderboard

Let's create a statistic for this player so you can try out our leaderboard feature, and later, some player segmentation capabilities.

WARNING: unlike Title Data, you cannot delete or rename a statistic once it's created. If you don't want to have an "xp" statistic forever, give it a different name.

  1. Go to the player's Statistics tab
  2. Add a key labeled "xp" and set the value to 0
  3. Click Save Player StatisticsYou don't have to use the 'xp' statistic if you have a different one in mind.
  4. In your game, call GetPlayerStatistics

  5. You should see an "xp" statistic with a value of 0

Will you be the very best, like no one ever was?

Statistics are a great place to store experience points, number of wins and losses, headshots, or anything you want tallied. Every statistic automatically creates its own Leaderboard, so you can track who's doing the best (and worst) in your game.

Click "Leaderboards" on the Players tab to see the current progress.

Every statistic becomes a leaderboard. It won't be interesting until there's competition.

6. PlayStream events

Click the PlayStream tab for this player (next to Overview). You should see a login event and the statistic change event. Keep this window open while you do other things and you'll be able to see more events pop up.

Now that you have a player, some title data, and a statistic, let's create a currency and start your game's economy.

Go to Chapter 2