For server owners
Voting API
Accept votes on your own website or in a plugin: the player clicks your button, the vote counts in Cubetraq and lifts your server in the ranking.
- Version
- v1 · REST · JSON
- Endpoints
- vote · votes · me · verify
- Limits
- 10 requests per hour per key
You can skip writing the integration by hand: hand the agent plain Markdown with no tabs or markup — Claude, ChatGPT or Cursor will read the contract and write code for your language and platform.
Why this exists
The API lets your server learn about votes by itself and hand out rewards for them. The plugin does not wait for a player to type a command: it fetches the latest votes and rewards whoever voted.
Votes can come from anywhere — your own website, in-game, or Cubetraq itself. Your server sees every vote for it, both the ones sent through the API and the ones a player cast on Cubetraq in a browser.
A vote is never lost and never rewarded twice: a player is paid once per vote, and skipped requests catch up from the timestamp of the last processed vote.
Get a key
Create a key in the dashboard. It is bound to one server, so it cannot vote for someone else's.
Go to keysThe key is shown once. Only a hash is stored — if it is lost, create a new one and revoke the old.
Send a vote
One POST request per vote. The key travels in the Authorization header.
curl -X POST https://cubetraq.ru/api/v1/vote \
-H "Authorization: Bearer ctq_ВАШ_КЛЮЧ" \
-H "Content-Type: application/json" \
-d '{"username":"Steve","ip":"203.0.113.42"}'curl https://cubetraq.ru/api/v1/me \
-H "Authorization: Bearer ctq_ВАШ_КЛЮЧ"| Field | Type | Description |
|---|---|---|
| username | string | Minecraft player name: 3–16 chars, letters, digits, "_" and "-". Case does not matter. |
| ip | string | The player's IP. It lets a vote from your site match the same person in a browser; without it they can vote twice. Stored hashed. |
| Authorization | header | Bearer token: Authorization: Bearer ctq_… or the X-API-Key header. |
Browser sync
The player clicks your button, then opens Cubetraq. Send their IP and we recognise the same person: the cooldown continues instead of restarting.
Without the IP the vote still counts, but browser sync does not work: the player can vote again on Cubetraq.
What comes back
{
"ok": true,
"server": { "slug": "my-server", "votes": 1234 },
"voter": "Steve",
"nextVoteAt": 1793659200
}{
"statusCode": 429,
"statusMessage": "vote.cooldownHours",
"data": {
"code": "vote_cooldown",
"retryAfter": 38000,
"hours": 11
}
}Latest votes
A dedicated endpoint for rewards: fetch the latest votes and pay out. Pass after — the timestamp of the last processed vote — and we return everything newer. A reward is not paid twice even if the plugin restarts.
curl "https://cubetraq.ru/api/v1/votes?after=0&afterId=0&limit=25" \
-H "Authorization: Bearer ctq_ВАШ_КЛЮЧ"| Query parameters | Description |
|---|---|
| after | Cursor: the timestamp of the last vote you saw (Unix seconds). Omit it on the first request. |
| afterId | Id of the last vote you saw. The second cursor component: two votes in the same second cannot be told apart by time alone. |
| limit | How many votes to return, at most 100. Defaults to 25. |
{
"ok": true,
"server": { "slug": "my-server" },
"votes": [
{ "id": 9181, "username": "alex", "votedAt": 1793655600 },
{ "id": 9182, "username": "steve", "votedAt": 1793655600 },
{ "id": 9183, "username": "alex", "votedAt": 1793659200 }
],
"nextAfter": 1793659200,
"nextAfterId": 9183
}Votes flagged by anti-fraud never appear here. An empty list is normal: it just means there are no new votes yet.
In-game delivery through Votifier
If your server runs Votifier or NuVotifier, Cubetraq can send the vote straight into the game. The setup lives in the server card, separately from API keys: there is one in-game listener but a server may have several keys for different platforms. Open My servers, pick the server and fill in the Votifier block — votes arrive as soon as they are counted.
Both protocols are supported: Votifier 1.x with an RSA key and NuVotifier 2.x with a token. The version is detected from the server greeting, so there is nothing to choose manually. API votes and votes from signed-in players on the site go to the game; anonymous votes stay in statistics only because they have no username.
Votifier 1.x
Paste the public key from plugins/Votifier/rsa/public.key (for NuVotifier: plugins/NuVotifier/rsa/public.key). It must be a 2048-bit RSA key: the old protocol sends a fixed-size block.
NuVotifier 2.x
Add a token for the Cubetraq service to plugins/NuVotifier/config.yml under tokens and run /nvreload. You can keep the default token instead: it is accepted as well.
The default port is 8192. It must be reachable from the internet: Cubetraq connects to Votifier directly, not through the Minecraft port.
Delivery and errors
The vote is counted before Votifier receives it, so an unreachable Votifier never cancels a vote. The result is returned in the votifier field, and GET /api/v1/votes remains the source of truth for rewards if the event did not arrive.
We wait for Votifier for at most 3 seconds.
Votes flagged by anti-fraud are not sent to Votifier.
| votifier.error | Description |
|---|---|
| timeout | Votifier did not answer in time. |
| network | Could not connect: the port is closed or the host is unreachable. |
| protocol | The server did not speak the Votifier protocol. |
| rejected | NuVotifier rejected the vote: check the token and its service name. |
| token_missing | The server speaks protocol 2.x, but no token is configured. |
| public_key_missing | The server speaks protocol 1.x, but no public key is configured. |
| public_key_invalid | The public key is not usable: a 2048-bit RSA key is required. |
| address_invalid | The vote has no valid IP, and NuVotifier 2.x requires one. |
| host_unresolved | The Votifier host does not resolve to a public IP. |
{
"ok": true,
"server": { "slug": "my-server", "votes": 1234 },
"voter": "Steve",
"nextVoteAt": 1793659200,
"serversVoted": 2,
"flagged": false,
"votifier": { "delivered": true, "protocol": 2 }
}Checking the player on your server
Optional: set a callback URL when creating the key and we will ask your server whether the player may vote. That way only real players get through.
// Paper: регистрируем HTTP-эндпоинт при старте плагина.
@Override
public void onEnable() {
HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
server.createContext("/cubetraq/verify", this::handle);
server.setExecutor(Executors.newFixedThreadPool(2));
server.start();
}
private void handle(HttpExchange exchange) throws IOException {
String body = new String(exchange.getRequestBody().readAllBytes());
String username = Json.parse(body).getString("username");
// Своя проверка: игрок онлайн, играл сегодня, не забанен.
boolean eligible = isRealPlayer(username);
String json = "{\"eligible\":" + eligible + "}";
exchange.sendResponseHeaders(200, json.length());
exchange.getResponseBody().write(json.getBytes());
}We wait 4 seconds. A response without eligible = true counts as a refusal, so a silent server is not treated as consent.
Errors
The machine-readable code is in data.code.
| HTTP | code | Description |
|---|---|---|
| 401 | invalid_api_key | The key is missing, wrong or revoked. Check that you copied it fully. |
| 403 | verification_failed | Your callback endpoint rejected the player. |
| 404 | server_not_found | The server this key belongs to is deleted or blocked. |
| 422 | invalid_username | The username is not a Minecraft name: 3–16 chars, letters, digits, "_" and "-". |
| 429 | vote_cooldown | The player already voted for this server less than 12 hours ago. The response carries retryAfter and hours. |
| 429 | vote_server_limit | The player already backed 3 different servers in the last 12 hours. The response carries retryAfter and hours. |
| 429 | rate_limited | The key has used up its request budget for this hour. |
| 504 | verification_timeout | The callback did not answer within 4 seconds, so the vote was not counted. |
Plugin example
A vote usually grants an in-game reward. Keep the key in the plugin config, not in code.
# config.yml плагина голосования
cubetraq:
api-key: "ctq_ВАШ_КЛЮЧ"
reward-command: "give {player} diamond 1"Limits and anti-fraud
- One vote per player per server every 12 hours, shared with voting on the site.
- A player can back at most 3 different servers in 12 hours.
- 10 requests per hour per key. Player votes travel through your server's key, so a guessed key cannot be hammered for long.