{"components":{"responses":{"forbidden":{"content":{"application/json":{"example":{"errors":{"details":"Forbidden"}},"schema":{"type":"object"}}},"description":"Forbidden"},"no_content":{"description":"No Content"},"not_found":{"content":{"application/json":{"example":{"errors":{"details":"Not Found"}},"schema":{"type":"object"}}},"description":"Not Found"},"unauthorised":{"content":{"application/json":{"example":{"errors":{"details":"Unauthorised"}},"schema":{"type":"object"}}},"description":"Unauthorised"},"unprocessable_entity":{"content":{"application/json":{"example":{"errors":{"details":"Unprocessable Entity"}},"schema":{"type":"object"}}},"description":"Unprocessable Entity"}},"schemas":{"OkResponse":{"description":"Simple ok boolean response","example":{"ok":true},"properties":{"ok":{"description":"Operation completed successfully","type":"boolean"}},"required":["ok"],"title":"OkResponse","type":"object"},"Poll":{"description":"Public poll with questions and options","properties":{"branding":{"description":"false when the owner hid Indie Polls branding","type":"boolean"},"custom_css":{"description":"The owner's own stylesheet, applied inside the widget's shadow root","nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"ends_at":{"format":"date_time","nullable":true,"type":"string"},"intro_heading":{"nullable":true,"type":"string"},"intro_text":{"nullable":true,"type":"string"},"logo_url":{"description":"Owner's logo shown in the widget","nullable":true,"type":"string"},"outro_heading":{"nullable":true,"type":"string"},"outro_text":{"nullable":true,"type":"string"},"public_token":{"type":"string"},"questions":{"items":{"$ref":"#/components/schemas/PollQuestion"},"type":"array"},"starts_at":{"format":"date_time","nullable":true,"type":"string"},"status":{"type":"string"},"target_devices":{"description":"The kinds of device the survey shows on; empty means every kind","items":{"enum":["desktop","mobile","tablet"],"type":"string"},"type":"array"},"targeting_rules":{"description":"Conditions on the embed's respondent attributes, all of which must hold. Empty below Max","items":{"$ref":"#/components/schemas/TargetingRule"},"type":"array"},"title":{"type":"string"},"trigger_event":{"description":"An event the host page must send with IndiePolls.track() before the survey shows; null means none","nullable":true,"type":"string"},"trigger_event_count":{"description":"How many times this visitor must have sent trigger_event before the survey shows","minimum":1,"type":"integer"},"website_domain":{"nullable":true,"type":"string"},"widget_layout":{"description":"The shape the embed takes: slide_in, modal, banner or inline","type":"string"},"widget_paths":{"items":{"type":"string"},"type":"array"}},"required":["title","status","public_token","questions"],"title":"Poll","type":"object"},"PollOption":{"description":"An option inside a poll question","properties":{"id":{"type":"integer"},"image":{"nullable":true,"type":"string"},"label_text":{"type":"string"},"order":{"type":"integer"}},"required":["id","label_text","order"],"title":"PollOption","type":"object"},"PollQuestion":{"description":"A question in a poll","properties":{"id":{"type":"integer"},"image":{"nullable":true,"type":"string"},"multiple_max_choices":{"nullable":true,"type":"integer"},"options":{"items":{"$ref":"#/components/schemas/PollOption"},"type":"array"},"order":{"type":"integer"},"prompt_text":{"type":"string"},"rating_max":{"description":"How many points a rating question offers; null for every other type","nullable":true,"type":"integer"},"type":{"type":"string"}},"required":["id","type","prompt_text","order","options"],"title":"PollQuestion","type":"object"},"PollResults":{"description":"Aggregated poll results","properties":{"description":{"nullable":true,"type":"string"},"public_token":{"type":"string"},"questions":{"items":{"$ref":"#/components/schemas/PollResultsQuestion"},"type":"array"},"title":{"type":"string"},"total_responses":{"type":"integer"}},"required":["title","public_token","total_responses","questions"],"title":"PollResults","type":"object"},"PollResultsOption":{"description":"Option with aggregated votes","properties":{"id":{"type":"integer"},"label_text":{"type":"string"},"order":{"type":"integer"},"votes_count":{"type":"integer"}},"required":["id","label_text","order","votes_count"],"title":"PollResultsOption","type":"object"},"PollResultsQuestion":{"description":"Question with aggregated responses","properties":{"id":{"type":"integer"},"options":{"items":{"$ref":"#/components/schemas/PollResultsOption"},"type":"array"},"order":{"type":"integer"},"prompt_text":{"type":"string"},"responses_count":{"type":"integer"},"type":{"type":"string"}},"required":["id","prompt_text","type","order","responses_count","options"],"title":"PollResultsQuestion","type":"object"},"TargetingRule":{"description":"One condition on a respondent attribute the embed passes in data-attributes","properties":{"attribute":{"description":"The attribute's key, e.g. plan","type":"string"},"operator":{"enum":["is","is_not","contains","greater_than","less_than","is_set","is_not_set"],"type":"string"},"value":{"description":"What to compare with; a number for greater_than and less_than, null for is_set and is_not_set","nullable":true,"type":"string"}},"required":["attribute","operator","value"],"title":"TargetingRule","type":"object"}},"securitySchemes":{"authorization":{"scheme":"bearer","type":"http"}}},"info":{"title":"Indie Polls API","version":"1.0"},"openapi":"3.0.0","paths":{"/api/polls/{token}":{"get":{"callbacks":{},"description":"Returns poll title, description and questions/options if the poll is active right now.","operationId":"IndiePollsApi.PollsController.show","parameters":[{"description":"Poll public token","in":"path","name":"token","required":true,"schema":{"type":"string"}},{"description":"If provided, the API will return 409 if this user already submitted this poll","in":"query","name":"external_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Poll"}}},"description":"Poll"},"404":{"$ref":"#/components/responses/not_found"}},"summary":"Get public poll by token","tags":["POLLS"]},"post":{"callbacks":{},"description":"Submit answers for a public poll. Requires the poll to be active.","operationId":"IndiePollsApi.PollsController.submit","parameters":[{"description":"Poll public token","in":"path","name":"token","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}},"description":"Submitted"},"404":{"$ref":"#/components/responses/not_found"},"422":{"$ref":"#/components/responses/unprocessable_entity"}},"summary":"Submit poll answers","tags":["POLLS"]}},"/api/polls/{token}/results":{"get":{"callbacks":{},"description":"Returns aggregated results for a poll if show_results_public is true.","operationId":"IndiePollsApi.PollsController.result","parameters":[{"description":"Poll public token","in":"path","name":"token","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PollResults"}}},"description":"Poll Results"},"404":{"$ref":"#/components/responses/not_found"}},"summary":"Get poll results","tags":["POLLS"]}}},"security":[],"servers":[{"url":"https://indiepolls.io","variables":{}}],"tags":[]}