Skip to main content

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.

API Reference

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:

Private token

Full access — create, update, and delete polls. Keep this secret.

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. At the moment options are the only objects that can be assigned this way. Voters will follow and will be identified in the same way.

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 for all available endpoints.