# Create option Source: https://api.pollunit.com/api-reference/options/create-option /api-reference/openapi.json post /api/v1/polls/{poll_id}/options Adds an option to the poll. The option class is derived from the poll or, when a parent_option_id is given, from the parent option. A private token creates the option on behalf of its user, a public token creates it anonymously — which the poll has to allow through allow_new_options. Options with a file (image, audio, video file and photo options) are created with a multipart/form-data request that sends the file as option[attachment]. # Delete option Source: https://api.pollunit.com/api-reference/options/delete-option /api-reference/openapi.json delete /api/v1/polls/{poll_id}/options/{id} Removes the option and its child options. Admin access through the admin_hash may delete every option; otherwise the option has to belong to the requesting user, the poll has to still allow changes and the option must not have votes. Options that were paid for through a voting wallet can never be deleted. # Get option Source: https://api.pollunit.com/api-reference/options/get-option /api-reference/openapi.json get /api/v1/polls/{poll_id}/options/{id} # List poll options Source: https://api.pollunit.com/api-reference/options/list-poll-options /api-reference/openapi.json get /api/v1/polls/{poll_id}/options Returns one page of options. The options have a hierarchy with varying levels. API calls can navigate through this hierarchy by passing a parent_option_id. The default page size depends on the poll type and the poll's options_per_page setting; use the X-Total-Pages / X-Total-Count response headers to page through the full list. # Update option Source: https://api.pollunit.com/api-reference/options/update-option /api-reference/openapi.json patch /api/v1/polls/{poll_id}/options/{id} Changes an existing option. Only the given attributes are written, the others keep their value. Admin access through the admin_hash may change every option; otherwise the option has to belong to the requesting user and the poll has to still allow changes. Options that already collected votes can only be changed as long as the poll allows it. # Create poll Source: https://api.pollunit.com/api-reference/polls/create-poll /api-reference/openapi.json post /api/v1/polls # Delete poll Source: https://api.pollunit.com/api-reference/polls/delete-poll /api-reference/openapi.json delete /api/v1/polls/{poll_hash} # Get poll Source: https://api.pollunit.com/api-reference/polls/get-poll /api-reference/openapi.json get /api/v1/polls/{poll_hash} # List polls Source: https://api.pollunit.com/api-reference/polls/list-polls /api-reference/openapi.json get /api/v1/polls Returns one page of polls, newest first. Use the X-Total-Pages / X-Total-Count response headers to page through the full list. # Update poll Source: https://api.pollunit.com/api-reference/polls/update-poll /api-reference/openapi.json patch /api/v1/polls/{poll_hash} # Create participant Source: https://api.pollunit.com/api-reference/voters/create-participant /api-reference/openapi.json post /api/v1/polls/{poll_id}/voters Adds a participant to the poll, which is the object the votes of one person belong to. A private token creates the participant on behalf of its user, a public token creates it anonymously and the X-POLLUNIT-USER-IDENTIFIER header decides which anonymous user it belongs to. The call is idempotent for one user: a repeated request updates the existing participant instead of adding a second one. The poll has to be votable, and its participant limit and access restrictions apply. # Delete participant Source: https://api.pollunit.com/api-reference/voters/delete-participant /api-reference/openapi.json delete /api/v1/polls/{poll_id}/voters/{id} Removes the votes of the participant, and the participant record itself when deleting it is allowed. Deleting the votes requires that the participation belongs to the requesting user and the poll still accepts votes, or admin access to a survey, or admin access with an account that allows deleting; participants of a poll with a voting wallet can never be deleted, and the request is rejected with 403 when none of this applies. The participant record is kept — with its votes removed — when the requesting account is not allowed to delete it, so that the participation itself stays on record. Both outcomes answer with 204: read the participant back to tell them apart, a kept participant is still found. # Get participant Source: https://api.pollunit.com/api-reference/voters/get-participant /api-reference/openapi.json get /api/v1/polls/{poll_id}/voters/{id} # List poll participants Source: https://api.pollunit.com/api-reference/voters/list-poll-participants /api-reference/openapi.json get /api/v1/polls/{poll_id}/voters Returns one page of the participants of the poll. Polls that hide their participants only list them with admin access. Use the X-Total-Pages / X-Total-Count response headers to page through the full list. # Update participant Source: https://api.pollunit.com/api-reference/voters/update-participant /api-reference/openapi.json patch /api/v1/polls/{poll_id}/voters/{id} Changes an existing participant. Only the given attributes are written, the others keep their value. The participant has to belong to the requesting user — identified by the private token or, for anonymous users, by the X-POLLUNIT-USER-IDENTIFIER header — and the poll has to still accept votes. Admins may additionally change other participants of voting and table polls that do not anonymize or hide their participants. # Create vote Source: https://api.pollunit.com/api-reference/votes/create-vote /api-reference/openapi.json post /api/v1/polls/{poll_id}/votes Casts a vote of a participant for an option. Create the participant first; the participant has to belong to the requesting user — identified by the private token or, for anonymous users, by the X-POLLUNIT-USER-IDENTIFIER header. The poll has to accept votes, and its vote limits and access restrictions apply. For pairwise comparisons `option_id` is the winner and has to be one of the two options the options list currently returns for the participant; the other one is stored as `loser_option_id`. Polls that require a double opt in answer with 422 until the participant confirmed the opt in email; the vote is kept and cast on confirmation. # Delete vote Source: https://api.pollunit.com/api-reference/votes/delete-vote /api-reference/openapi.json delete /api/v1/polls/{poll_id}/votes/{id} Removes a vote. Requires that the vote belongs to the requesting user and the poll still accepts votes, or admin access with an account that allows deleting. Votes of polls with a voting wallet can not be deleted. For polls with `vote_per_day` only the votes of the current day can be deleted. # Get vote Source: https://api.pollunit.com/api-reference/votes/get-vote /api-reference/openapi.json get /api/v1/polls/{poll_id}/votes/{id} Polls that hide their votes only return the own votes of the requesting user, or any vote with admin access. For polls with `vote_per_day` only the votes of the current day are found. # List poll votes Source: https://api.pollunit.com/api-reference/votes/list-poll-votes /api-reference/openapi.json get /api/v1/polls/{poll_id}/votes Returns one page of the votes of the poll, oldest first. Polls that hide their votes only list them with admin access. Pass `voter_id` or `option_id` to list the votes of one participant or one option. Use the X-Total-Pages / X-Total-Count response headers to page through the full list. # Update vote Source: https://api.pollunit.com/api-reference/votes/update-vote /api-reference/openapi.json patch /api/v1/polls/{poll_id}/votes/{id} Changes the value of a vote. The vote has to belong to the requesting user and the poll has to still accept votes. Admins may additionally change the votes of other participants of voting and table polls. Polls that sell votes do not allow lowering `vote`, and answer with the payment page instead of the vote when more votes are bought. For polls with `vote_per_day` only the votes of the current day can be changed. # Welcome to PollUnit Source: https://api.pollunit.com/index Programmatic access to PollUnit — create, manage, and read polls via the API. ## Overview PollUnit lets you create and manage polls, surveys, and voting pages programmatically. This documentation covers everything you need to get started with the API. > [card] [API Reference](/api-reference/polls/list-polls) > > Explore every endpoint, request, and response schema. ## Authentication Every request must include a personal API token as a `Bearer` token in the `Authorization` header. You have two tokens available: > [card] Private token > > Full access — create, update, and delete polls. Keep this secret. > [card] Public token > > Read-only — safe to embed in client-side code. Find both tokens under **My Account → API** in your PollUnit dashboard. ## Organizations Every endpoint accepts an optional `organization_id` query parameter. It takes the `public_id` of an organization you belong to and runs the request in that organization's context — new polls are owned by the organization and listings are scoped to it. Omit `organization_id` (or leave it blank) to act as your **personal account**. Passing the `public_id` of an organization you don't have access to returns `401 Unauthorized`. ## Owner of created objects If you create objects with your private API token, the user the token belongs to becomes the owner of the created objects. That is what you want when you add options to your own poll and they should belong to your admin user. It is not what you want when you build an application on top of the PollUnit API and let your users create options: those options should not belong to your admin user, and your private API token should never be exposed in such an application. Requests made on behalf of your users should therefore use your public API token and pass your own identifier for the user in the `X-POLLUNIT-USER-IDENTIFIER` header, which can be any string. The strings should not be guessable by other users, otherwise users could get access to other users' contents. Options and voters can both be assigned this way. A voter is the object the votes of one person belong to, so the same identifier has to be sent again whenever that person's participation is read, changed or deleted. ## Password protected polls If polls are protected by a password, you can simply send the password in a header `X-POLLUNIT-POLL-PASSWORD`. ## Next steps **1. Get your API token** Log in to PollUnit and copy your private or public token from Account settings. **2. Make a request** Try listing your polls with a `GET` request to `/api/v1/polls`. **3. Explore the reference** Browse the full [API Reference](/api-reference/polls/list-polls) for all available endpoints.