Skip to content

Custom API check

Add the requirement “Custom API check” to a poll and Polls asks your server before it counts a vote.

The request

Polls sends a GET request to your URL. [USERID] and [GUILDID] are replaced with the voter's and the server's ID.

GET https://api.example.com/can-vote?user=[USERID]&guild=[GUILDID]

The answer

Answer with status 200 and JSON. To allow the vote:

{"success": true}

To deny it, optionally with a reason the member sees (up to 300 characters):

{"success": false, "message": "Link your account on example.com first."}

Rules

  • Only https:// URLs that resolve to public addresses are called. Redirects are not followed.
  • Your endpoint has about 4.5 seconds to answer.
  • If it answers with 404, 5xx or not at all, Polls pauses calls to it for a minute.
  • The URL is never shown on the public poll page.