Naar inhoud springen

June 28, 2026 · 9 min read

Poll API: Embed Live Polls in Your Product

Create polls, run live sessions, read results and get webhooks from your own code: a developer's guide to the PollsLive poll API for SaaS and community apps.

By the PollsLive team·DevelopersHow-to

If your product has an audience (a webinar tool, an LMS, a community platform, an events app), you'll eventually want polling inside it. Building real-time voting, anti-fraud, and a results UI from scratch is months of work. Embedding PollsLive is an afternoon. Here's the developer path: create a poll, drop in an embed, read results, and get webhooks, with real the developer docs calls.

Auth: one Bearer token

Generate a workspace API key in Studio → Developer API (they look like `plv_live_…`) and send it as a Bearer token. No OAuth dance for server-to-server use; OAuth client-credentials is available when you need per-tenant scoping.

auth
export POLLSLIVE_API=https://pollslive.com/api/v1
export POLLSLIVE_KEY=plv_live_xxxxxxxxxxxxxxxxxxxx

# Every request carries the key as a Bearer token:
#   Authorization: Bearer $POLLSLIVE_KEY
# Limits and HTTP 429 handling: https://pollslive.com/docs/developers/rate-limits

Step 1: Create a poll from your code

A poll is a typed deck: content.questions is an array of slides, each with a kind discriminator. POST /polls returns the new poll, including its slug, which is all you need to embed it.

POST /polls
curl -sS -X POST "$POLLSLIVE_API/polls" \
  -H "Authorization: Bearer $POLLSLIVE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Which feature should we build next?",
    "renderingMode": "ASYNC",
    "content": {
      "questions": [{
        "id": "next",
        "kind": "multiple_choice",
        "text": "Which feature should we build next?",
        "options": [
          { "id": "a", "label": "Dark mode" },
          { "id": "b", "label": "Mobile app" },
          { "id": "c", "label": "Public API" }
        ]
      }]
    }
  }'
# → { "poll": { "slug": "which-feature-x7f2", ... } }

Step 2: Embed it in your UI

Drop the poll into any page with a one-line iframe: no SDK, no client library, and no third-party trackers riding along. It resizes to its container and works inside React, WordPress, Webflow, or plain HTML.

embed
<iframe
  src="https://pollslive.com/embed/which-feature-x7f2"
  width="100%" height="520"
  style="border:0;border-radius:12px"
  loading="lazy" title="PollsLive poll"></iframe>

Step 3: Read results when you need them

Pull tallies on demand for your own dashboards, or export a CSV for reporting. Results come back per-slide with counts and (for scales) averages.

GET results
curl -sS "$POLLSLIVE_API/polls/POLL_ID/results" \
  -H "Authorization: Bearer $POLLSLIVE_KEY"
# → { "questions": [ { "id": "next", "options": [
#       { "id": "a", "label": "Dark mode",  "count": 64 },
#       { "id": "b", "label": "Mobile app", "count": 41 },
#       { "id": "c", "label": "Public API", "count": 95 } ] } ] }

Step 4: Get pushed updates with webhooks

Polling the API works, but webhooks are better. Register an endpoint and PollsLive POSTs HMAC-signed events (vote.created, poll.published, session.started/ended) so your app reacts in real time. Verify the signature, then update your UI or pipe the event onward.

verify a webhook (Node)
import crypto from "node:crypto";

// header: the X-PollsLive-Signature value, "t=<unix>,v1=<hex>"
export function verify(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(
    header.split(",").map((kv) => kv.split("=")),
  );
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;

  const expected = crypto
    .createHmac("sha256", secret)
    .update(`${t}.${rawBody}`)
    .digest("hex");

  const a = Buffer.from(expected);
  const b = Buffer.from(parts.v1 ?? "");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

That's the whole loop: create, embed, read, react. For the full reference (every endpoint, scope, and event type), see the developer docs, and for a worked example, piping live results into an internal dashboard with webhooks.

Tip

Start with the REST API for create and publish, then add webhooks when you need live result pushes.

For no-code sharing, see share and embed your poll.

Build on PollsLive: create polls, drive live sessions, pull results, and receive webhooks from your own code.

Read the developer docs

We gebruiken essentiële cookies om je ingelogd te houden en dubbele stemmen te voorkomen. Met je toestemming gebruiken we ook Cloudflare Web Analytics om paginaweergaven te tellen en de Whop Pixel om te zien welke bezoeken tot een aankoop leiden. Cookie Policy