Vote API

Check a Discord ID against a server key. Use it from a FiveM resource, a Discord bot, or a website.

GET

Check

Use the Discord API key from the dashboard, not the TopFive resource key.

Endpoint
https://topfive.gg/api/vote.php?action=check&key=SERVER_KEY&discordid=DISCORD_ID
GET

Claim

Same check, then marks that vote used so the reward cannot be given twice.

Endpoint
https://topfive.gg/api/vote.php?action=claim&key=SERVER_KEY&discordid=DISCORD_ID

Response

JSON
{
  "ok": true,
  "voted": true,
  "discord_id": "832767288129749032",
  "username": "Brett",
  "last_vote": "2026-10-10 18:04:00",
  "last_vote_unix": 1760126640,
  "hours_ago": 1.2,
  "can_vote_again_at": "2026-10-11 18:04:00",
  "vote_id": 69,
  "already_claimed": false,
  "reason": "ok"
}
Fields
voted
The yes/no. True if they voted in the last 24 hours and the claim is free.
reason
ok, no_vote, older_than_24h, or already_claimed.
already_claimed
True if this vote was already used for a reward.

FiveM example

Call this from the server, never the client.

server.cfg
set topfive_key "YOUR_DISCORD_API_KEY"

Use set, not setr, so the key is not sent to clients.

Server script
local key = GetConvar('topfive_key', '')
local discord = nil
for _, id in ipairs(GetPlayerIdentifiers(src)) do
    discord = id:match('^discord:(%d+)$') or discord
end
PerformHttpRequest(('https://topfive.gg/api/vote.php?action=claim&key=%s&discordid=%s'):format(key, discord), function(status, body)
    local data = json.decode(body or '')
    if data and data.voted then
        -- give the reward
    end
end, 'GET')

Notes

  • The player must have Discord linked on TopFive, or have voted through the Discord bot.
  • The server must be set to Discord check API on the owner dashboard.
  • Matching is by Discord ID, not Cfx.re.
Join our Discord