> ## Documentation Index
> Fetch the complete documentation index at: https://api.pollunit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update option

> Changes an existing option. Only the given attributes are written, the others keep their value. Admin access through the admin_hash may change every option; otherwise the option has to belong to the requesting user and the poll has to still allow changes. Options that already collected votes can only be changed as long as the poll allows it.



## OpenAPI

````yaml /api-reference/openapi.json patch /api/v1/polls/{poll_id}/options/{id}
openapi: 3.0.1
info:
  title: PollUnit API
  version: v1
  description: Programmatic access to PollUnit.
servers:
  - url: https://pollunit.com
    description: Production
  - url: http://localhost:3000
    description: Development
security:
  - bearerAuth: []
paths:
  /api/v1/polls/{poll_id}/options/{id}:
    parameters:
      - name: poll_id
        in: path
        description: Poll member_hash or admin_hash
        required: true
        schema:
          type: string
      - name: id
        in: path
        description: Option public_id, as returned in the id field
        required: true
        schema:
          type: string
      - name: organization_id
        in: query
        required: false
        description: >-
          public_id of an organization the user belongs to. When given, the
          request runs in that organization context instead of the personal
          account.
        schema:
          type: string
    patch:
      tags:
        - Options
      summary: Update option
      description: >-
        Changes an existing option. Only the given attributes are written, the
        others keep their value. Admin access through the admin_hash may change
        every option; otherwise the option has to belong to the requesting user
        and the poll has to still allow changes. Options that already collected
        votes can only be changed as long as the poll allows it.
      parameters:
        - name: X-POLLUNIT-USER-IDENTIFIER
          in: header
          required: false
          description: >-
            Your own identification of the user on whose behalf the request is
            made, any string. The user identifiers should not be guessable and
            stay secret, otherwise users could get access to other users'
            contents. Only used with a public API token: the created or changed
            object belongs to that anonymous user instead of the token owner,
            which keeps the user in control of it in later requests with the
            same identifier.
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptionUpdateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/OptionUpdateRequest'
      responses:
        '200':
          description: option updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Option'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unauthorized'
        '403':
          description: forbidden (the option belongs to somebody else)
        '404':
          description: option not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
        '422':
          description: invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      security:
        - bearerAuth: []
components:
  schemas:
    OptionUpdateRequest:
      type: object
      properties:
        option:
          $ref: '#/components/schemas/OptionInput'
        parent_option_id:
          type: string
          nullable: true
          description: >-
            public_id of a parent option to move the option to. Omit to keep the
            current parent.
        additional_attributes:
          type: object
          nullable: true
          description: >-
            Values for the poll's `additional_option_attributes`. Omit to keep
            the stored values; when given, the hash replaces all of them, so it
            has to carry every required value.
      required:
        - option
    Option:
      type: object
      description: >-
        Full representation of a single poll option. Top-level fields vary by
        option type and are included conditionally depending on the poll's
        visibility settings and your access level (admin vs. member);
        type-specific configuration is grouped under `settings`.
      properties:
        id:
          type: string
          description: Option public_id
        admin_url:
          type: string
          format: uri
          nullable: true
          description: Admin access only
        public_url:
          type: string
          format: uri
        parent_option_id:
          type: string
          nullable: true
        type:
          type: string
          description: Option STI class
          example: Options::TextOption
        content:
          type: string
          nullable: true
        subtitle:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        author_name:
          type: string
          nullable: true
        position:
          type: integer
          nullable: true
        state:
          type: string
          nullable: true
          enum:
            - incoming
            - investigation
            - planned
            - in_implementation
            - rejected
            - done
          description: Collection polls only
        rank:
          type: integer
          nullable: true
        rating:
          type: number
          format: float
          nullable: true
        average_rating:
          type: number
          format: float
          nullable: true
        best_rating:
          type: boolean
          nullable: true
        selected:
          type: boolean
          nullable: true
        child_option_type:
          type: string
          nullable: true
        data:
          type: object
          nullable: true
          description: >-
            Option-type-specific payload (e.g. location_data for location
            options)
        drawing_type:
          type: string
          nullable: true
          enum:
            - free_sketch
            - sign
            - draw_on_image
        input_type:
          type: string
          nullable: true
          description: Input options only
          enum:
            - text
            - textarea
            - email
            - url
            - select
            - radio
            - multi_select
            - checkbox
            - number
            - number_float
            - file
            - date
            - datetime
        location_type:
          type: string
          nullable: true
          enum:
            - point
            - route
            - polygon
            - circle
            - rectangle
        options_count:
          type: integer
          nullable: true
        paid:
          type: boolean
          nullable: true
        privacy_policy_accepted:
          type: boolean
          nullable: true
        processing:
          type: boolean
          nullable: true
        rotation:
          type: integer
          nullable: true
        terms_accepted:
          type: boolean
          nullable: true
        info_link:
          type: string
          nullable: true
        info_link_title:
          type: string
          nullable: true
        start_date:
          type: string
          format: date-time
          nullable: true
        end_date:
          type: string
          format: date-time
          nullable: true
        created_at:
          type: string
          format: date-time
          nullable: true
        updated_at:
          type: string
          format: date-time
          nullable: true
        video_thumb_path:
          type: string
          nullable: true
        vimeo_id:
          type: string
          nullable: true
        youtube_id:
          type: string
          nullable: true
        voter_count:
          type: integer
          nullable: true
        settings:
          $ref: '#/components/schemas/OptionSettings'
        attachment:
          $ref: '#/components/schemas/OptionAttachment'
        approval_state:
          type: string
          nullable: true
          description: Admin access only
          enum:
            - unreviewed
            - approved
            - disapproved
        approval_state_updated_at:
          type: string
          format: date-time
          nullable: true
          description: Admin access only
        archived:
          type: boolean
          nullable: true
          description: Admin access only
        fraudulent_count:
          type: integer
          nullable: true
          description: Admin access only
        state_change_message:
          type: string
          nullable: true
          description: Admin access only
      required:
        - id
        - type
        - public_url
    Unauthorized:
      type: object
      properties:
        error:
          type: string
          example: Unauthorized
    NotFound:
      type: object
      properties:
        error:
          type: string
          example: Not Found
    Errors:
      type: object
      properties:
        error:
          type: string
          example: Unprocessable Entity
        errors:
          type: object
    OptionInput:
      type: object
      description: >-
        Attributes accepted when creating or updating an option. The option
        class is derived from the poll (or from the parent option for nested
        options) and cannot be set through the API.
      properties:
        content:
          type: string
          nullable: true
          example: My option
          description: Title of the option. Required for most option types.
        subtitle:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        author_name:
          type: string
          nullable: true
          description: >-
            Required when the poll has `require_author_name` and the request
            does not have admin access.
        allowed_values:
          type: array
          items:
            type: string
          nullable: true
          description: >-
            Selectable values of a `select`, `radio` or `multi_select` input
            option.
        archived:
          type: boolean
          nullable: true
          description: Admin access only
        start_date:
          type: string
          format: date-time
          nullable: true
        end_date:
          type: string
          format: date-time
          nullable: true
        info_link:
          type: string
          nullable: true
        info_link_title:
          type: string
          nullable: true
        input_type:
          type: string
          nullable: true
          description: Input and column options only
          enum:
            - text
            - textarea
            - email
            - url
            - select
            - radio
            - multi_select
            - checkbox
            - number
            - number_float
            - file
            - date
            - datetime
        vimeo_id:
          type: string
          nullable: true
        youtube_id:
          type: string
          nullable: true
        attachment:
          type: string
          format: binary
          nullable: true
          description: >-
            File for option types that carry an attachment (image, audio, video
            file and photo options). Only available with a `multipart/form-data`
            request, and ignored for option types without an attachment.
    OptionSettings:
      type: object
      description: Option-type-specific configuration, grouped for readability.
      properties:
        allowed_values:
          type: array
          items:
            type: string
          nullable: true
        column_width:
          type: integer
          nullable: true
        dot_vote_icon:
          type: string
          nullable: true
          enum:
            - dot
            - heart
            - star
            - 'yes'
        mandatory:
          type: boolean
          nullable: true
        multiline:
          type: boolean
          nullable: true
        randomize_options:
          type: boolean
          nullable: true
        require_vote:
          type: boolean
          nullable: true
        show_as_list:
          type: boolean
          nullable: true
        survey_step_rating_method:
          type: string
          nullable: true
          enum:
            - average_by_voted
            - average_by_all_voters
          description: Survey steps only.
        survey_step_type:
          type: string
          nullable: true
          enum:
            - info
            - entry
            - rating
            - choice
            - drawing
            - location
        survey_step_vote_limit_per_option:
          type: integer
          nullable: true
        survey_step_vote_limit_per_option_min:
          type: integer
          nullable: true
        survey_step_vote_limit_per_voter:
          type: integer
          nullable: true
        survey_step_vote_type:
          type: string
          nullable: true
          enum:
            - Votes::BooleanVote
            - Votes::BooleanPlusVote
            - Votes::BooleanThumbVote
            - Votes::BooleanPlusThumbVote
            - Votes::BooleanHeartVote
            - Votes::RatingVote
            - Votes::DotVote
            - Votes::RangeVote
            - Votes::EmojiVote
            - Votes::SuperlativeVote
            - Votes::RankedVote
            - Votes::MatrixVotes::AgreementVote
            - Votes::MatrixVotes::BestVote
            - Votes::MatrixVotes::FrequencyVote
            - Votes::MatrixVotes::ImportanceVote
            - Votes::MatrixVotes::LikelihoodVote
            - Votes::MatrixVotes::LoveHateVote
            - Votes::MatrixVotes::SatisfactionVote
            - Votes::MatrixVotes::YesNoVote
            - Votes::MatrixVotes::CustomVote
            - Votes::FileVote
            - Votes::InputVote
            - Votes::LocationVote
          description: Survey steps only. The allowed subset depends on `survey_step_type`.
        voter_limit:
          type: integer
          nullable: true
    OptionAttachment:
      type: object
      nullable: true
      description: >-
        URLs of the file uploaded to the option, returned by both the list and
        the show endpoint. Only present for option types that carry an uploaded
        file (image, photo, audio, drawing and advent calendar options);
        youtube/vimeo and uploaded-video options do not have it. The
        `attachment_url_*` keys are the processed derivatives that exist for
        this file, so which ones are returned depends on the uploaded file:
        images and videos get `large`, `thumb` and `social`, an audio file only
        gets `cover` if it has embedded cover art, and a file that is still
        processing has none at all. The whole object is omitted when none of its
        keys apply, e.g. an option without a file or a still-processing upload
        you have no download access to.
      properties:
        attachment_url_large:
          type: string
          format: uri
          nullable: true
          description: Long edge resized to 1920px (webp).
        attachment_url_thumb:
          type: string
          format: uri
          nullable: true
          description: Width resized to 496px (webp).
        attachment_url_social:
          type: string
          format: uri
          nullable: true
          description: Long edge resized to 1200px (jpg), used for social media previews.
        attachment_url_cover:
          type: string
          format: uri
          nullable: true
          description: Cover art extracted from an audio file.
        attachment_original_url:
          type: string
          format: uri
          nullable: true
          description: >-
            The file as it was uploaded. Admin access only. For images and
            videos this falls back to the `large` derivative unless the account
            keeps source files.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: opaque
      description: Personal API token — find yours under My Account → API.

````