Skip to content
Developer Reference

Documentation & Integration

Everything you need to drop interactive widgets, embed dynamic README badges, or automate polls via the Polls Lab REST API.

01Interactive Embed Playground

Select a format to preview and copy production-ready snippets for any poll.

Live Render Preview
Live Badge Preview
Generated Snippet:
[![Poll](http://localhost:8000/api/v1/badges/demo-frameworks.svg)](http://localhost:4321/polls/demo-frameworks)

02REST API Reference (`/api/v1`)

FastAPI backend with OpenAPI 3.1 documentation, strict Pydantic v2 typing, and scoped CORS.

POST/api/v1/polls

Create a new poll with profanity moderation and option media.

curl -X POST http://localhost:8000/api/v1/polls \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Favorite language?",
    "options": ["Python", "Rust", "Go"],
    "visibility": "public"
  }'
POST/api/v1/votes/{poll_id}

Submit a vote. Issues httpOnly device token with duplicate protection.

curl -X POST http://localhost:8000/api/v1/votes/demo-frameworks \
  -H "Content-Type: application/json" \
  -d '{"option_id": "1"}'
GET/api/v1/leaderboard/trending

Get trending public polls filtered to the last 7 days and sorted by velocity.

curl http://localhost:8000/api/v1/leaderboard/trending?limit=10
GET/api/v1/analytics/{poll_id}/export

Download complete raw poll vote records as CSV or JSON (Owner only).

curl "http://localhost:8000/api/v1/analytics/demo/export?format=csv" \
  -H "Authorization: Bearer <token>"

03Self-Hosting Architecture

PocketBase SQLite single-binary design ensures anyone can run Polls Lab offline or in production.

Polls Lab is designed around zero operational friction. The persistence layer runs on standalone PocketBase SQLite, allowing local testing without Docker, and production deployment on Azure Free VMs, Linux VPS, or Fly.io persistent NVMe volumes.