Nexon Open Api

Using the API

Once you have been issued with an API key after registering an application, review the document. (API keys can be found by going to My Applications > Application Details.) Sending an API request is simple, but there are a few details you need to be aware of when making a request.

API search

You can view the list of APIs for each game provided through NEXON Open API by navigating to the top Games menu. Each API provides the following information.

API information

It provides a description of the API and the request URL that will actually be used. Parameters that need to be sent along with the API call are listed under "Parameters," and descriptions of these parameters can be found under "Description."

Request parameters (Parameters)

This section indicates parameter information that must be transmitted to the server when sending a request to the open API. Take care not to omit parameters marked as *required when calling the API.

Responses

This section provides response information received after sending a request to the open API. “Response Description” provides a description or structure of the data received when sending a request to the API normally. “Response Headers” and “Response Body” are used when testing the API. For a more detailed explanation, refer to the “API Testing” section below.

API usage

When you call the request URL found under the Games menu, you can use the Open API. However, you must also send the required request parameters specific to each API. When calling an open API provided by NEXON Open API, you need to include your API Key value in the Header to use it properly.

TypeKey nameContent type
Headerx-nxopen-api-keyString

If an error occurs while using the API, the reason for the error can be determined by looking at the response code. Please refer to the response code table below.

Error codeResponse codeResponse nameDescription
OPENAPI00001500Internal Server ErrorInternal server error
OPENAPI00002403ForbiddenUnauthorized access
OPENAPI00003400Bad RequestInvalid identifier
OPENAPI00004400Bad RequestMissing or invalid parameter
OPENAPI00005400Bad RequestInvalid API key
OPENAPI00006400Bad RequestInvalid game or API path
OPENAPI00007429Too Many RequestsAPI call limit exceeded
OPENAPI00009400Bad RequestData being prepared
OPENAPI00010400Bad RequestService under maintenance
OPENAPI00011503Service UnavailableAPI under maintenance

API testing

All open APIs provided by NEXON Open API can be tested directly within the Games menu, where you can also view the response values for each test. (The test feature can be used only after logging in with a NEXON ID and obtaining the API key for the API you wish to test.)


  1. Go to Game > Select a game, and select the API you want to test from the API list.
  2. Click the “Try it out” button.
  3. Enter the request parameters in the “Parameters” field.
  4. Click the “Execute” button to send the request.
  5. Confirm the following information:
    1. Curl/Request URL: The URL that the request was actually sent to by including the input parameter values.
    2. Server response
      1. Code: HTTP status code indicating the status of the request result
      2. Response Headers: Response header value
      3. Response Body: Response data

API sample code

Java sample code

  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;
  import java.net.URLEncoder;
  import java.nio.charset.StandardCharsets;
  
  public class  ApiExample {
    public static void main(String[] args) {
      try {
        String API_KEY = "YOUR API KEY HERE";
        String characterName = URLEncoder.encode("CHARACTER NAME", StandardCharsets.UTF_8);
  
        String urlString = "https://open.api.nexon.com/heroes/v1/id?character_name=" + characterName;
        URL url = new URL(urlString);
  
        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
        connection.setRequestMethod("GET");
        connection.setRequestProperty("x-nxopen-api-key", API_KEY);
  
        int responseCode = connection.getResponseCode();
  
        BufferedReader in;
        if(responseCode == 200) {
          in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        } else {
          in = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
        }
  
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
          response.append(inputLine);
        }
        in.close();
  
        System.out.println(response.toString());
      } catch (Exception exception) {
        System.out.println(exception);
      }
    }
  }

JavaScript sample code

  const API_KEY = "YOUR API KEY HERE";
  const characterName = "CHARACTER NAME";
  const urlString = "https://open.api.nexon.com/heroes/v1/id?character_name=" + characterName;
  
  const answer = fetch(urlString, {
      headers:{
        "x-nxopen-api-key": API_KEY
      }
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error(error))
  
  console.log(answer)

Python sample code

  headers = {
    "x-nxopen-api-key": "YOUR API KEY HERE"
  }
  
  characterName = "CHARACTER NAME"
  urlString = "https://open.api.nexon.com/heroes/v1/id?character_name=" + characterName
  response = requests.get(urlString, headers = headers)
  
  print(response.json())

Creating applications

Although you may freely create applications using Open API within the Terms and Conditions specified, when creating an application, you must specify within the application that the data was provided by NEXON Open API.

Crediting NEXON Open API

Please place the phrase “Data based on NEXON Open API” within services and applications.