Poll API v3 keeps working
Code written for the previous StrawPoll API keeps running. The v3 endpoints are served
unchanged at https://strawpoll.com/api/v3, take the
same X-API-Key header and use the same JSON format, as described in the v3 OpenAPI spec.
New projects should use the StrawPoll API (v4): it covers every question type, drafts, responses and invites. v3 will receive fixes, but no new features.
What a v3 poll is now
Every v3 poll is a form with one question:
v3 type | Form section |
|---|---|
multiple_choice with text options | multiple_choice |
multiple_choice with image options | picture_choice |
ranked_choice | ranked_choice |
meeting with date and time_range options | meeting |
The poll id is the form’s slug and option ids are choice ids, so both APIs can be used together:
create a poll through v3 and read its responses through v4, or vice versa. require_voter_names adds a contact section that asks for a name.
Forms with more than one question can be read through v3, which shows their first
question. Changing them through v3 is refused with 409 unsupported_form, so v3 never
removes questions it cannot see; use v4 for those.
Settings
poll_config | Form setting |
|---|---|
deadline_at | closesAt |
duplication_checking: ip, session, invite, none | responseDuplicateCheck: ip, session, code, none |
results_visibility: always, after_vote, after_deadline, never | resultsVisibility: public, public_after_response, public_after_close, private |
edit_vote_permissions: admin, admin_voter, voter, nobody | editResponsePermissions: admin, admin_own_responses, own_responses, nobody |
hide_participants | responsesVisibility: private |
allow_comments | allowComments, with public comments |
allow_vpn_users | the opposite of blockVPNUsers |
force_appearance: light, dark, auto | the light or dark StrawPoll theme, or none |
is_multiple_choice, multiple_choice_min, multiple_choice_max | the same, with 0 meaning no limit |
allow_other_option | write-in answers |
randomize_options | shuffled options |
allow_indeterminate | “if need be” answers in meeting polls |
require_voter_names | a name question; always on for meeting polls |
PUT/polls/{id} keeps every setting you leave out of poll_config, and keeps the votes of
options whose id you send back.
Forms set up in the editor can use checks for which v3 has no equivalent. They read as the
closest v3 value: a name check as session, an email check as invite.
Differences to know about
- Polls are published immediately. v3 had no drafts. Changes through
PUTtake effect immediately; a draft open in the editor is not affected. is_privateis alwaystrue. Polls are never listed publicly on the new platform.- Results.
poll_votesare1(chosen or yes),0(not chosen or no),2(if need be) andnull(not answered). Forranked_choicethey are the place the voter gave the option,1being first.poll_participantsis empty unless names are public or you own the poll. Results you are not allowed to see yet return403 results_hidden. - Write-in answers appear as extra options with
is_write_in: true. - Comments are notes voters leave with their vote. You can list, read and (as the poll
owner) delete them;
POST/commentsandPUT/comments/{id}answer501. - Users. There are no public profiles:
/users/@me(or your own id) works, any other user is404.usernameisnullanduser_metaonly holds defaults.PATCH/users/@mechangesdisplayname. - Media.
POST/uploadtakes images (JPEG, PNG, GIF or WebP, up to 5 MB). Videos, YouTube and Giphy media are not supported, soPOST/mediaandPUT/media/{id}answer501.DELETE/media/{id}refuses images a poll still shows. - Counters that no longer exist, such as
view_countand points, are0. - Errors are JSON objects with
errorandcode, and the same rate limits apply as for v4.
Your existing keys
Keys from the previous platform keep working once your account has been migrated. You can also create new keys in Settings → API keys; they work for v3 and v4.
Endpoints
Polls
POST/pollsCreate a poll, published right awayGET/polls/{poll_id}Get a pollPUT/polls/{poll_id}Replace a poll; settings left out keep their valueDELETE/polls/{poll_id}Delete a pollGET/polls/{poll_id}/resultsGet the resultsDELETE/polls/{poll_id}/resultsReset the poll: remove every voteGET/polls/{poll_id}/commentsList the comments on a poll
Comments
POST/commentsNot supported 501GET/comments/{comment_id}Get a commentPUT/comments/{comment_id}Not supported 501DELETE/comments/{comment_id}Delete a comment from your poll
Media
POST/uploadUpload an image (JPEG, PNG, GIF, WebP)POST/mediaNot supported; upload with POST /upload 501GET/media/{media_id}Get an imagePUT/media/{media_id}Not supported 501DELETE/media/{media_id}Delete an image no poll still shows
Users
GET/users/{user_id}Get a userPATCH/users/{user_id}Change the display nameGET/users/{user_id}/pollsList polls created or voted inGET/users/{user_id}/activitiesList recent activity