Skip to content

Data shapes

All modes return the same JSON shapes, so a vote button written against the SDK, the script tag, or the REST API receives identical data. This page is the canonical reference for those shapes.

// Polst
{
"shortId": "a1b2c3d4e5f6",
"title": "Which pizza topping is better?",
"optionA": { "label": "Pineapple", "imageUrl": "https://cdn.polst.app/..." },
"optionB": { "label": "Mushroom", "imageUrl": "https://cdn.polst.app/..." },
"tallies": { "optionA": 1423, "optionB": 2817, "total": 4240 },
"status": "open", // "scheduled" | "open" | "closed"
"startsAt": "2026-04-01T00:00:00Z",
"endsAt": null,
"brand": { // see "Embedded brand theme" below
"slug": "acme",
"name": "Acme Co.",
"theme": { /* BrandTheme DTO, see below */ }
},
"createdAt": "2026-03-15T12:00:00Z"
}
// Campaign
{
"campaignId": "7e8f4686-1d4b-491b-8e6d-9f64d4bcd82e",
"title": "Spring Flavor Showdown",
"description": "...",
"polsts": [ /* ordered array of polst summaries */ ],
"totalSteps": 8,
"brand": {
"slug": "acme",
"name": "Acme Co.",
"theme": { /* BrandTheme DTO */ }
},
"status": "open",
"startsAt": "...",
"endsAt": null
}
// Caller progress on a campaign (device or user scoped)
{
"campaignId": "...",
"completedSteps": 3,
"totalSteps": 8,
"currentPolst": { /* polst shape */ },
"completed": false,
"summary": null // populated once completed=true
}

Every brand envelope — whether the compact { slug, name, theme } embedded inside a polst or campaign, or the full GET /brands/{slug} profile — carries a resolved theme sub-object so renderers never have to make a second round-trip to /brands/{slug}/theme. The resolver merges in defaults; brands with no customisations show version: 0.

// BrandTheme DTO (resolved — the shape embedded inside `brand.theme`)
{
"accent": "#ff00aa", // or null when unset
"background": null,
"foreground": null,
"muted": null,
"border": null,
"buttonBg": null,
"buttonFg": null,
"buttonBgHover": null,
"success": null,
"danger": null,
"radius": "MD", // "NONE" | "SM" | "MD" | "LG" | "FULL"
"density": "COMFORTABLE", // "COMPACT" | "COMFORTABLE"
"fontStack": "SYSTEM", // "SYSTEM" | "SERIF" | "MONO" | "BRAND"
"fontBrandUrl": null, // https, allow-listed CDN
"logoLightUrl": null, // https, project S3 bucket
"logoDarkUrl": null,
"faviconUrl": null,
"hideWatermark": false,
"customCss": null,
"version": 0
}

Colour fields are null when the brand has not chosen an override — renderers fall back to CSS-variable defaults. version bumps on every PATCH via /brands/me/theme and is the stable cache key the renderers use. See Brand theming & the watermark for how brands edit these values.

GET /polsts/{shortId}, GET /brands/{slug}, and GET /brands/{slug}/theme emit a weak ETag W/"theme-v{n}" where {n} is the brand’s theme version (0 for brands with no theme row). Renderers should cache the response body and revalidate with If-None-Match; the server returns 304 Not Modified on a match, short-circuiting the DB lookup. theme-v{n} is a theme-invalidation signal only — it does not mean the tallies are fresh. Clients that need live tallies call /polsts/{id}/results or refetch without If-None-Match.

Logo and favicon bytes are not uploaded through the REST API. Upload them in the Polst dashboard, under the brand’s theming settings — the dashboard posts the file to Polst, which sanitises it, generates the derivatives (thumbnail, dark-mode variant, favicon sizes), stores everything in the Polst asset bucket, and writes the resulting URLs onto the theme row for you. Logos accept image/png, image/svg+xml and image/webp; favicons accept image/png and image/svg+xml; either way the source file must be ≤ 2 MiB.

What the REST API exposes is the theme row, which you can read and patch:

PATCH /api/rest/v1/brands/me/theme
{ "logoLightUrl": "https://<polst-asset-bucket>/…/brand-assets/…/logoLight-….png" }

logoLightUrl, logoDarkUrl and faviconUrl accept only HTTPS URLs that already live in the Polst asset bucket under a brand-assets/ path — the URLs a dashboard upload produces. A URL on your own CDN is rejected with 422, because Polst has to be able to serve, sanitise and cache-bust the asset itself. Send null to clear a slot.

The endpoint requires the manage scope, bearer auth and an X-Polst-Idempotency-Key header — see Authentication & device identity. For the complete per-endpoint schemas, see the API Reference.