API quickstart
Connect your project.
Try the public War Thunder offsets API, then add an API key when you need the full dataset. Download a small client with a runnable example and bring it into your own code.
1. Make your first request
No account or key required. Free access returns a delayed public subset; premium access returns the complete dataset for your licensed game.
curl --fail-with-body 'https://api.monkrel.cc/api/v1/offsets?game=warthunder'The response includes version, tier and grouped offsets. Values are hexadecimal strings; <not-found> means an unresolved signature. Free responses may include a pending build and its release time.
2. Python · no third-party dependencies
Requires Python 3.10 or newer. Extract the ZIP into a directory, open a terminal there, and run the example. Copy wtops.py into your project to use the client.
python3 example.py --repeat
python3 example.py --expected-version YOUR_GAME_VERSIONThe example prints the served version and tier. --repeat sends a second request to demonstrate conditional caching.
import os
from wtops import Client
client = Client(api_key=os.environ.get("WTOPS_API_KEY") or None)
# Set this from the game build your application is using.
game_version = "YOUR_GAME_VERSION"
snapshot = client.fetch_offsets(expected_version=game_version)
print(snapshot.version, snapshot.tier, len(snapshot.offsets))
3. C++17 · libcurl + nlohmann/json
Extract the ZIP and open a terminal there. Install CMake, a C++17 compiler and libcurl development files. On Debian or Ubuntu: sudo apt install cmake g++ libcurl4-openssl-dev. The included README covers macOS and Windows.
cmake -S . -B build -DWTOPS_BUILD_TESTS=OFF
cmake --build build --config Release
./build/wtops-example --repeatCMake uses an installed nlohmann/json package or downloads a pinned, checksum-verified release. Link the wtops::client CMake target in your application. Replace YOUR_GAME_VERSION with the build you actually use.
#include <wtops_client.hpp>
#include <cstdlib>
#include <iostream>
int main() {
try {
wtops::ClientOptions options;
if (const char* key = std::getenv("WTOPS_API_KEY"); key && *key)
options.api_key = key;
wtops::Client client(options);
wtops::RequestOptions request;
request.expected_version = "YOUR_GAME_VERSION";
const auto snapshot = client.fetch_offsets(request);
std::cout << snapshot.version << "\n";
} catch (const std::exception& error) {
std::cerr << error.what() << "\n";
return 1;
}
}4. Add premium access when you need it
Contact monkrel for an invite. Save the API key shown after redemption. The examples read it from WTOPS_API_KEY; the library accepts it explicitly. Keep keys in your environment or secret store and out of source control.
Use the same client and endpoints. A valid key selects premium access. An invalid key raises an authentication error; an expired license raises a license error with a renewal link. The clients keep those errors visible so your application can decide what to do.
5. Update offsets before compilation
For fixed offsets in a compiled application, use the Python updater from the download. It exports a header, checks the target build and replaces the file only after a successful response. Identical output keeps its modification time. Use an existing output directory. Your application includes offsets.hpp and needs no HTTP or JSON dependency.
Set WTOPS_API_KEY to your premium key and GAME_VERSION to the actual game build you target. In a POSIX shell, run:
python3 update_offsets.py --expected-version "$GAME_VERSION" --output offsets.hpp &&
cmake --build buildA failed download, expired license or version mismatch stops the build and preserves the previous file. Add --require GROUP:NAME for every offset your application needs. Use --format python, csharp or json to export another format. For a historical build, also pass --version with that build.
Run the updater automatically with CMake
Extract the Python download into wtops/ inside your project. Add this after defining your application target, replace your_application with its name, and configure with -DWTOPS_GAME_VERSION=YOUR_GAME_VERSION. Keep the key in the build environment.
find_package(Python3 3.10 REQUIRED COMPONENTS Interpreter)
set(WTOPS_GAME_VERSION "" CACHE STRING "Target game build")
if(NOT WTOPS_GAME_VERSION)
message(FATAL_ERROR "Set WTOPS_GAME_VERSION to your target build")
endif()
set(WTOPS_HEADER "${CMAKE_CURRENT_BINARY_DIR}/generated/offsets.hpp")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/generated")
add_custom_target(update_offsets
COMMAND "${Python3_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/wtops/update_offsets.py"
--expected-version "${WTOPS_GAME_VERSION}"
--output "${WTOPS_HEADER}"
BYPRODUCTS "${WTOPS_HEADER}"
VERBATIM
)
add_dependencies(your_application update_offsets)
target_include_directories(your_application PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/generated")The updater runs before each build. A failure prevents compilation; unchanged data avoids unnecessary recompilation. Exported offsets remain fixed in the binary until you rebuild it.
Data methods in both clients
| Method | Result | Access |
|---|---|---|
get_version | Available game build | Free or premium |
fetch_offsets | Validated offset values | Free subset or premium; history and dev require premium |
get_history | Stored version names | Free or premium; dev requires premium |
get_changelog | Changes between consecutive builds | Free has delayed, filtered entries; premium has full exposed changes |
compare_versions | Changes between two stored builds | Premium |
get_license_status | Current access and expiry information | Valid key, including an expired license |
export_offsets | Export content with verified build metadata | Premium |
Webhooks, aliases and custom signatures are managed in the panel. Offset responses and exports include your configured aliases and private offset values. The READMEs cover the method arguments and typed results.
Keep your integration reliable
- Check
expected_versionagainst your local game build before using offsets. A mismatch raises an error, including on a cached response. A separate premiumversionparameter selects historical data. - Declare the offsets you need with
required_offsets. Missing or unresolved values raise an error; they are never turned into zero. - Reuse one client per thread. It keeps a bounded in-memory cache and sends
If-None-Match. A304returns the validated snapshot withnot_modifiedset. It still counts toward the request limit. - Poll at a pace your project needs, usually every few minutes. The clients retry temporary failures a limited number of times and respect
Retry-After. A longer server delay is returned as an error for your scheduler to handle. - A failed request raises an error rather than returning old cached data. Stop using values if their version no longer matches your build.
- A cached pending countdown can age. Use
pending.offsets_available_at, a UTC timestamp, when displaying a release time.
The bundled READMEs document the options and typed errors. See the endpoint reference for the underlying HTTP endpoints.