API calls in games

We recommend using VK Bridge library events, VK API methods, or Odnoklassniki API to exchange data with the platform and send requests.

VK API servers use the following URL: api.vk.ru. Odnoklassniki API servers use api.ok.ru.

We recommend dynamically determining the server URL.

To determine the URL while your VK game is running, call the VKWebAppGetConfig event. It returns information about the platform being used and the working environment. The api_host field in the response data contains the server URL for API requests.

To call certain API methods, you can use the VKWebAppCallAPIMethod event. It sends requests to the VK API, the Odnoklassniki API, or to the server used by your game. Do not use this event to call API methods that use a service access key. Passing and storing this key on the client side of the app is insecure.

Related materials