Developers / API reference

Poll API

v3

Integrations built for the previous StrawPoll API keep working. This page describes how v3 maps onto forms.

Base URL
https://strawpoll.com/api/v3
Spec
OpenAPI 3

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 typeForm section
multiple_choice with text optionsmultiple_choice
multiple_choice with image optionspicture_choice
ranked_choiceranked_choice
meeting with date and time_range optionsmeeting

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_configForm setting
deadline_atclosesAt
duplication_checking: ip, session, invite, noneresponseDuplicateCheck: ip, session, code, none
results_visibility: always, after_vote, after_deadline, neverresultsVisibility: public, public_after_response, public_after_close, private
edit_vote_permissions: admin, admin_voter, voter, nobodyeditResponsePermissions: admin, admin_own_responses, own_responses, nobody
hide_participantsresponsesVisibility: private
allow_commentsallowComments, with public comments
allow_vpn_usersthe opposite of blockVPNUsers
force_appearance: light, dark, autothe light or dark StrawPoll theme, or none
is_multiple_choice, multiple_choice_min, multiple_choice_maxthe same, with 0 meaning no limit
allow_other_optionwrite-in answers
randomize_optionsshuffled options
allow_indeterminate“if need be” answers in meeting polls
require_voter_namesa 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 PUT take effect immediately; a draft open in the editor is not affected.
  • is_private is always true. Polls are never listed publicly on the new platform.
  • Results. poll_votes are 1 (chosen or yes), 0 (not chosen or no), 2 (if need be) and null (not answered). For ranked_choice they are the place the voter gave the option, 1 being first. poll_participants is empty unless names are public or you own the poll. Results you are not allowed to see yet return 403 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/comments and PUT/comments/{id} answer 501.
  • Users. There are no public profiles: /users/@me (or your own id) works, any other user is 404. username is null and user_meta only holds defaults. PATCH/users/@me changes displayname.
  • Media. POST/upload takes images (JPEG, PNG, GIF or WebP, up to 5 MB). Videos, YouTube and Giphy media are not supported, so POST/media and PUT/media/{id} answer 501. DELETE/media/{id} refuses images a poll still shows.
  • Counters that no longer exist, such as view_count and points, are 0.
  • Errors are JSON objects with error and code, 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/polls Create a poll, published right away
  • GET/polls/{poll_id} Get a poll
  • PUT/polls/{poll_id} Replace a poll; settings left out keep their value
  • DELETE/polls/{poll_id} Delete a poll
  • GET/polls/{poll_id}/results Get the results
  • DELETE/polls/{poll_id}/results Reset the poll: remove every vote
  • GET/polls/{poll_id}/comments List the comments on a poll

Comments

  • POST/comments Not supported 501
  • GET/comments/{comment_id} Get a comment
  • PUT/comments/{comment_id} Not supported 501
  • DELETE/comments/{comment_id} Delete a comment from your poll

Media

  • POST/upload Upload an image (JPEG, PNG, GIF, WebP)
  • POST/media Not supported; upload with POST /upload 501
  • GET/media/{media_id} Get an image
  • PUT/media/{media_id} Not supported 501
  • DELETE/media/{media_id} Delete an image no poll still shows

Users

  • GET/users/{user_id} Get a user
  • PATCH/users/{user_id} Change the display name
  • GET/users/{user_id}/polls List polls created or voted in
  • GET/users/{user_id}/activities List recent activity