Twitch Polls API

Create and manage channel polls

Documentation

Specifications

Other Resources

OpenAPI Specification

twitch-polls-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Twitch Drops Ads Polls API
  description: APIs for game developers to create and manage Drops campaigns that grant in-game rewards to Twitch viewers watching streamers play their game. Drops campaigns are managed through the Twitch Developer Console and fulfilled via the Helix API entitlements endpoints.
  version: '1.0'
  contact:
    name: Twitch Developer Support
    url: https://dev.twitch.tv/support/
  termsOfService: https://www.twitch.tv/p/legal/terms-of-service/
servers:
- url: https://api.twitch.tv/helix
  description: Twitch Helix API Production
security:
- oauth2: []
tags:
- name: Polls
  description: Create and manage channel polls
paths:
  /polls:
    get:
      operationId: getPolls
      summary: Twitch Get Polls
      description: Gets polls for a specified channel.
      tags:
      - Polls
      parameters:
      - $ref: '#/components/parameters/clientId'
      - name: broadcaster_id
        in: query
        required: true
        schema:
          type: string
      - name: id
        in: query
        schema:
          type: string
      - $ref: '#/components/parameters/first'
      - $ref: '#/components/parameters/after'
      responses:
        '200':
          description: Polls returned successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Poll'
                  pagination:
                    $ref: '#/components/schemas/Pagination'
    post:
      operationId: createPoll
      summary: Twitch Create Poll
      description: Creates a poll for the specified channel.
      tags:
      - Polls
      parameters:
      - $ref: '#/components/parameters/clientId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PollInput'
      responses:
        '200':
          description: Poll created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Poll'
  /polls/end:
    patch:
      operationId: endPoll
      summary: Twitch End Poll
      description: Ends an active poll.
      tags:
      - Polls
      parameters:
      - $ref: '#/components/parameters/clientId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - broadcaster_id
              - id
              - status
              properties:
                broadcaster_id:
                  type: string
                id:
                  type: string
                status:
                  type: string
                  enum:
                  - TERMINATED
                  - ARCHIVED
      responses:
        '200':
          description: Poll ended successfully
components:
  parameters:
    after:
      name: after
      in: query
      schema:
        type: string
      description: Cursor for forward pagination
    first:
      name: first
      in: query
      schema:
        type: integer
        default: 20
        maximum: 100
      description: Maximum number of items to return
    clientId:
      name: Client-Id
      in: header
      required: true
      schema:
        type: string
      description: Your registered application's client ID
  schemas:
    Poll:
      type: object
      properties:
        id:
          type: string
        broadcaster_id:
          type: string
        broadcaster_name:
          type: string
        broadcaster_login:
          type: string
        title:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              title:
                type: string
              votes:
                type: integer
              channel_points_votes:
                type: integer
              bits_votes:
                type: integer
        bits_voting_enabled:
          type: boolean
        bits_per_vote:
          type: integer
        channel_points_voting_enabled:
          type: boolean
        channel_points_per_vote:
          type: integer
        status:
          type: string
          enum:
          - ACTIVE
          - COMPLETED
          - TERMINATED
          - ARCHIVED
          - MODERATED
          - INVALID
        duration:
          type: integer
        started_at:
          type: string
          format: date-time
        ended_at:
          type: string
          format: date-time
          nullable: true
    PollInput:
      type: object
      required:
      - broadcaster_id
      - title
      - choices
      - duration
      properties:
        broadcaster_id:
          type: string
        title:
          type: string
          maxLength: 60
        choices:
          type: array
          minItems: 2
          maxItems: 5
          items:
            type: object
            required:
            - title
            properties:
              title:
                type: string
                maxLength: 25
        duration:
          type: integer
          minimum: 15
          maximum: 1800
        channel_points_voting_enabled:
          type: boolean
        channel_points_per_vote:
          type: integer
    Pagination:
      type: object
      properties:
        cursor:
          type: string
          description: Cursor value for pagination
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://id.twitch.tv/oauth2/token
          scopes: {}
externalDocs:
  description: Twitch Drops Documentation
  url: https://dev.twitch.tv/docs/drops/