API reference

The PollGarden REST API lets you create and manage polls programmatically. Requires a Premium plan and an API key.

Authentication

Create a key in your dashboard, then send it as a Bearer token. Keys are secret — never ship them in a browser.

curl https://pollgarden.com/api/v1/me \
  -H "Authorization: Bearer pk_live_your_key_here"

Endpoints

MethodPathDescription
GET/api/v1/meYour plan and rate limits.
GET/api/v1/pollsList your polls (cursor, limit≤100).
POST/api/v1/pollsCreate a poll (same schema as the builder).
GET/api/v1/polls/:idPoll detail with options.
PATCH/api/v1/polls/:idEdit title/description.
DELETE/api/v1/polls/:idSoft-delete a poll.
POST/api/v1/polls/:id/closeClose a poll.
GET/api/v1/polls/:id/resultsAggregated results.
GET/api/v1/polls/:id/votesPaginated raw votes.

Create a poll

curl -X POST https://pollgarden.com/api/v1/polls \
  -H "Authorization: Bearer pk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "single",
    "title": "Best pizza topping?",
    "visibility": "public",
    "categoryId": "<uuid>",
    "options": [{"label":"Margherita"},{"label":"Pepperoni"}]
  }'

Response:

{ "data": { "id": "...", "slug": "abc12xyz", "url": "/p/abc12xyz" } }

Errors

Every error is { "error": { "code", "message" } }.

CodeHTTPMeaning
unauthorized401Missing/invalid API key.
forbidden403Banned account.
plan_required403Premium plan required.
not_found404Resource not found or not yours.
validation_error422Body failed validation.
rate_limited429Too many requests (see Retry-After).

Rate limits

60 requests/minute and 5,000/day per key. Responses include X-RateLimit-Limit, -Remaining and -Reset; a 429 includes Retry-After.