openapi: 3.0.3
info:
  title: Poltio API (Widget) Documentation
  description: Poltio Widget API Calls
  contact:
    email: dev@poltio.com
  version: 10.4.0
servers:
  - url: https://api.poltio.com/
tags:
  - name: Widget
    description: Everything related to widgets
paths:
  /widget/auth:
    post:
      tags:
        - Widget
      summary: guest login call for un-registered users to vote/play tests and quizes etc
      description: this call is for un-registered users with a unique cookie or device id to identify themselves to the api
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - client_id
                - client_secret
              properties:
                client_id:
                  type: string
                  description: Client ID for making auth requests.
                client_secret:
                  type: string
                  description: Client Secret for making auth requests
                publisher_id:
                  type: integer
                  description: Content user_id
                  nullable: true
                  example: 1
                puid:
                  type: string
                  nullable: true
                  description: Unique User identifier to mark users
                cookie_id:
                  type: string
                  nullable: true
                  description: Unique visitor ID if you have different tracking for auth and guest users
        required: true
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: status message for your login attampt
                    default: logged in
                  token:
                    type: string
                    description: access token for yout future use
        "400":
          description: Session id is missing
          content: {}
        "401":
          description: Wrong client crendentials or session_id already registered.
          content: {}
        500:
          description: Tech error
  /widget/theme/{theme_id}:
    get:
      tags:
        - Theme
      summary: Get a theme from a unique id
      parameters:
        - $ref: '#/components/parameters/themeIdParam'
      responses:
        200:
          description: Theme saved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Theme'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/content/{public_id}:
    get:
      tags:
        - Widget
      summary: Get a content object for give public id
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/publicIdParam'
        - $ref: '#/components/parameters/puid'
        - $ref: '#/components/parameters/language'
      responses:
        200:
          $ref: '#/components/responses/ContentResponse'
        400:
          description: User can't play this content more than once
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        410:
          $ref: '#/components/responses/Gone'
        500:
          $ref: '#/components/responses/Error'
  /widget/content/merged/{public_ids}:
    get:
      tags:
        - Widget
      summary: Get a single content with merged questions and answers based on titles with unified counters
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/publicIdsParam'
        - $ref: '#/components/parameters/puid'
        - $ref: '#/components/parameters/language'
      responses:
        200:
          $ref: '#/components/responses/ContentResponse'
        400:
          description: User can't play this content more than once
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        410:
          $ref: '#/components/responses/Gone'
        500:
          $ref: '#/components/responses/Error'
  /widget/session/start/{public_id}:
    post:
      tags:
        - Widget
      summary: Start a new voting session.
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/publicIdParam'
        - $ref: '#/components/parameters/puid'
        - $ref: '#/components/parameters/language'
      requestBody:
        $ref: '#/components/requestBodies/SessionStart'
      responses:
        200:
          description: Session started
          content:
            application/json:
              schema:
                type: object
                properties:
                  session_id:
                    type: string
                    example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
                  lead:
                    $ref: '#/components/schemas/Lead'
                  pixel_code:
                    type: string
                    nullable: true
                  questions:
                    type: array
                    items:
                      $ref: '#/components/schemas/Question'
                  type:
                    type: string
                  voter_id:
                    type: integer
                    description: A unique identifier for the Voter.
        400:
          description: User can't play this content more than once
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        410:
          $ref: '#/components/responses/Gone'
        500:
          $ref: '#/components/responses/Error'
  /widget/session/end/{public_id}/{session_id}:
    get:
      tags:
        - Widget
      summary: End the session without requesting any result. Can be used when we interrupt a session due to redirect or followup
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/publicIdParam'
        - $ref: '#/components/parameters/sessionIdParam'
        - $ref: '#/components/parameters/puid'
      responses:
        200:
          description: Session closed
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        410:
          $ref: '#/components/responses/Gone'
        500:
          $ref: '#/components/responses/Error'
  /widget/result/{public_id}/{session_id}:
    post:
      tags:
        - Widget
      summary: Get result for a voting session.
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/publicIdParam'
        - $ref: '#/components/parameters/sessionIdParam'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/SessionResult'
      responses:
        200:
          description: Set Result
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/ContentResult'
                  lead:
                    $ref: '#/components/schemas/Lead'
                  pixel_code:
                    type: string
                    nullable: true
                  play_time:
                    type: integer
                    description: play time in microseconds.
                  calculator_score:
                    type: integer
                    description: if the set is doing some calculations, this field will give its result
                  correct_answer:
                    type: integer
                    description: If the content is doing answer feedback, this will give the number of correct choice answers
                  question_count:
                    type: integer
                    description: This field will return the question number in the sequence
                  answer:
                    $ref: '#/components/schemas/Answer'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        410:
          $ref: '#/components/responses/Gone'
        500:
          $ref: '#/components/responses/Error'
  /widget/session/log-token-usage:
    post:
      tags:
        - Widget
      summary: Log Token usage for the session for LLM Operations
      security:
        - voterAuth: []
      requestBody:
        $ref: '#/components/requestBodies/LogTokenUsage'
      responses:
        200:
          description: Logged
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        410:
          $ref: '#/components/responses/Gone'
        500:
          $ref: '#/components/responses/Error'
  /widget/lead:
    post:
      tags:
        - Widget
      summary: Save a new lead
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/language'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/NewVoterLead'
      responses:
        200:
          description: LeadSaved
        400:
          $ref: '#/components/responses/ValidationError'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/lead/stat:
    post:
      tags:
        - Widget
      summary: Increase a leads stats
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/language'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/LeadStat'
      responses:
        200:
          description: Done
        400:
          $ref: '#/components/responses/ValidationError'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/vote/answer:
    post:
      tags:
        - Widget
      summary: Vote predefined answers
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/language'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/AnswerVote'
      responses:
        200:
          description: Voted.
        400:
          $ref: '#/components/responses/ValidationError'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/vote/text:
    post:
      tags:
        - Widget
      summary: Vote free type answers
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/language'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/TextVote'
      responses:
        200:
          description: Voted.
        400:
          $ref: '#/components/responses/ValidationError'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/vote/undo:
    post:
      tags:
        - Widget
      summary: Undo your last vote.
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/language'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/UndoVote'
      responses:
        200:
          description: Vote removed.
        400:
          $ref: '#/components/responses/ValidationError'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/result/click:
    post:
      tags:
        - Widget
      summary: Increase a click counter for a result.
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/language'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/ResultClick'
      responses:
        200:
          description: Voted.
        400:
          $ref: '#/components/responses/ValidationError'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/result/view:
    post:
      tags:
        - Widget
      summary: Increase a view counter for a result.
      security:
        - voterAuth: []
      parameters:
        - $ref: '#/components/parameters/language'
        - $ref: '#/components/parameters/puid'
      requestBody:
        $ref: '#/components/requestBodies/ResultView'
      responses:
        200:
          description: Voted.
        400:
          $ref: '#/components/responses/ValidationError'
        401:
          $ref: '#/components/responses/Unauthorized'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/content/view:
    post:
      tags:
        - Widget
      summary: Count a new view for a content
      requestBody:
        $ref: '#/components/requestBodies/ContentViewCount'
      responses:
        200:
          description: View counted.
        400:
          $ref: '#/components/responses/ValidationError'
        500:
          $ref: '#/components/responses/Error'
  /widget/load/{pid}:
    get:
      tags:
        - Widget
      summary: Get content for a dynamic widget area
      parameters:
        - $ref: '#/components/parameters/pidParam'
        - $ref: '#/components/parameters/urlParam'
      responses:
        200:
          description: View counted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  public_id:
                    type: string
                    example: 2ea279ca6969
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/load:
    get:
      tags:
        - Widget
      summary: Get content for a dynamic widget area
      parameters:
        - $ref: '#/components/parameters/urlParam'
      responses:
        200:
          description: View counted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  public_id:
                    type: string
                    example: 2ea279ca6969
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
  /widget/domain/status:
    post:
      tags:
        - Widget
      summary: Check a custom domain record if its defined, active and get organization for the domain
      requestBody:
        $ref: '#/components/requestBodies/CheckDomainStatus'
      responses:
        200:
          description: Domain is verified, active and account bound
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization_id:
                    type: integer
                    example: 1
        400:
          $ref: '#/components/responses/ValidationError'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/Error'
## END OF PATHS
components:
  parameters:
    language:
      name: Accept-Language
      in: header
      description: Change the language for the response
      required: false
      schema:
        type: string
        enum:
          - en
          - tr
    puid:
      name: puid
      in: query
      description: Publisher UUID if exists
      required: false
      schema:
        type: string
    pidParam:
      name: pid
      in: path
      description: Publisher Unique Identifier
      required: true
      schema:
        type: integer
        example: 1
    urlParam:
      name: url
      in: query
      required: false
      description: Escaped url string
      schema:
        type: string
        example: https://www.poltio.com
    publicIdParam:
      name: public_id
      in: path
      required: true
      description: Contents public unique identifier.
      schema:
        type: string
        example: e11d17f3-5bb7-4c73-a2d7-6d05ae899c4d
    publicIdsParam:
      name: public_ids
      in: path
      required: true
      description: Contents public unique identifier in comma seperated with no spaces
      schema:
        type: string
        example: e11d17f3-5bb7-4c73-a2d7-6d05ae899c4d,e11d17f3-5bb7-4c73-a2d7-6d05ae899c4d
    sessionIdParam:
      name: session_id
      in: path
      required: true
      description: Unique session id.
      schema:
        type: string
        example: e11d17f3-5bb7-4c73-a2d7-6d05ae899c4d
    themeIdParam:
      name: theme_id
      in: path
      required: true
      description: Theme unique identifier.
      schema:
        type: integer
        example: 1
  responses:
    Error:
      description: Generic error happened, please look into messages
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The route or content is not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: You have an invalid or expired token or not enough permission to access to this call.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: You dont have permission to access this resource
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Gone:
      description: This content is no longer available
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: You have validation errors in your request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    ContentResponse:
      description: Content response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Content'
  schemas:
    Error:
      type: object
      properties:
        message:
          type: string
    ValidationError:
      type: object
      properties:
        msg:
          type: string
        errors:
          type: object
          description: This object will return each field and corresponding validation msg
    Question:
      type: object
      properties:
        id:
          type: integer
        user_id:
          type: integer
        content_id:
          type: integer
        title:
          type: string
        background:
          type: string
          description: Content main cover image path. Can be used with iproxy.
          nullable: true
        vertical_image:
          type: string
          description: Content main cover image path for the Wide Screen layout
          nullable: true
        vertical_mobile_image:
          type: string
          description: Content main cover image path for the Wide Screen layout in single column view
          nullable: true
        alt:
          type: string
          nullable: true
          description: Alt tag content for the background and vertical_image fields.
        vote_count:
          type: integer
        view_count:
          type: integer
          description: Total view count for the content, only accurate if the requester owns the content. Otherwise 0 will return
        answer_type:
          type: string
          enum:
            - text
            - media
            - score
            - star_rating
            - yesno
            - free_text
            - free_number
            - autocomplete
        created_at:
          type: string
        updated_at:
          type: string
        allow_multiple_answers:
          type: integer
          description: 'if 1 this question can allow multiple votes '
        max_multi_punch_answer:
          type: integer
          description: How many answers can a user vote for a multi punch question
        recommended_popular_answer:
          type: integer
          description: How many answers do you want to display on auto complete type answers
        has_leads:
          type: integer
        answer_time_limit:
          type: integer
          description: N minutes for changing answers allowed
        hide_results:
          type: integer
          description: 'If 1, vote percentages wont be displayed after voting. '
        hide_counter:
          type: integer
          description: If 1, total number of people voted will not be displayed.
        gives_feedback:
          type: integer
          description: 'If 1, after voting for this question, it will give some feedback. (ex: Right/Wrong answer.)'
        rotate_answers:
          type: integer
          description: 'If 1, while displaying answers, it should be in random order. '
        rotate_answers_last:
          type: integer
          description: 'If 1, while displaying answers, it should be in random order except the last answer '
        voted:
          type: integer
          description: 'indicates if the requester already voted for this question or not. '
        answers:
          type: array
          items:
            $ref: '#/components/schemas/Answer'
        cal_val_default:
          type: integer
          nullable: true
          description: Default calculator value for this question if no answer is voted
        is_searchable:
          type: boolean
        is_skippable:
          type: boolean
        is_connected:
          type: boolean
        autocomplete_help:
          nullable: true
          type: string
          description: Autocomplete answer type help text
        autocomplete_placeholder:
          nullable: true
          type: string
          description: Autocomplete answer type placeholder text.
        options:
          $ref: '#/components/schemas/QuestionOptions'
    QuestionOptions:
      type: object
      nullable: true
      properties:
        min_label:
          type: string
          nullable: true
          description: Custom minimum label for question.
          example: Min
        max_label:
          type: string
          nullable: true
          description: Custom maximum label for question.
          example: Max
    Answer:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier for the Answer
        question_id:
          type: integer
          description: unique identifier for the Question
        background:
          type: string
          nullable: true
          description: if the answer has a media/image attached to it.
        alt:
          type: string
          nullable: true
          description: if the answer has an image this is used for alt attribute for accessibility
        vote_count:
          type: integer
          description: number of votes for this answer
        win_count:
          description: number of wins for this answer
          type: integer
        round_win_count:
          description: number of wins for this answer in rounds
          type: integer
        created_at:
          type: string
        updated_at:
          type: string
        triggers_lead:
          type: integer
        triggers_display:
          type: integer
        has_right_answer:
          type: integer
        is_right_answer:
          type: integer
        is_mutually_exclusive:
          type: integer
          description: Defines if the answer is mutually exclusive, meaning in a MP question, if this answer is selected, all other selected answers must be disregarded
        voted:
          type: integer
        is_clone:
          type: boolean
          description: Defines if an answer is clone of some other answer
        clone_source:
          nullable: true
          type: integer
          description: if this answer is a clone, this field refers to source answer id.
        cal_val:
          nullable: true
          type: integer
          description: Answer calculator set value
        is_disabled:
          type: boolean
          description: If the answer has a max vote value and it reached that value, this will be returned as true which should disable the answer for new votes
        addon:
          type: string
          nullable: true
          description: Additional information that gets passed to GTM or other events if the answer is voted/selected
        disabled_msg:
          type: string
          nullable: true
          description: If you want to customize the disabled state message for the answer
    Result:
      type: object
      properties:
        id:
          type: integer
          example: 14271
        title:
          type: string
          example: Thank You!
        background:
          type: string
          nullable: true
          example: content/generic/1567532923.8938.jpg
        alt:
          type: string
          nullable: true
          description: Alt tag content for the background image.
          example: 'A washed blue jeans with straight fit '
        description:
          type: string
          example: Thank you for participating
        search:
          type: string
          nullable: true
        search2:
          type: string
          nullable: true
        url:
          type: string
          nullable: true
          example: https://www.poltio.com
        url_text:
          type: string
          nullable: true
          example: Click here for the best website ever
        luv:
          type: string
          nullable: true
          example: '&result=r1'
    User:
      type: object
      properties:
        id:
          type: integer
        level:
          type: integer
        is_verified:
          type: integer
          description: Need to be 1 in order to comment or create content.
        vc:
          type: integer
          description: Total vote count of all this users contents.
        tc_accepted_at:
          type: string
          format: date-time
          nullable: true
          description: Defines if the user has accepted the terms and conditions
        theme:
          $ref: '#/components/schemas/Theme'
    Lead:
      type: object
      required:
        - id
        - name
        - title
        - fields
        - image
        - is_active
        - msg
        - notify_style
        - notify_emails
        - type
        - button_value
        - redirect_url
        - is_mobile
        - ios_link
        - android_link
        - only_image
        - is_pre_defined
        - youtube_id
        - terms_conditions
        - terms_conditions2
        - tc_optional
        - tc2_optional
        - stop_set
        - mandatory
        - redirect_count
        - lead_count
        - input_counter
        - auto_open_delay
        - auto_open
        - link_target
        - open_minimized
        - delay
      properties:
        id:
          type: integer
          description: Unique identifier for the Lead Campaign
        fields:
          type: string
          description: Can be an empty string or comma seperated field names like name, comment, gsm, email and file. Defines what kind of input fields that the lead has.
        name:
          type: string
          nullable: false
          description: A required field to identifying the lead, not visible to the end users
        title:
          type: string
          nullable: true
          description: A string visible to the end user if you want to add a title for your lead.
        image:
          type: string
          nullable: true
          description: Optional field to defined the Lead main Cover image.
        msg:
          type: string
          nullable: true
          description: Lead msg to show to the visitor
        type:
          type: string
          description: type of the lead. in input types, we display some inputs for user to fill, with redirect, we display an image and a button for user to click, with empty, we do some image change.
          enum:
            - input
            - redirect
            - empty
            - internal_redirect
        button_value:
          type: string
          description: The button value for the lead
          nullable: true
        redirect_url:
          type: string
          description: url for the button
          nullable: true
        is_mobile:
          type: integer
          description: if 1 this lead should only be fired if user is on a mobile device.
        ios_link:
          type: string
          description: if not empty, on ios devices this link should be used as redirect link
        android_link:
          type: string
          description: if not empty, on android devices this link should be used as redirect link
        only_image:
          type: integer
          description: if 1, without any feedback only question image should be updated with lead.image
        youtube_id:
          type: string
          description: if not empty, on lead image this youtube video should be played
        input_counter:
          type: integer
        auto_open:
          type: integer
          default: 0
          description: Indicating if the redirect should happen automatically
        auto_open_delay:
          type: integer
          default: 2500
          description: Delay in miliseconds between lead opening and auto redirect
        open_minimized:
          type: integer
          default: 0
          description: Indicates if the lead should open minimized by default.
        delay:
          type: integer
          default: 2000
          description: The delay for loading the lead in the card in miliseconds.
        tc_short:
          type: string
          description: 'Short text for the terms and conditions line that is used to open the long version. '
          nullable: true
          example: I consent to this form
        tc2_short:
          type: string
          description: 'Short text for the terms and conditions line that is used to open the long version. '
          nullable: true
          example: I consent to this form
        tc_approve_button_label:
          type: string
          description: If you want to customize the button label of the I accept section
          nullable: true
          example: I accept
        tc_reject_button_label:
          type: string
          description: If you want to customize the button label of the I reject section
          nullable: true
          example: I reject
        tc2_approve_button_label:
          type: string
          description: If you want to customize the button label of the I accept section
          nullable: true
          example: I accept
        tc2_reject_button_label:
          type: string
          description: If you want to customize the button label of the I reject section
          nullable: true
          example: I reject
        custom_labels:
          type: object
          description: If you want to customize the input field labels for any of the input type, you can set custom labels via this field.
          nullable: true
          properties:
            email:
              type: string
              example: email
            gsm:
              type: string
              example: gsm
            name:
              type: string
              example: name
            comment:
              type: string
              example: comment
    Content:
      type: object
      required:
        - public_id
        - type
        - content_type
        - original_id
        - title
        - background
        - vertical_image
        - vertical_mobile_image
        - alt
        - desc
        - created_at
        - updated_at
        - end_date
        - skip_start
        - skip_result
        - hide_counter
        - hide_results
        - display_repeat
        - lang
        - embed_footer_url
        - play_once
        - play_once_strategy
        - play_once_msg
        - play_once_img
        - play_once_btn
        - play_once_link
        - vote_count
        - win_count
        - round_win_count
        - voter_count
        - start_count
        - finish_count
        - view_count
        - is_ended
        - results
        - questions
        - user
        - theme
        - result_loading
        - options
        - feature_flags
      properties:
        public_id:
          type: string
          description: Unique ID for the content.
        type:
          type: string
          description: Defines the content type. Can be poll, set, quiz or test.
        content_type:
          type: string
          description: Defines the end user type for the content
          enum:
            - survey
            - poll
            - set
            - quiz
            - test
            - product_finder
            - this-that
            - would-you-rather
            - content
        original_id:
          type: integer
          description: Content type unique id for the Old format.
        title:
          type: string
          description: Content title.
        background:
          type: string
          description: Content main cover image path. Can be used with iproxy.
          nullable: true
        vertical_image:
          type: string
          description: Content main cover image path for the Wide Screen layout
          nullable: true
        vertical_mobile_image:
          type: string
          description: Content main cover image path for the Wide Screen layout in single column view
          nullable: true
        alt:
          type: string
          nullable: true
          description: Alt tag content for the background and vertical_image fields.
        desc:
          type: string
          description: Content description.
          nullable: true
        created_at:
          type: string
          format: datetime
          description: Content creation date.
        updated_at:
          type: string
          format: datetime
          description: Content last update date.
        end_Date:
          type: string
          format: datetime
          description: Content end date.
          nullable: true
        skip_start:
          type: boolean
          description: Indicates if the content should display a cover card.
        skip_result:
          type: boolean
          description: Indicates if the content should display a result card.
        hide_counter:
          type: boolean
          description: Indicicates if the content should hide vote counters.
        hide_results:
          type: boolean
          description: Indicates if the content should display vote percentages
        display_repeat:
          type: boolean
          description: Indicates if the content should display a Play Again button at the end.
        lang:
          type: string
          description: Content language.
        embed_footer_url:
          type: string
          description: If the embed_footer_img is set, this url should be linked to the img.
          nullable: true
        play_once:
          type: boolean
          description: Defines if the content is only available for vote/play once per user.
        play_once_strategy:
          type: string
          description: Indicates how the play once restrictions should be applied if enabled.
        play_once_msg:
          type: string
          nullable: true
          description: Defines a msg for play once errors.
        play_once_img:
          type: string
          description: Defines an image to show if the user sees a play once error screen
          nullable: true
        play_once_btn:
          type: string
          nullable: true
          description: Indiciates the button text for the play once error screen
        play_once_link:
          type: string
          nullable: true
          description: Indicates the button link for play once error screen
        vote_count:
          type: integer
          description: Vote count for the content
        voter_count:
          type: integer
          description: Unique voter count for the content
        start_count:
          type: integer
          description: Start count
        finish_count:
          type: integer
          description: Finish count
        view_count:
          type: integer
          description: View count
        is_ended:
          type: boolean
          description: Defines if the content has ended or not.
        loading_next_question_label:
          type: string
          nullable: true
          description: Use to customize the loading label between questions.
        loading_result_label:
          type: string
          nullable: true
          description: Use to customize the loading label between the last question and result
        result_loading:
          type: boolean
          description: Indicates if a loader should be displayed before loading the results
        results:
          type: array
          items:
            $ref: '#/components/schemas/ContentResult'
        questions:
          type: array
          items:
            $ref: '#/components/schemas/Question'
        user:
          $ref: '#/components/schemas/User'
        theme:
          $ref: '#/components/schemas/Theme'
        options:
          $ref: '#/components/schemas/ContentOptions'
        feature_flags:
          $ref: '#/components/schemas/ContentFeatureFlags'
        attributes:
          $ref: '#/components/schemas/ContentAttributes'
    ContentAttributes:
      type: object
      properties:
        cal_formula:
          type: string
          nullable: true
          description: The string represantation for the formula to find the result if the content type is calculator content
        gives_feedback:
          type: integer
          enum:
            - 0
            - 1
          description: If you want to mark the answers as correct or wrong and display a feedback based on users answers.
          default: 0
          nullable: true
        show_timer:
          type: integer
          enum:
            - 0
            - 1
          description: If you want to display a timer for the sesssion duration.
          nullable: true
          default: 0
        display_results:
          type: integer
          enum:
            - 0
            - 1
          description: If you want to display the correct answer count for the session at the result screen
          default: 1
          nullable: true
        pool_question_count:
          type: integer
          default: 0
          description: If you want to display a certain number of questions randomly for every session out of all added questions.
          nullable: true
        time_limit:
          type: integer
          description: If you want to add a time limit to the session, you can set this value
          nullable: true
        recom_title:
          type: string
          description: Recommendation title customization
          example: Our Recommendations
          nullable: true
        noindex:
          type: integer
          enum:
            - 0
            - 1
          description: If you want to hide content from search engines, you can turn this on
          default: 0
          nullable: true
        canonical:
          type: string
          description: If this field is set, widget page will include a canonical rel tag
          example: https://www.poltio.com
          nullable: true
        redirect:
          type: string
          description: If this field is set, widget should redirect the request
          example: https://www.poltio.com
          nullable: true
        keywords:
          type: string
          description: If this field is set widget should include meta keywords
          nullable: true
    ContentOptions:
      type: object
      properties:
        align:
          type: string
          description: horizontal alignment for the widget
          enum:
            - left
            - right
            - center
          default: center
        vertical:
          type: string
          description: vertical alignment for the widget
          enum:
            - top
            - center
            - bottom
          default: top
        resultfit:
          type: string
          description: adjusts the cropping and size options on the result card image
          enum:
            - fit
            - vf
            - "off"
            - null
          nullable: true
          default: null
        openlinks:
          type: string
          description: adjust the link target for result and lead links.
          default: _blank
          enum:
            - _top
            - _self
            - _blank
            - _parent
        disclaimer:
          type: string
          description: if you want to hide the cookie disclaimer
          default: on
          enum:
            - "off"
            - "on"
        cookie:
          type: string
          description: turns off the default cookie usage for poltio widget
          default: on
          enum:
            - "off"
            - "on"
        result_lead_delay:
          type: integer
          description: adjusts the default delay for the leads in the result cards in miliseconds
          default: 1000
        resultcards:
          type: string
          description: converts the result card design between legacy and new
          default: legacy
          enum:
            - legacy
            - new
        medianswercols:
          type: number
          description: adjusts how many media answers will be fitted in a row
          default: 3
          enum:
            - 3
            - 4
            - 5
    ContentFeatureFlags:
      type: object
      properties:
        llm_desc:
          type: boolean
          description: Indicates if llm description generation is enabled for this content, this is different from llm_desc field in the content options, that field turns off or on. This field is the parent check for the account and content type. When this is false, it will override the content options.
          example: true
        llm_compare:
          type: boolean
          description: indicates if llm compare option is enabled for this content, this is different from llm_desc field in the content options, that field turns off or on. This field is the parent check for the account and content type. When this is false, it will override the content options.
          example: false
    Theme:
      type: object
      required:
        - id
        - name
        - primary_color
        - primary_color_selected
        - primary_text_color
        - primary_text_color_selected
        - secondary_color
        - secondary_background_color
        - footer_background_color
        - main_text_color
        - background_color
        - cover_background_color
        - cover_text_color
        - cover_desc_color
        - question_background_color
        - question_text_color
        - result_background_color
        - result_text_color
        - result_desc_color
        - mp_info_color
        - positive_color
        - negative_color
        - font_family
        - font_family_css
        - font_size_title
        - line_height_title
        - font_size_answer
        - line_height_answer
        - title_font_weight
        - button_font_weight
        - button_border_radius
        - answer_border_radius
        - textinput_border_radius
        - card_border_radius
        - footer_img
        - background_img
        - card_shadow
        - bar_thickness
        - question_load_time
        - gtm_id
        - gtm_dl
        - disc_msg
        - disc_display_option
        - custom_code
        - cover_font_size_title
        - cover_line_height_title
        - cover_font_size_description
        - cover_line_height_description
        - question_font_size_title
        - question_line_height_title
        - question_font_size_description
        - question_line_height_description
        - result_box_shadow
        - result_font_size_title
        - result_line_height_title
        - result_font_size_description
        - result_line_height_description
        - result_image_background
        - wide_image_background_color
        - anchor_color
        - anchor_hover_color
        - anchor_font_size
        - bullets_color
        - next_question_text_color
        - start_over_text_color
        - start_over_background_color
        - mobile_top_border_radius
        - content_background_color
      properties:
        id:
          type: integer
          description: Unique identifier for the theme
          example: 1
        name:
          type: string
          description: A string name for the theme for internal use
          example: My blue theme
        primary_color:
          type: string
          description: Primary font color
          example: rgba(0, 0, 0, 0.02)
        primary_color_selected:
          type: string
          description: Primary background color for action buttons and selected options outer shells
          example: rgb(0, 158, 235)
        primary_text_color:
          type: string
          description: Primary font color
          example: rgba(30, 61, 84, 1)
        primary_text_color_selected:
          type: string
          description: Text color for primary action buttons
          example: rgb(255, 255, 255)
        secondary_color:
          type: string
          description: Text color for unselected options
          example: rgba(30, 61, 84, 0.75)
        secondary_background_color:
          type: string
          description: Background color for non-selected options.
          example: rgb(221, 231, 235)
        footer_background_color:
          type: string
          description: Background color of Footer
          example: rgb(255, 255, 255)
        main_text_color:
          type: string
          description: Default font color for the page. All texts that doesn't have a specific field can be adjusted by this.
          example: rgb(30, 61, 84)
        background_color:
          type: string
          description: Default background color for the widget.
          example: rgb(240, 248, 255)
        background_repeat:
          type: string
          example: repeat
          description: 'Background repeat tag '
        background_size:
          type: string
          example: auto auto
          description: 'Background size tag '
        cover_background_color:
          type: string
          description: Background Color of Cover Card
          example: rgb(255, 255, 255)
        cover_text_color:
          type: string
          description: Font Color of Cover Card Title
          example: rgb(30, 61, 84)
        cover_desc_color:
          type: string
          description: Font Color of Cover Card Description Section
          example: rgb(131, 146, 166)
        question_background_color:
          type: string
          description: Background Color of Question Cards
          example: rgb(255, 255, 255)
        question_text_color:
          type: string
          description: Font Color of Question Cards
          example: rgb(30, 61, 84)
        result_background_color:
          type: string
          description: Background Color of Result Card
          example: rgb(255, 255, 255)
        result_text_color:
          type: string
          description: Font Color of Result Card
          example: rgb(30, 61, 84)
        result_desc_color:
          type: string
          description: Font Color of Result Card Description Section
          example: rgb(131, 146, 166)
        mp_info_color:
          type: string
          description: Font color of Multi Punch Info
          example: rgba(30, 61, 84, 0.7)
        positive_color:
          type: string
          description: Succes lead message and true answer color
          example: rgba(55, 215, 175, 1)
        negative_color:
          type: string
          description: Error lead message and false answer color
          example: rgba(253, 103, 76, 1)
        font_family:
          type: string
          description: Font Family of your widget.
          example: '"Averta", "Arial", sans-serif'
        font_family_css:
          type: string
          description: Font Family of your widget.
          example: https://platform.poltio.com/fonts/averta/averta
        font_size_title:
          type: string
          description: Title and title sized font sizes
          example: 1.5rem
        line_height_title:
          type: string
          description: Line height for titles
          example: 1.8rem
        font_size_answer:
          type: string
          description: Font Size of Description and Answer Button Text
          example: 1rem'
        line_height_answer:
          type: string
          description: Line height for answers
          example: 1.4rem
        title_font_weight:
          type: string
          description: Tittle font weight
          example: "700"
        button_font_weight:
          type: string
          description: Button font weight
          example: "600"
        button_border_radius:
          type: string
          description: Border Radius of primary buttons
          example: 0.5rem'
        answer_border_radius:
          type: string
          description: Border Raduis of answers
          example: 0.5rem
        textinput_border_radius:
          type: string
          description: Border Raduis of text inputs
          example: 0.5rem
        card_border_radius:
          type: string
          description: Main Card Border Radius
          example: .5rem
        card_shadow:
          type: string
          description: Main Card Shadow Options
          example: 0 0 1rem rgba(20,36,51,.1)
        footer_img:
          type: string
          description: Footer Image
          example: placeholder/poltio-logo.png
        background_img:
          type: string
          nullable: true
          description: Embed Background Image
        bar_thickness:
          type: string
          description: Progress bar thickness
          example: 0.125rem
        gtm_id:
          type: string
          description: Google Tag Manager Id
          example: G-GCQ3TQDQK6
        gtm_dl:
          type: string
          description: Google Tag Manager function name
          example: dataLayer
        disc_msg:
          type: string
          nullable: true
          description: Disclaimer message
        disc_display_option:
          type: boolean
          description: Disclaimer show button option
          example: false
        custom_code:
          type: string
          nullable: true
          description: Custom theme code (JS/CSS)
        show_pb_on_top:
          type: boolean
          description: Indicates if we have progress bar on top of the card
          default: false
          example: true
        show_pb_on_bottom:
          type: boolean
          description: Indicates if we have progress bar on bottom of the card
          default: true
          example: true
        question_title_alignment:
          type: string
          description: Aligns the card titles
          enum:
            - start
            - center
          example: start
          default: start
        percentage_color_selected:
          type: string
          description: Percentage numbers font color
          example: rgb(255, 255, 255)
          default: rgb(255, 255, 255)
        percentage_color_unselected:
          type: string
          description: Percentage numbers font color for the unselected answer
          example: rgba(30, 61, 84, 1)
          default: rgba(30, 61, 84, 1)
        cover_font_size_title:
          type: string
          default: 1.5rem
          example: 1.5rem
        cover_line_height_title:
          type: string
          default: 1.8rem
          example: 1.8rem
        cover_font_size_description:
          type: string
          default: 1rem
          example: 1rem
        cover_line_height_description:
          type: string
          default: normal
          example: normal
        question_font_size_title:
          type: string
          default: 1.5rem
          example: 1.5rem
        question_line_height_title:
          type: string
          default: 1rem
          example: 1rem
        question_font_size_description:
          type: string
          default: 1.0rem
          example: 1.0rem
        question_line_height_description:
          type: string
          default: 1.8rem
          example: 1.8rem
        result_box_shadow:
          type: string
          default: 0px 0px 12px 0px rgba(20, 36, 51, 0.2)
          example: 0px 0px 12px 0px rgba(20, 36, 51, 0.2)
        result_font_size_title:
          type: string
          default: 1.5rem
          example: 1.5rem
        result_line_height_title:
          type: string
          default: 1.8rem
          example: 1.8rem
        result_font_size_description:
          type: string
          default: 1rem
          example: 1rem
        result_line_height_description:
          type: string
          default: normal
          example: normal
        result_image_background:
          type: string
          default: rgba(255, 255, 255, 0)
          example: rgba(255, 255, 255, 0)
        wide_image_background_color:
          type: string
          default: rgba(255, 255, 255, 0)
          example: rgba(255, 255, 255, 0)
        anchor_color:
          type: string
          default: rgb(0, 158, 235)
          example: rgb(0, 158, 235)
        anchor_hover_color:
          type: string
          default: rgb(0, 158, 235)
          example: rgb(0, 158, 235)
        anchor_font_size:
          type: string
          default: 0.875rem
          example: 0.875rem
        bullets_color:
          type: string
          description: Result bullet points color
          nullable: true
        next_question_text_color:
          type: string
          description: Next question text color
          nullable: true
        start_over_text_color:
          type: string
          description: Start over button text color
          nullable: true
        start_over_background_color:
          type: string
          description: Start over button background color
          nullable: true
        mobile_top_border_radius:
          type: string
          description: Top border radius of card for mobile devices
          nullable: true
        content_background_color:
          type: string
          description: Right column bg color
          default: rgb(255, 255, 255)
    ContentResult:
      type: object
      required:
        - id
        - title
        - background
        - alt
        - desc
        - url
        - url_text
        - youtube_id
        - lead_id
        - pixel_code_id
        - counter
        - luv
        - min_c
        - max_c
      properties:
        id:
          type: integer
        title:
          type: string
        background:
          type: string
          nullable: true
        alt:
          type: string
          nullable: true
          description: Alt tag content for the background image.
        desc:
          type: string
          nullable: true
        url:
          type: string
          nullable: true
        url_text:
          type: string
          nullable: true
        secondary_url:
          type: string
          nullable: true
        secondary_url_text:
          type: string
          nullable: true
        youtube_id:
          type: string
          nullable: true
        lead_id:
          type: integer
          nullable: true
        pixel_code_id:
          type: integer
          nullable: true
        pixel_code_view:
          type: string
          nullable: true
          description: Pixel Code that should run when the result comes in to view.
        pixel_code_click:
          type: string
          nullable: true
          description: Pixel Code that should run when the results primary button clicks.
        pixel_code_secondary_click:
          type: string
          nullable: true
          description: Pixel Code that should run when the results secondary button clicks
        counter:
          type: integer
        luv:
          type: string
          nullable: true
        min_c:
          type: integer
          description: Min correct answer (or calculator score) to get this result
        max_c:
          type: integer
          description: Maximum correct answer or calculator score to get this result
        filter_desc:
          type: string
          nullable: true
          description: Available on product finders, supports markdown.
        search_points:
          type: integer
          description: Available on searchable contents and indicates poltio search score for a given result.
        price_text:
          type: string
          description: Available on product finders and indicates a price feild on the result card
        old_price_text:
          type: string
          description: Available on product finders and indicates the previous price of the result
        old_price_text_strike:
          type: boolean
          description: Available on product finders when old_price_text is not null and when this field is true, old_price_text should be displayed with a strike through
        price_discount_text:
          type: string
          nullable: true
          description: When not null, will display the percentage of the discount, should be displayed with locale support
    PagedResponse:
      type: object
      required:
        - per_page
        - current_page
        - from
        - to
        - total
        - last_page
        - last_page_url
        - first_page_url
        - next_page_url
        - path
        - prev_page_url
      properties:
        per_page:
          type: integer
          description: Meta pagination information about the per page record
        current_page:
          type: integer
          description: Meta pagination information about the current page.
        from:
          type: integer
        to:
          type: integer
        total:
          type: integer
        last_page:
          type: integer
        last_page_url:
          type: string
        first_page_url:
          type: string
        next_page_url:
          type: string
          nullable: true
        path:
          type: string
        prev_page_url:
          type: string
          nullable: true
    ContentType:
      type: string
      enum:
        - poll
        - set
        - quiz
        - test
    PlayOnce:
      type: object
      required:
        - play_once
        - play_once_strategy
        - play_once_msg
        - play_once_img
        - play_once_link
        - play_once_btn
      properties:
        play_once:
          type: integer
          enum:
            - 0
            - 1
          description: Defines if the content is playable once per user.
          default: 0
          example: 1
        play_once_strategy:
          type: string
          enum:
            - start
            - result
          description: Progress in the flow where we the system should consider the user as played. From the start or at the result.
          example: start
        play_once_img:
          type: string
          nullable: true
          description: If you want to display a custom image in the play once message you can use this field.
          example: path/image.ext
        play_once_link:
          type: string
          nullable: true
          description: If you want to display a custom button with a link.
          example: https://www.poltio.com
        play_once_btn:
          type: string
          nullable: true
          description: If you want to display a custom button with a link
          example: Click here to go to the best SaaS site ever.
        play_once_msg:
          type: string
          nullable: true
          description: If you want to display a custom message instead of generic error message you can customize by using this field.
          example: Thank you for playing our content.
    VoterInput:
      type: object
      properties:
        voter_id:
          type: integer
          description: Unique internal ID for the Poltio Voter
          example: 77148828
        session_id:
          type: string
          description: Unique User Id in uuid format for the session
          example: 343a656b-c91a-45f7-a692-153a526e394d
        answer:
          type: string
          description: Free input that the voter gave.
          nullable: true
          example: Hello World
        ip:
          type: string
          description: IP address for the vote.
          example: 8.8.8.8
        parent:
          type: string
          nullable: true
          description: Parent page URL for the vote. Can be the widget url or the page that the widget is embedded to.
          example: https://www.poltio.com/e/set/42
        created_at:
          type: string
          description: Vote date.
          example: "2022-02-15T09:49:32.000000Z"
  requestBodies:
    ## Widget Request Bodies
    NewVoterLead:
      description: Save a new voter lead
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              lead_id:
                type: integer
                description: Lead ID
                example: 1
              session_id:
                type: string
                description: Unique session id for this session
                example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
              public_id:
                type: string
                description: Unique public id for the content
                example: asdasdsfafas
              phone:
                type: string
                nullable: true
                example: xxxxxxxxxx
              name:
                type: string
                nullable: true
                example: Poltio Company
              email:
                type: string
                nullable: true
                example: hello@poltio.com
              comment:
                type: string
                nullable: true
                example: Hello how are you
              tc_accepted:
                type: integer
                default: 0
                description: If the lead has tc field and user accepted it send this as 1
                enum:
                  - 0
                  - 1
              tc2_accepted:
                type: integer
                default: 0
                description: If the lead has tc2 field and user accepted it send this as 1
                enum:
                  - 0
                  - 1
              is_start:
                type: boolean
                default: false
                description: If this lead is submitted from cover/start this should mark it by setting this field as true
    LeadStat:
      description: Save a new stat for a lead
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              lead_id:
                type: integer
                example: 1
              session_id:
                type: string
                description: Unique session id for this session
                example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
              action:
                type: string
                description: stat action
                enum:
                  - view
                  - click
                  - submit
    AnswerVote:
      description: Vote For predefined answer
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              session_id:
                type: string
                description: Unique session id for this session
                example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
              public_id:
                type: string
                description: Unique public id for the content
                example: asdasdsfafas
              question_id:
                type: string
                description: Unique question id for the question
                example: 123456
              answers:
                type: array
                items:
                  type: integer
    TextVote:
      description: Vote For predefined answer
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              session_id:
                type: string
                description: Unique session id for this session
                example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
              public_id:
                type: string
                description: Unique public id for the content
                example: asdasdsfafas
              question_id:
                type: string
                description: Unique question id for the question
                example: 123456
              answer:
                type: string
                example: Hello World
    UndoVote:
      description: Undo your last vote.
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              session_id:
                type: string
                description: Unique session id for this session
                example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
              public_id:
                type: string
                description: Unique public id for the content
                example: asdasdsfafas
              question_id:
                type: string
                description: Unique question id for the vote you want to undo
                example: 123456
    ResultClick:
      description: Count a click for a result
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              session_id:
                type: string
                description: Unique session id for this session
                nullable: true
                example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
              url:
                type: string
                description: the outgoing url
                nullable: true
                example: https://poltio.com
              type:
                type: string
                description: Type of the click
                example: set
                enum:
                  - set
                  - quiz
                  - content
                  - lead
                  - test
              target_id:
                type: integer
                description: ID for the target, result or lead
                example: 42
              position:
                type: integer
                description: Position of the result starting from 1
                example: 1
              click_type:
                type: string
                enum:
                  - primary
                  - secondary
                  - compare
                  - compare_submit
                  - compare_pdp
                  - share
                  - start_over
                description: Indicates if the click is coming from a primary button or a secondary button
                example: primary
    ResultView:
      description: Count a view for a result
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              session_id:
                type: string
                description: Unique session id for this session
                nullable: true
                example: be8e6e4c-edab-4896-b8bd-d74a1fd0a641
              type:
                type: string
                description: Type of the click
                example: set
                enum:
                  - set
                  - quiz
                  - content
                  - lead
                  - test
              target_id:
                type: integer
                description: ID for the target, result or lead
                example: 42
              position:
                type: integer
                description: Position of the result starting from 1
                example: 1
    ContentViewCount:
      description: Count a view for a content
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              public_id:
                type: string
                description: Unique public id for the content
                example: asdasdsfafas
    CheckDomainStatus:
      description: Count a view for a content
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              domain:
                type: string
                description: your domain name not including schema or paths
                example: poltio.gcg.me
    SessionStart:
      description: Start a voting session
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              puid:
                type: string
                description: unique user hash to store with all the voting data
                example: CustomUserHash123
              custom_id:
                type: string
                description: If puid field is not enough by itself, you can store additional identifier as custom_id with the session.
                example: CustomCustomID123
              voter_id:
                type: string
                description: unique user identifier according to poltio tag sdk
                example: CustomUserHash123
              url:
                type: string
                nullable: true
                description: The url of the session. Should be the parent page if SDK is on, should contain schema, host, path and query string if possible.
                example: https://www.poltio.com/
              source:
                type: string
                nullable: true
                description: Indicates the session source. Can be widget for poltio designed default widgets, embed for custom iframe placement or dlink to indicate direct link
              referrer_session_id:
                type: string
                nullable: true
                description: If this session is starting from an internal redirect, please attach the og session_id with this field.
                example: 3d1bdd99-f72a-4bb5-bc86-dab3d4a47e52
              referrer_content_id:
                type: string
                nullable: true
                description: if this session starting from an internal redirect, please attach the og contents public id with this field
                example: 3d1bdd99-f72a-4bb5-bc86-dab3d4a47e52
    SessionResult:
      description: Finish a session and receive a result
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              winning_answer_id:
                type: integer
                description: unique identifier for the winning answer
                example: 1
                nullable: true
    LogTokenUsage:
      description: Log token usage in a session for LLM operations
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              session_id:
                type: string
                description: unique identifier for the active session
                example: 3d1bdd99-f72a-4bb5-bc86-dab3d4a47e52
              call_type:
                type: string
                description: type of call
                example: result_desc
                enum:
                  - result_desc
                  - compare
              token_count:
                type: integer
                description: Used token count
                example: 1024
  securitySchemes:
    voterAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
