Skip to main content

Create Poll

Endpoint: /room/createPoll

This API allows your backend server to push a complete poll into an active Plug-N-Meet session in real time. While moderators can create polls from within the client, this endpoint lets an external application inject a poll directly into a running session, making it a powerful building block for automated integrations.

This endpoint is ideal for building integrations such as:

  • Launching a live quiz in a classroom from an external learning platform.
  • Collecting audience votes triggered by events in your application.
  • Scheduling recurring polls or surveys from an external tool.

Once the poll is pushed, it is created in the running state immediately:

  1. Every participant in the live room receives the new-poll notification and can vote right away.
  2. The moderator can then close it, publish the results, or reopen it — just like any poll created from within the client.
  3. If duration is set, the poll closes automatically when the time runs out.

For this API call to succeed, the session (room_id) must be a currently active room. The request fails if the room has not been created or has already ended.

Request Parameters

FieldTypeRequiredDescription
room_idstringYesThe unique identifier of the active room into which you want to push the poll.
user_idstringNoThe user ID to attribute the poll to. If omitted, it defaults to external-api.
questionstringYesThe poll question. Must not be empty.
optionsarrayYesThe poll options. At least two are required and each must have non-empty text. See Poll Option.
is_anonymousbooleanNoIf true, voting is anonymous: individual voter choices are never stored per-user. Default: false.
is_multiplebooleanNoIf true, participants can select multiple options when voting. Default: false.
is_quizbooleanNoIf true, the poll runs as a quiz. Correct answers are hidden while the quiz is running and revealed in the results after it is closed. A quiz requires at least one option marked as correct. Default: false.
durationnumberNoAuto-close duration in seconds. If greater than 0, the poll closes automatically when the time runs out. Maximum: 3600 (60 minutes). Default: 0 (no time limit).

Poll Option

Each entry in the options array represents one selectable choice.

FieldTypeRequiredDescription
idnumberYesA simple sequential number identifying the option (1, 2, 3, ...).
textstringYesThe option text. Must not be empty.
is_correctbooleanNoIf true, this option is a correct answer. Only meaningful when is_quiz is true.

Example

Example 1: A Simple Poll

{
"room_id": "room01",
"question": "Which topic should we cover next?",
"options": [
{
"id": 1,
"text": "Advanced whiteboard features"
},
{
"id": 2,
"text": "Recording and playback"
}
]
}

Example 2: An Anonymous Multi-Select Poll

{
"room_id": "room01",
"user_id": "user-42",
"question": "Which sessions did you attend today?",
"options": [
{
"id": 1,
"text": "Morning keynote"
},
{
"id": 2,
"text": "Product workshop"
},
{
"id": 3,
"text": "Networking session"
}
],
"is_anonymous": true,
"is_multiple": true
}

Example 3: A Timed Quiz

{
"room_id": "room01",
"question": "What does the HASH-SIGNATURE header contain?",
"options": [
{
"id": 1,
"text": "An HMAC-SHA256 signature of the request body",
"is_correct": true
},
{
"id": 2,
"text": "The API key"
}
],
"is_quiz": true,
"duration": 120
}

Response

FieldTypeDescription
statusbooleanIndicates if the request was successful.
msgstringResponse message.
poll_idstringThe unique ID of the newly created poll.
status_codestringResponse status code.

Error Responses

On failure, status is false and msg describes the problem. Validation failures return stable, machine-readable keys that the client UI can translate directly:

msg keyDescription
polls.errors.question-requiredThe question field is missing or empty.
polls.errors.min-optionsFewer than two options were provided.
polls.errors.option-requiredAn option is missing its text.
polls.errors.quiz-needs-correctThe poll is marked as a quiz, but no option is marked as correct.
polls.errors.duration-capThe duration exceeds the maximum of 3600 seconds (60 minutes).

Other common failures are returned as plain messages: a missing room_id, or a room that is not currently active (this endpoint requires the session to be running at the moment the poll is pushed).