> For the complete documentation index, see [llms.txt](https://docs.digitomize.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitomize.com/reference/api-reference/contests.md).

# Contests

The Digitomize API allows users to get details about programming contests. This endpoint allows you to:

* [get all the contests available](#all-contests)
* [get all contests hosted by a specific host](#specific-host)
* [get all contests hosted by multiple hosts](#multiple-hosts)
* [get a specific contest](#specific-contest)

## All Contests

<mark style="color:blue;">`GET`</mark> `https://www.v2api.digitomize.com/contests` &#x20;

This endpoint allows you to get all the programming contests available in  Digitomize

{% tabs %}
{% tab title="200: OK Successful Request" %}
This is the response you will get when your request is successful.

{% endtab %}

{% tab title="500: Internal Server Error Server Error" %}

```json
// Response Body
{
    "error": string,
    "message": string
    }
```

{% endtab %}
{% endtabs %}

The response body has a total property and a results property which is an array of objects containing the contests. It will have the following format:

```json
{
    "total" : integer,
    "results": [
        {
            "host": string,
            "name": string,
            "vanity": string,
            "url": string,
            "startTimeUnix": timestamp,
            "duration": integer
        }
    ]
}
```

## Specific host

<mark style="color:blue;">`GET`</mark> `https://www.v2api.digitomize.com/contests`&#x20;

This API route allows you to get all the programming contests available in  Digitomize by a specific host

#### Query Parameters

| Name | Type   | Description                      |
| ---- | ------ | -------------------------------- |
| host | String | One of the available event hosts |

{% tabs %}
{% tab title="200: OK Successful Request" %}
This is the response you will get when your request is successful.

The response body will have the following format:

```json
{
    "total" : integer,
    "results": [
        {
            "host": string,
            "name": string,
            "vanity": string,
            "url": string,
            "startTimeUnix": timestamp,
            "duration": integer
        }
    ]
}
```

{% endtab %}

{% tab title="500: Internal Server Error Server Error" %}

```json
// Response Body
{
    "error": string,
    "message": string
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The available event hosts in Digitomize include:&#x20;

* geeksforgeeks
* codechef
* codeforces
* atcoder
* codingninjas
* leetcode
  {% endhint %}

In this example, we will get programming contests by GeeksForGeeks.

The request URL is <https://www.v2api.digitomize.com/contests?host=geeksforgeeks>

You will get the following JSON object as a response.

```json
{
    "total": 6,
    "results": [
        {
            "host": "geeksforgeeks",
            "name": "Bi-Wizard School Coding Tournament 22.0",
            "vanity": "bi-wizard-school-coding-tournament-220",
            "url": "https://practice.geeksforgeeks.org/contest/bi-wizard-school-coding-tournament-220",
            "startTimeUnix": 1703593800,
            "duration": 90
        },
        {
            "host": "geeksforgeeks",
            "name": "GFG Weekly Coding Contest - 135",
            "vanity": "gfg-weekly-coding-contest-135",
            "url": "https://practice.geeksforgeeks.org/contest/gfg-weekly-coding-contest-135",
            "startTimeUnix": 1704029400,
            "duration": 90
        },
        {
            "host": "geeksforgeeks",
            "name": "GFG Weekly Coding Contest - 136",
            "vanity": "gfg-weekly-coding-contest-136",
            "url": "https://practice.geeksforgeeks.org/contest/gfg-weekly-coding-contest-136",
            "startTimeUnix": 1704634200,
            "duration": 90
        },
        {
            "host": "geeksforgeeks",
            "name": "GATE CS 2024 - All India Mock 2",
            "vanity": "all-india-mock-gate-csit-ii",
            "url": "https://practice.geeksforgeeks.org/contest/all-india-mock-gate-csit-ii",
            "startTimeUnix": 1705775400,
            "duration": 1440
        },
        ...
    ]
}
```

## Multiple hosts

<mark style="color:blue;">`GET`</mark> `https://www.v2api.digitomize.com/contests`&#x20;

This API route allows you to get all the programming contests available in  Digitomize by multiple event hosts

#### Query Parameters

| Name | Type   | Description                              |
| ---- | ------ | ---------------------------------------- |
| host | String | Two or more of the available event hosts |

{% tabs %}
{% tab title="200: OK Successful Request" %}
This is the response you will get when your request is successful.

The response body will have the following format:

```json
{
    "total" : integer,
    "results": [
        {
            "host": string,
            "name": string,
            "vanity": string,
            "url": string,
            "startTimeUnix": timestamp,
            "duration": integer
        }
    ]
}
```

{% endtab %}

{% tab title="500: Internal Server Error Server Error" %}

```json
// Response Body
{
    "error": string,
    "message": string
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The available event hosts in Digitomize include:&#x20;

* geeksforgeeks
* codechef
* codeforces
* atcoder
* codingninjas
* leetcode
  {% endhint %}

In this example, you will get all the programming contests hosted by GeeksForGeeks and CodeChef.

The request URL will be <https://www.v2api.digitomize.com/contests?host=geeksforgeeks,codechef>

You will get the following JSON object as the response:&#x20;

```json
{
    "total": 12,
    "results": [
        {
            "host": "geeksforgeeks",
            "name": "Bi-Wizard School Coding Tournament 22.0",
            "vanity": "bi-wizard-school-coding-tournament-220",
            "url": "https://practice.geeksforgeeks.org/contest/bi-wizard-school-coding-tournament-220",
            "startTimeUnix": 1703593800,
            "duration": 90
        },
        {
            "host": "codechef",
            "name": "Starters 114",
            "vanity": "start114",
            "url": "https://www.codechef.com/START114",
            "startTimeUnix": 1703687400,
            "duration": 120
        },
        {
            "host": "geeksforgeeks",
            "name": "GFG Weekly Coding Contest - 135",
            "vanity": "gfg-weekly-coding-contest-135",
            "url": "https://practice.geeksforgeeks.org/contest/gfg-weekly-coding-contest-135",
            "startTimeUnix": 1704029400,
            "duration": 90
        },
        {
            "host": "codechef",
            "name": "Starters 115",
            "vanity": "start115",
            "url": "https://www.codechef.com/START115",
            "startTimeUnix": 1704292200,
            "duration": 120
        },
        ...
    ]
}
```

## Specific contest

<mark style="color:blue;">`GET`</mark> `https://www.v2api.digitomize.com/contests`&#x20;

This API route allows you to get a specific programming contest based on the vanity string

#### Query Parameters

| Name   | Type   | Description                  |
| ------ | ------ | ---------------------------- |
| vanity | String | A unique string for an event |

{% tabs %}
{% tab title="200: OK Successful Request" %}
This is the response you will get when your request is successful.

The response body will have the following format:

```json
{
    "total" : integer,
    "results": [
        {
            "host": string,
            "name": string,
            "vanity": string,
            "url": string,
            "startTimeUnix": timestamp,
            "duration": integer
        }
    ]
}
```

{% endtab %}

{% tab title="500: Internal Server Error Server Error" %}

```json
// Response Body
{
    "error": string,
    "message": string
}
```

{% endtab %}
{% endtabs %}

In this example, you will get details about a weekend contest on GeeksForGeeks.

The request URL will be <https://www.v2api.digitomize.com/contests?vanity=weekend-contest-106>

You will get the following JSON object as a response:

```json
{
    "total": 1,
    "results": [
        {
            "host": "codingninjas",
            "name": "Weekend Contest 106",
            "vanity": "weekend-contest-106",
            "url": "https://codingninjas.com/studio/contests/weekend-contest-106",
            "startTimeUnix": 1703941200,
            "duration": 90
        }
    ]
}
```

Feel free to use this API. If you have any issues, you can raise it in [our Discord channel](https://discord.com/invite/bsbBytBqBc).
