{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pollunit-com/json-schema/pollunit-com-poll-schema.json",
  "title": "Poll",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pollunit-com-openapi.yml#/components/schemas/Poll",
  "type": "object",
  "properties": {
    "admin_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "Admin URL (owner/admin access only)"
    },
    "public_url": {
      "type": "string",
      "format": "uri"
    },
    "member_hash": {
      "type": "string",
      "description": "Public poll identifier (use for read/submit)"
    },
    "admin_hash": {
      "type": [
        "string",
        "null"
      ],
      "description": "Admin identifier (only returned to owner)"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "location": {
      "type": [
        "string",
        "null"
      ]
    },
    "type": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "closed"
      ]
    },
    "options_count": {
      "type": "integer"
    },
    "voters_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "settings": {
      "$ref": "#/$defs/PollSettings"
    },
    "configuration_hints": {
      "type": [
        "object",
        "null"
      ],
      "description": "Allowed values for selected configuration fields (owner/admin only)"
    },
    "voter_required_fields": {
      "$ref": "#/$defs/RequiredFields"
    },
    "option_required_fields": {
      "$ref": "#/$defs/RequiredFields"
    }
  },
  "required": [
    "public_url",
    "member_hash",
    "title",
    "type",
    "status"
  ],
  "$defs": {
    "PollSettings": {
      "type": "object",
      "properties": {
        "access_by_provider": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "facebook",
            "google_oauth2",
            "github",
            "organization_sso"
          ]
        },
        "additional_attributes": {
          "type": [
            "object",
            "null"
          ]
        },
        "additional_option_attributes": {
          "type": [
            "object",
            "null"
          ]
        },
        "advent_calendar_shape": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "number",
            "star",
            "snow",
            "square",
            "circle",
            "list"
          ]
        },
        "allow_attachments": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_change_sort": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_comments": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_description": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_group_submissions": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_info_link": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_new_options": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_new_rows": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_search": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_share": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_subtitle": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allow_voting": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "allowed_hosts": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "anonymize_voter_names": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "custom_hash": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "deadline_submission": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "deadline_voting": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "default_sort": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "options.average_rating desc",
            "options.rating desc",
            "options.content asc",
            "options.created_at asc",
            "options.created_at desc",
            "options.author_name asc",
            "options.updated_at desc"
          ],
          "description": "Sort order of the options. `null` keeps the manual order."
        },
        "default_states": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "enum": [
              "incoming",
              "investigation",
              "planned",
              "in_implementation",
              "rejected",
              "done"
            ]
          },
          "description": "Collection polls only: option states selected by default."
        },
        "disable_participant_sign_up": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "dot_vote_icon": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "dot",
            "heart",
            "star",
            "yes"
          ]
        },
        "effect": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "snow",
            "fireflies",
            "rain",
            "flickering_stars",
            "spiders"
          ]
        },
        "file_size_max_mb": {
          "type": [
            "number",
            "null"
          ],
          "format": "float"
        },
        "file_size_min_mb": {
          "type": [
            "number",
            "null"
          ],
          "format": "float"
        },
        "forward_url_parameters": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "group_submission_max_entries": {
          "type": [
            "integer",
            "null"
          ]
        },
        "hidden_author_name": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "hidden_best_rating": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "hidden_image_name": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "hidden_participants": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "hide_options": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "hide_results": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "hide_tags": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "hide_votes": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "image_min_height": {
          "type": [
            "integer",
            "null"
          ]
        },
        "image_min_smallest_side_length": {
          "type": [
            "integer",
            "null"
          ]
        },
        "image_min_width": {
          "type": [
            "integer",
            "null"
          ]
        },
        "image_orientation": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "all",
            "portrait",
            "landscape"
          ]
        },
        "indexing": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "jury_mode": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "limit_per_option": {
          "type": [
            "integer",
            "null"
          ]
        },
        "limit_per_option_type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "no_limit",
            "global_limit",
            "uniq_limit"
          ]
        },
        "notify_new_options": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "option_limit": {
          "type": [
            "integer",
            "null"
          ]
        },
        "option_type": {
          "type": "string",
          "nullable": false,
          "enum": [
            "Options::AdventCalendarOption",
            "Options::AudioOption",
            "Options::CategorizedOption",
            "Options::CollectionOption",
            "Options::ColumnOption",
            "Options::DateOption",
            "Options::DatePeriodOption",
            "Options::DateTimeOption",
            "Options::ImageOption",
            "Options::LandingPageOption",
            "Options::PhotoOption",
            "Options::SurveyStep",
            "Options::TextOption",
            "Options::TimePeriodOption",
            "Options::VideoFileOption",
            "Options::VideoOption",
            "TableCell"
          ],
          "description": "Option class used by this poll. The values allowed for a given poll type are listed in `configuration_hints`."
        },
        "option_vote_requirement": {
          "type": "string",
          "nullable": false,
          "enum": [
            "optional",
            "single_option",
            "all_options"
          ]
        },
        "options_per_page": {
          "type": [
            "integer",
            "null"
          ]
        },
        "options_visible_before_voting": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "participant_limitation_type": {
          "type": "string",
          "nullable": false,
          "enum": [
            "check_nothing",
            "check_cookie",
            "check_ip",
            "check_account",
            "check_invitation",
            "check_slack",
            "check_anonymous_invitation",
            "check_provider",
            "check_double_opt_in"
          ]
        },
        "photo_gallery_full_width": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "photo_gallery_image_mode": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "contain",
            "cover"
          ]
        },
        "photo_gallery_layout": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "auto",
            "square",
            "portrait",
            "landscape",
            "single_column"
          ]
        },
        "prevent_vote_for_own_options": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "privacy_policy": {
          "type": [
            "string",
            "null"
          ]
        },
        "privacy_policy_for_option_creators": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "privacy_policy_for_voters": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "private_comments": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "public_admin_link": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "publisher": {
          "type": [
            "string",
            "null"
          ]
        },
        "publisher_email": {
          "type": [
            "string",
            "null"
          ]
        },
        "publisher_info": {
          "type": [
            "string",
            "null"
          ]
        },
        "randomize_options": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "rating_method": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "average_by_voted",
            "average_by_all_voters"
          ]
        },
        "require_all_dots": {
          "type": "boolean",
          "nullable": false,
          "default": false,
          "description": "Dot voting only: all available points must be assigned before a participant's votes count toward the results. Cannot be changed after participation has started. Reset to false for other vote types."
        },
        "require_approval": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "require_author_name": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "require_description": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "require_voter_name": {
          "type": "boolean",
          "nullable": false
        },
        "restrict_view_access": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "restricted_double_opt_in_domains": {
          "type": [
            "array",
            "null"
          ]
        },
        "show_as_list": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "show_metadata": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "show_photo_info_by_default": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "show_quiz_points": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Surveys with quiz steps that score points (`require_correct_answers` false) only. Shows participants their points on the thank you page and locks their quiz answers afterwards. Defaults to true."
        },
        "social_media_description": {
          "type": [
            "string",
            "null"
          ]
        },
        "social_media_image_data": {
          "type": [
            "object",
            "null"
          ]
        },
        "social_media_title": {
          "type": [
            "string",
            "null"
          ]
        },
        "start_date_submission": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "start_date_voting": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "submission_fee": {
          "type": [
            "number",
            "null"
          ],
          "format": "float"
        },
        "submission_fee_title": {
          "type": [
            "string",
            "null"
          ]
        },
        "submission_fee_type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "submission_fee",
            "submission_donation"
          ]
        },
        "target": {
          "type": "string",
          "nullable": false,
          "enum": [
            "best_option",
            "best_distribution",
            "lowest_resistance",
            "table",
            "free_table",
            "survey",
            "pairwise_comparison"
          ],
          "description": "Evaluation target. Fixed by the poll type except for `Polls::Voting`, see `configuration_hints`."
        },
        "terms": {
          "type": [
            "string",
            "null"
          ]
        },
        "terms_for_option_creators": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "terms_for_voters": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "thank_you_page": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "thank_you_page_data": {
          "type": [
            "object",
            "null"
          ]
        },
        "thank_you_page_submitter": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "thank_you_page_submitter_data": {
          "type": [
            "object",
            "null"
          ]
        },
        "timezone": {
          "type": [
            "string",
            "null"
          ]
        },
        "vote_limit_per_option": {
          "type": [
            "integer",
            "null"
          ]
        },
        "vote_limit_per_option_min": {
          "type": [
            "integer",
            "null"
          ]
        },
        "vote_limit_per_voter": {
          "type": [
            "integer",
            "null"
          ]
        },
        "vote_per_day": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "vote_type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "Votes::BooleanVote",
            "Votes::BooleanPlusVote",
            "Votes::BooleanThumbVote",
            "Votes::BooleanPlusThumbVote",
            "Votes::BooleanHeartVote",
            "Votes::RatingVote",
            "Votes::DotVote",
            "Votes::RangeVote",
            "Votes::EmojiVote",
            "Votes::SuperlativeVote",
            "Votes::CellVote",
            "Votes::ColumnVote",
            "Votes::PairwiseVote",
            "Votes::TendencyVote",
            "Votes::QuickQuestionSingleVote",
            "Votes::QuickQuestionMultiVote"
          ],
          "description": "Vote class used by this poll. The values allowed for a given poll type are listed in `configuration_hints`."
        },
        "voting_categories": {
          "type": [
            "array",
            "null"
          ],
          "description": "Voting categories: the categories or aspects by which an option can be voted. Pass a list of names when creating or updating a poll; the show response lists them as objects with `id` and `name`. If voting categories are set, a vote always needs a `voting_category_id`.",
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        },
        "voting_fee": {
          "type": [
            "number",
            "null"
          ],
          "format": "float"
        },
        "voting_fee_title": {
          "type": [
            "string",
            "null"
          ]
        },
        "voting_fee_type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "voting_fee",
            "voting_donation",
            "voting_sell_votes"
          ]
        },
        "white_label": {
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    },
    "RequiredFields": {
      "type": "array",
      "description": "Attributes the poll configuration makes mandatory when a voter or an option is created. Entries are attribute names; the last entry is an object `{ \"additional_attributes\": [...] }` listing the ids of the required additional attributes, when the poll defines any (the double opt in address is listed as `optin_email`).",
      "items": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object"
          }
        ]
      }
    }
  }
}