Login With Battle Net
Sign in the user with a Battle.net identity token
Error codes
This operation may return the following PlayFab errors:
| Error | Code |
|---|---|
| AccountNotFound | 1001 |
| BattleNetNotEnabledForTitle | 1602 |
| EncryptionKeyMissing | 1290 |
| EvaluationModePlayerCountExceeded | 1490 |
| InvalidAuthToken | 1326 |
| InvalidSignature | 1273 |
| InvalidSignatureTime | 1324 |
| InvalidTitleId | 1004 |
| PlayerSecretAlreadyConfigured | 1294 |
| PlayerSecretNotConfigured | 1323 |
| RequestViewConstraintParamsNotAllowed | 1303 |
POST
/
Server
/
LoginWithBattleNet
Login With Battle Net
curl --request POST \
--url https://{titleId}.playfabapi.com/Server/LoginWithBattleNet \
--header 'Content-Type: application/json' \
--header 'X-SecretKey: <api-key>' \
--data '
{
"IdentityToken": "eyJraWQi..."
}
'import requests
url = "https://{titleId}.playfabapi.com/Server/LoginWithBattleNet"
payload = { "IdentityToken": "eyJraWQi..." }
headers = {
"X-SecretKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SecretKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({IdentityToken: 'eyJraWQi...'})
};
fetch('https://{titleId}.playfabapi.com/Server/LoginWithBattleNet', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{titleId}.playfabapi.com/Server/LoginWithBattleNet",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'IdentityToken' => 'eyJraWQi...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SecretKey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{titleId}.playfabapi.com/Server/LoginWithBattleNet"
payload := strings.NewReader("{\n \"IdentityToken\": \"eyJraWQi...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SecretKey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{titleId}.playfabapi.com/Server/LoginWithBattleNet")
.header("X-SecretKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"IdentityToken\": \"eyJraWQi...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Server/LoginWithBattleNet")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SecretKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"IdentityToken\": \"eyJraWQi...\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"status": "<string>",
"data": {
"NewlyCreated": true,
"EntityToken": {
"EntityToken": "lS2hbYH1Gls1KbnlyozHSQBrF4zsq6q006ci9ijSNqQUiiO6xyCQtVrLjsXjdBJ",
"TokenExpiration": "2022-01-26T07:24:12Z",
"Entity": {
"Id": "174812abf712",
"Type": "title_player_account",
"TypeString": "title_player_account"
}
},
"InfoResultPayload": {
"AccountInfo": {
"PlayFabId": "4027527BF22653D1",
"Created": "2013-04-07T09:04:28",
"Username": "my name",
"TitleInfo": {
"Origination": "IOS",
"Created": "2014-01-08T11:03:18",
"LastLogin": "2014-04-07T09:04:28",
"FirstLogin": "2014-01-08T11:03:18",
"TitlePlayerAccount": {
"Id": "174812abf712",
"Type": "title_player_account",
"TypeString": "title_player_account"
}
},
"FacebookInfo": {
"FacebookId": "23525445454"
},
"SteamInfo": {
"SteamCountry": "US",
"SteamCurrency": "USD"
},
"GameCenterInfo": {
"GameCenterId": "someone"
}
},
"UserVirtualCurrency": {
"GC": 15
},
"UserVirtualCurrencyRechargeTimes": {
"GC": {
"SecondsToRecharge": 3600,
"RechargeTime": "2014-01-01T12:00:00",
"RechargeMax": 50
}
},
"UserData": {
"preferences": {
"Value": "alpha",
"LastUpdated": "2014-08-20T12:30:45",
"Permission": "Public"
},
"progress": {
"Value": "level_twenty",
"LastUpdated": "2014-09-01T10:12:30"
}
},
"UserDataVersion": 12,
"PlayerProfile": {
"TitleId": "TitleName",
"PlayerId": "10931252888739651331",
"Created": "0001-01-01T00:00:00",
"LastLogin": "0001-01-01T00:00:00",
"BannedUntil": "9999-12-31T23:59:59.9999999",
"DisplayName": "PlayerDisplayName",
"TotalValueToDateInUSD": 0
}
},
"LastLoginTime": "<string>",
"PlayFabId": "<string>",
"SessionTicket": "<string>",
"SettingsForUser": {
"GatherDeviceInfo": true,
"GatherFocusInfo": true,
"NeedsAttribution": true
},
"TreatmentAssignment": {
"Variables": [
{
"Name": "<string>",
"Value": "<string>"
}
],
"Variants": [
"<string>"
]
}
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}Authorizations
This API requires a title secret key, available to title admins, from PlayFab Game Manager.
Body
application/json
The JSON Web Token (JWT) returned by Battle.net after login
Automatically create a PlayFab account if one is not currently linked to this ID.
The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
Flags for which pieces of info to return for the user.
Show child attributes
Show child attributes
Example:
{
"GetUserAccountInfo": true,
"GetUserVirtualCurrency": true,
"GetUserData": true,
"UserDataKeys": ["preferences", "progress"]
}
Last modified on October 1, 2026
Was this page helpful?
⌘I
Login With Battle Net
curl --request POST \
--url https://{titleId}.playfabapi.com/Server/LoginWithBattleNet \
--header 'Content-Type: application/json' \
--header 'X-SecretKey: <api-key>' \
--data '
{
"IdentityToken": "eyJraWQi..."
}
'import requests
url = "https://{titleId}.playfabapi.com/Server/LoginWithBattleNet"
payload = { "IdentityToken": "eyJraWQi..." }
headers = {
"X-SecretKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SecretKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({IdentityToken: 'eyJraWQi...'})
};
fetch('https://{titleId}.playfabapi.com/Server/LoginWithBattleNet', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{titleId}.playfabapi.com/Server/LoginWithBattleNet",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'IdentityToken' => 'eyJraWQi...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SecretKey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{titleId}.playfabapi.com/Server/LoginWithBattleNet"
payload := strings.NewReader("{\n \"IdentityToken\": \"eyJraWQi...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SecretKey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{titleId}.playfabapi.com/Server/LoginWithBattleNet")
.header("X-SecretKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"IdentityToken\": \"eyJraWQi...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Server/LoginWithBattleNet")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SecretKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"IdentityToken\": \"eyJraWQi...\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"status": "<string>",
"data": {
"NewlyCreated": true,
"EntityToken": {
"EntityToken": "lS2hbYH1Gls1KbnlyozHSQBrF4zsq6q006ci9ijSNqQUiiO6xyCQtVrLjsXjdBJ",
"TokenExpiration": "2022-01-26T07:24:12Z",
"Entity": {
"Id": "174812abf712",
"Type": "title_player_account",
"TypeString": "title_player_account"
}
},
"InfoResultPayload": {
"AccountInfo": {
"PlayFabId": "4027527BF22653D1",
"Created": "2013-04-07T09:04:28",
"Username": "my name",
"TitleInfo": {
"Origination": "IOS",
"Created": "2014-01-08T11:03:18",
"LastLogin": "2014-04-07T09:04:28",
"FirstLogin": "2014-01-08T11:03:18",
"TitlePlayerAccount": {
"Id": "174812abf712",
"Type": "title_player_account",
"TypeString": "title_player_account"
}
},
"FacebookInfo": {
"FacebookId": "23525445454"
},
"SteamInfo": {
"SteamCountry": "US",
"SteamCurrency": "USD"
},
"GameCenterInfo": {
"GameCenterId": "someone"
}
},
"UserVirtualCurrency": {
"GC": 15
},
"UserVirtualCurrencyRechargeTimes": {
"GC": {
"SecondsToRecharge": 3600,
"RechargeTime": "2014-01-01T12:00:00",
"RechargeMax": 50
}
},
"UserData": {
"preferences": {
"Value": "alpha",
"LastUpdated": "2014-08-20T12:30:45",
"Permission": "Public"
},
"progress": {
"Value": "level_twenty",
"LastUpdated": "2014-09-01T10:12:30"
}
},
"UserDataVersion": 12,
"PlayerProfile": {
"TitleId": "TitleName",
"PlayerId": "10931252888739651331",
"Created": "0001-01-01T00:00:00",
"LastLogin": "0001-01-01T00:00:00",
"BannedUntil": "9999-12-31T23:59:59.9999999",
"DisplayName": "PlayerDisplayName",
"TotalValueToDateInUSD": 0
}
},
"LastLoginTime": "<string>",
"PlayFabId": "<string>",
"SessionTicket": "<string>",
"SettingsForUser": {
"GatherDeviceInfo": true,
"GatherFocusInfo": true,
"NeedsAttribution": true
},
"TreatmentAssignment": {
"Variables": [
{
"Name": "<string>",
"Value": "<string>"
}
],
"Variants": [
"<string>"
]
}
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}