Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Crypto-Project-ENSTA/back-end/llms.txt

Use this file to discover all available pages before exploring further.

Calling this endpoint kicks off the election. The server fetches every registered voter from the database, generates a cryptographically random N1 and N2 nonce pair for each one, emails those credentials to each voter via the Gmail API, and then marks the election status as vote_started. The operation is idempotent with respect to duplicate sends: an internal emails_sent flag prevents the voter watcher from re-sending credentials if the server restarts between calls.

Request

POST /voting/start-vote
No request body is required.
This endpoint immediately sends credential emails to every voter currently in the database. Ensure all voters are registered before calling it — you cannot un-send emails, and any voter added after this call will not receive credentials.

Response

status
string
required
Always "success" on a 200 response.
message
string
required
Human-readable summary including the number of voters who received credentials, e.g. "Voting started. Credentials sent to 42 voters.".

Example response

{
  "status": "success",
  "message": "Voting started. Credentials sent to 42 voters."
}

HTTP status codes

CodeMeaning
200Election started successfully; credential emails dispatched to all voters.
404No voters are registered in the database. Register voters before starting the election.
500An unexpected error occurred while starting the vote, e.g. a Gmail API failure.

Example

curl --request POST \
  --url https://your-api-host/voting/start-vote
{
  "status": "success",
  "message": "Voting started. Credentials sent to 42 voters."
}
If the server restarts after credentials have already been sent, calling this endpoint again is safe. The emails_sent flag in the voting configuration prevents the voter watcher from dispatching duplicate emails.

Build docs developers (and LLMs) love