Yandex Contest API

In addition to the admin panel interface, Yandex Contest provides a public API that allows you to:

  • register contest participants;

  • manage user groups;

  • get information about contests and problems;

  • submit and rejudge solutions;

  • export leaderboard data and much more.

The current public API methods are available on the interactive API page (Swagger UI).

Creating a Yandex ID application

An OAuth token allows you to interact with Yandex services on behalf of a specific user. To call Yandex Contest public API methods, create an application in Yandex ID and get an OAuth token:

  1. Log in to the new application creation page with your Yandex ID.

  2. Fill in the data and click Create.

    Specify your contact email. Notifications will be sent to this address if API changes affect your application.

  3. Select access permissions for the application.

    Yandex Contest has two types of permissions:

    • Submitting and testing solutions in contests (contest:submit) — actions on behalf of a participant, for example:

      • submitting solutions;
      • viewing your position in the leaderboard.
    • Managing contests and participants (contest:manage) — actions on behalf of an administrator, for example:

      • viewing all submissions;
      • rejudging solutions;
      • managing groups.
  4. Remember the client_id of the created application, you will need it when getting the OAuth token.

Getting an OAuth token in Yandex ID

The process of obtaining a token depends on the platform and method of accessing the Contest API through Yandex ID authorization. See Application registration and Getting an OAuth token in the Yandex ID documentation.

Using API methods

For authorization, add the Authorization header with the value OAuth <token>, where <token> is the obtained OAuth token without brackets and quotes.

Request example:

# Replace ABCD_some_imaginary_oauth_token_for_example_XYZ with your real token
curl -X GET "https://api.contest.yandex.net/api/public/v2/service/capacity" -H "accept: application/json" -H "Authorization: OAuth ABCD_some_imaginary_oauth_token_for_example_XYZ"

Testing API methods

To create test requests, go to the interactive API page (Swagger UI). To send a request:

  1. Create an application in Yandex ID and get an OAuth token. For testing purposes, you can use a debug token.

  2. At the top of the page, click Authorize.

  3. In the Available authorizations window, enter the OAuth token in the Value field.

  4. Click the Authorize button.

  5. Click Try it out inside any method and fill in the request parameters.

  6. Click Execute.

You can now work with Yandex Contest public API methods and modify request parameters to get the data you need.

See also

For more information about Yandex ID, see the Yandex ID documentation.