HackTheBox API

Unofficial documentation for the HackTheBox API. Feel free to PR and add to this on GitHub.


Table of Contents

  1. Introduction
  2. Endpoints
    1. Global Stats
    2. Hall Of Fame
    3. Get User ID
    4. Machines List

Introduction

First things first, for most of the API queries, you need an API Key. To find your API Key, navigate to https://www.hackthebox.eu/home/settings, where you will find your personal API Key, as seen below.

api_key

To use the API Key, either:

  • Add it a URL parameter like so:

https://example.com/api/endpoint?api_token=<API KEY GOES HERE>

  • Add it in a x-www-form-encoded parameter.

Next, you’ll need a way to make the API requests. Most, if not all programming languages have a capacity to make HTTP Requests, but when testing a query it’s nice to have a standalone tool. Therefore, I recommend the following tools (based on my experience):

  • Postman (Windows)
  • curl/wget (*nix)

Endpoints


Global Stats

URL https://www.hackthebox.eu/api/stats/global
Requires API Key? No
Request Type POST
Extra Parameters? No

Response:

{
    "success": "1",
    "data": {
        "sessions": 1349,
        "vpn": 1112,
        "machines": 123,
        "latency": "1.05"
    }
}

Hall Of Fame

URL https://www.hackthebox.eu/api/charts/users/scores
Requires API Key? Yes
Request Type GET
Extra Parameters? No

Response:

{
    "status": 1,
    "chartData": [
        {
            "name": "snowscan",
            "timeline": [
                {
                    "x": "22:02:33 06 Aug",
                    "y": 1768
                },
                <!--Repeated Data Omitted-->
            ],
            "color": "9acc14"
        },
        <!--Repeated Data Omitted-->
    ]
}

Get User ID

URL https://www.hackthebox.eu/api/user/id
Requires API Key? Yes
Request Type POST
Extra Parameters? Yes

Parameters

Parameter Example Value Description
username SherlockSec HTB Username for given user

Response:

{
    "username": "SherlockSec",
    "id": 50344
}

Machines List

URL https://www.hackthebox.eu/api/machines/get/all
Requires API Key? No
Request Type GET
Extra Parameters? No

Response:

[
    {
        "id":1,
        "name":"Lame",
        "os":"Linux",
        "ip":"10.10.10.3",
        "avatar_thumb":"https://www.hackthebox.eu/storage/avatars/fb2d9f98400e3c802a0d7145e_thumb.png",
        "points":20,
        "release":"2017-03-14",
        "retired_date":"2017-05-26",
        "maker":{
            "id":1,
            "name":"ch4p"
        },
        "maker2":null,
        "ratings_pro":2261,
        "ratings_sucks":216,
        "user_owns":7459,
        "root_owns":7792,
        "retired":true,
        "free":false
    },
    <!--Repeated Data Omitted-->
]