Making Requests

Content Negotiation

Clients using the API should specify that they accept responses using the application/vnd.api+json format. For convenience, we will also accept application/json since it is the default for many popular client libraries.

The Server will respond with a Content-Type header that mirrors the format requested by the client.

Setting Headers

To specify the headers, use this code:

Shell

curl "endpoint-url" \
-H "Authorization: Bearer <api-key>"
-H "Accept: application/vnd.api+json"

Java

import java.io.*;
import java.net.*;

URL url = new URL("endpoint-url");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization","Bearer <api-key>");
conn.setRequestProperty("Accept", "application/vnd.api+json");

conn.getInputStream()

Python

import requests

url = "endpoint-url"

header = {
  "Authorization": "Bearer <api-key>",
  "Accept": "application/vnd.api+json"
}

r = requests.get(url, headers=header)

Go

import "net/http"

client := &http.Client{}
req, _ := http.NewRequest("GET","endpoint-url",nil)
req.Header.Set("Authorization", "Bearer <api-key>")
req.Header.Set("Accept", "application/vnd.api+json")
res, _ := client.Do(req)

Platforms and Regions

The PUBG API shards data by either platform or platform-region depending on the request, and therefore requires a shard to be specified in the URL for most requests. The current shards are:

shards/$platform - the platform shard

  • kakao - Kakao
  • psn - PS4
  • steam - Steam
  • xbox - Xbox

shards/$platform-region - the platform-region shard

  • pc-as - Asia
  • pc-eu - Europe
  • pc-jp - Japan
  • pc-kakao - Kakao
  • pc-krjp - Korea
  • pc-na - North America
  • pc-oc - Oceania
  • pc-ru - Russia
  • pc-sa - South and Central America
  • pc-sea - South East Asia
  • pc-tournament - Tournaments
  • psn-as - Asia
  • psn-eu - Europe
  • psn-na - North America
  • psn-oc - Oceania
  • xbox-as - Asia
  • xbox-eu - Europe
  • xbox-na - North America
  • xbox-oc - Oceania
  • xbox-sa - South America

The shard is specified after the pubg domain and before the endpoint like this:

"...pubg.com/shards/steam/endpoint..."

The platform shard should be used to get PC players’ season stats for seasons after “division.bro.official.2018-09”. The platform-region shard is deprecated for PC as of October 3, 2018 for season stats beginning with “division.bro.official.pc-2018-01”.

The platform shard should be used at the players endpoint. The platform-region shard is deprecated as of November 30, 2018 for the players endpoint.

GZIP

Clients can specify the header Accept-Encoding: gzip, and the server will compress responses. Responses will be returned with Content-Encoding: gzip.

Given the size of matches, this can have significant performance benefits.

To specify the header Accept-Encoding, use this code:

Shell:

-H "Accept-Encoding: gzip"

Java:

conn.setRequestProperty("Accept-Encoding","gzip");

Python:

header = {"Accept-Encoding":"gzip"}

Go:

req.Header.Set("Accept-Encoding", "gzip")

Data Retention Period

The data retention period is 14 days. Match data older than 14 days will not be available.

Responses

All Server responses will be in JSON-API format and contain a root JSON object.

Each response will contain at least one of the following top-level members:

  • data : the response’s “primary data”
  • errors : an array of error objects

A response may contain any of these top-level members:

  • links: a links object related to the primary data.
  • included: an array of resource objects that are related to the primary data and/or each other (“included resources”).
  • meta: not currently used.

If a document does not contain a top-level data key, the included array will not be present either.

Cross Origin Resource Sharing

The API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. You can read the CORS W3C Recommendation here.

Here’s a sample request sent from a browser hitting ‘example.com’:

Shell:

curl -i https://api.pubg.com/status -H "Origin: http://example.com"
HTTP/1.1 200 OK
...
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Length

This is what the CORS preflight request looks like:

curl -i https://api.pubg.com/status -H "Origin: http://example.com" -X OPTIONS
HTTP/1.1 200 OK
...
Access-Control-Allow-Headers: Origin,X-Title-Id,Authorization
Access-Control-Allow-Methods: GET,POST,OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 86400