# Live control

HTTP requests and responses for live control.

## Control the presenter

`POST /api/v1/decks/{deckId}/control`

Move the presenter, change voting or results, moderate text, or set the display. Moving to a question does not open or close voting.

Authentication: Browser session or API key. Key scopes: poll.read, poll.live.

### Parameters

- `deckId` (path, required): `{"type":"string","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$","format":"uuid"}`

### Request schema

```json
{
  "application/json": {
    "schema": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "display"
              ]
            },
            "theme": {
              "type": "string",
              "enum": [
                "paper",
                "dark"
              ]
            },
            "qr": {
              "type": "boolean"
            },
            "qrQuestion": {
              "type": "boolean"
            },
            "textView": {
              "type": "string",
              "enum": [
                "answers",
                "cloud"
              ]
            },
            "focusQuestionId": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "action"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "go"
              ]
            },
            "questionId": {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            },
            "expectedCurrentQuestionId": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "action",
            "questionId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "open",
                "close",
                "reveal",
                "conceal"
              ]
            },
            "questionId": {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            }
          },
          "required": [
            "action",
            "questionId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "hideText",
                "showText"
              ]
            },
            "questionId": {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            },
            "responseId": {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            }
          },
          "required": [
            "action",
            "questionId",
            "responseId"
          ],
          "additionalProperties": false
        }
      ]
    },
    "example": {
      "action": "go",
      "questionId": "d021f5e3-48d1-4caf-a29d-30a14273e650"
    }
  }
}
```

### Example request

```sh
curl -sS -X POST "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/control" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"action":"go","questionId":"d021f5e3-48d1-4caf-a29d-30a14273e650"}'
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/control", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"action":"go","questionId":"d021f5e3-48d1-4caf-a29d-30a14273e650"}),
});
```

### Responses

- `200` **OK.** The request succeeded.
- `400` **Invalid.** The request doesn’t match the expected input.
- `401` **Unauthorized.** Sign in or supply a valid credential for this route.
- `403` **Forbidden.** The credential lacks permission, or the request isn’t allowed.
- `404` **Not found.** The resource doesn’t exist or isn’t available to you.
- `409` **Conflict.** The requested change conflicts with the current state or an account limit.
- `413` **Too large.** The request body exceeds the size limit.
- `429` **Rate limited.** Wait before sending more requests.
- `503` **Unavailable.** Poll Express couldn’t complete the request right now.

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "showBranding": {
          "type": "boolean"
        },
        "currentQuestionId": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "ended": {
          "type": "boolean"
        },
        "responsesExpiredAt": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "deckId": {
          "type": "string",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
          "format": "uuid"
        },
        "hasResponses": {
          "type": "boolean"
        },
        "display": {
          "type": "object",
          "properties": {
            "theme": {
              "type": "string",
              "enum": [
                "paper",
                "dark"
              ]
            },
            "qr": {
              "type": "boolean"
            },
            "qrQuestion": {
              "type": "boolean"
            },
            "textView": {
              "type": "string",
              "enum": [
                "answers",
                "cloud"
              ]
            },
            "focusQuestionId": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "additionalProperties": false
        },
        "presence": {
          "type": "object",
          "properties": {
            "displays": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "remotes": {
              "type": "object",
              "properties": {
                "phone": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "window": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "phone",
                "window"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "displays",
            "remotes"
          ],
          "additionalProperties": false
        },
        "questions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "question": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                    "format": "uuid"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "config": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "choice"
                            ]
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 160
                            },
                            "minItems": 2,
                            "maxItems": 24,
                            "uniqueItems": true
                          },
                          "maxPicks": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 24
                          }
                        },
                        "required": [
                          "type",
                          "options",
                          "maxPicks"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "scale"
                            ]
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 10
                          },
                          "lowLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          },
                          "highLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          }
                        },
                        "required": [
                          "type",
                          "max",
                          "lowLabel",
                          "highLabel"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "text"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "prompt",
                  "config"
                ],
                "additionalProperties": false
              },
              "number": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "open": {
                "type": "boolean"
              },
              "revealed": {
                "type": "boolean"
              },
              "count": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "buckets": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "average": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "text": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                      "format": "uuid"
                    },
                    "text": {
                      "type": "string"
                    },
                    "hidden": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "hidden"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "question",
              "number",
              "open",
              "revealed",
              "count",
              "buckets",
              "average",
              "text"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "title",
        "showBranding",
        "currentQuestionId",
        "pacing",
        "ended",
        "responsesExpiredAt",
        "deckId",
        "hasResponses",
        "questions"
      ],
      "additionalProperties": false
    }
  }
}
```

[Shared error details](https://poll.express/docs/api/index.md#errors)

## Get presenter state

`GET /api/v1/decks/{deckId}/presenter`

Read the on-screen results, plus display settings and presence when available.

Authentication: Browser session or API key. Key scopes: poll.read.

### Parameters

- `deckId` (path, required): `{"type":"string","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$","format":"uuid"}`

### Example request

```sh
curl -sS "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/presenter" \
  -H "Authorization: Bearer $POLL_KEY"
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/presenter", {
  credentials: "include",
});
```

### Responses

- `200` **OK.** The request succeeded.
- `400` **Invalid.** The request doesn’t match the expected input.
- `401` **Unauthorized.** Sign in or supply a valid credential for this route.
- `403` **Forbidden.** The credential lacks permission, or the request isn’t allowed.
- `404` **Not found.** The resource doesn’t exist or isn’t available to you.
- `409` **Conflict.** The requested change conflicts with the current state or an account limit.
- `413` **Too large.** The request body exceeds the size limit.
- `429` **Rate limited.** Wait before sending more requests.
- `503` **Unavailable.** Poll Express couldn’t complete the request right now.

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "showBranding": {
          "type": "boolean"
        },
        "currentQuestionId": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "ended": {
          "type": "boolean"
        },
        "responsesExpiredAt": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "deckId": {
          "type": "string",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
          "format": "uuid"
        },
        "hasResponses": {
          "type": "boolean"
        },
        "display": {
          "type": "object",
          "properties": {
            "theme": {
              "type": "string",
              "enum": [
                "paper",
                "dark"
              ]
            },
            "qr": {
              "type": "boolean"
            },
            "qrQuestion": {
              "type": "boolean"
            },
            "textView": {
              "type": "string",
              "enum": [
                "answers",
                "cloud"
              ]
            },
            "focusQuestionId": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "additionalProperties": false
        },
        "presence": {
          "type": "object",
          "properties": {
            "displays": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "remotes": {
              "type": "object",
              "properties": {
                "phone": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "window": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "phone",
                "window"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "displays",
            "remotes"
          ],
          "additionalProperties": false
        },
        "questions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "question": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                    "format": "uuid"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "config": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "choice"
                            ]
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 160
                            },
                            "minItems": 2,
                            "maxItems": 24,
                            "uniqueItems": true
                          },
                          "maxPicks": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 24
                          }
                        },
                        "required": [
                          "type",
                          "options",
                          "maxPicks"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "scale"
                            ]
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 10
                          },
                          "lowLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          },
                          "highLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          }
                        },
                        "required": [
                          "type",
                          "max",
                          "lowLabel",
                          "highLabel"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "text"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "prompt",
                  "config"
                ],
                "additionalProperties": false
              },
              "number": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "open": {
                "type": "boolean"
              },
              "revealed": {
                "type": "boolean"
              },
              "count": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "buckets": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "average": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "text": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                      "format": "uuid"
                    },
                    "text": {
                      "type": "string"
                    },
                    "hidden": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "hidden"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "question",
              "number",
              "open",
              "revealed",
              "count",
              "buckets",
              "average",
              "text"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "title",
        "showBranding",
        "currentQuestionId",
        "pacing",
        "ended",
        "responsesExpiredAt",
        "deckId",
        "hasResponses",
        "questions"
      ],
      "additionalProperties": false
    }
  }
}
```

[Shared error details](https://poll.express/docs/api/index.md#errors)

## Reset responses

`POST /api/v1/decks/{deckId}/responses/reset`

Permanently clear responses to one question or the whole poll. Voting and results visibility stay as they were.

Authentication: Browser session or API key. Key scopes: poll.read, poll.write, poll.live.

### Parameters

- `deckId` (path, required): `{"type":"string","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$","format":"uuid"}`

### Request schema

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "confirm": {
          "type": "boolean",
          "enum": [
            true
          ]
        },
        "questionId": {
          "type": "string",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
          "format": "uuid"
        }
      },
      "required": [
        "confirm"
      ],
      "additionalProperties": false
    },
    "example": {
      "confirm": true,
      "questionId": "d021f5e3-48d1-4caf-a29d-30a14273e650"
    }
  }
}
```

### Example request

```sh
curl -sS -X POST "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/responses/reset" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"confirm":true,"questionId":"d021f5e3-48d1-4caf-a29d-30a14273e650"}'
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/responses/reset", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"confirm":true,"questionId":"d021f5e3-48d1-4caf-a29d-30a14273e650"}),
});
```

### Responses

- `200` **OK.** The request succeeded.
- `400` **Invalid.** The request doesn’t match the expected input.
- `401` **Unauthorized.** Sign in or supply a valid credential for this route.
- `403` **Forbidden.** The credential lacks permission, or the request isn’t allowed.
- `404` **Not found.** The resource doesn’t exist or isn’t available to you.
- `409` **Conflict.** The requested change conflicts with the current state or an account limit.
- `413` **Too large.** The request body exceeds the size limit.
- `429` **Rate limited.** Wait before sending more requests.
- `503` **Unavailable.** Poll Express couldn’t complete the request right now.

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "showBranding": {
          "type": "boolean"
        },
        "currentQuestionId": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "ended": {
          "type": "boolean"
        },
        "responsesExpiredAt": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "deckId": {
          "type": "string",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
          "format": "uuid"
        },
        "hasResponses": {
          "type": "boolean"
        },
        "display": {
          "type": "object",
          "properties": {
            "theme": {
              "type": "string",
              "enum": [
                "paper",
                "dark"
              ]
            },
            "qr": {
              "type": "boolean"
            },
            "qrQuestion": {
              "type": "boolean"
            },
            "textView": {
              "type": "string",
              "enum": [
                "answers",
                "cloud"
              ]
            },
            "focusQuestionId": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "additionalProperties": false
        },
        "presence": {
          "type": "object",
          "properties": {
            "displays": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "remotes": {
              "type": "object",
              "properties": {
                "phone": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "window": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "phone",
                "window"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "displays",
            "remotes"
          ],
          "additionalProperties": false
        },
        "questions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "question": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                    "format": "uuid"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "config": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "choice"
                            ]
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 160
                            },
                            "minItems": 2,
                            "maxItems": 24,
                            "uniqueItems": true
                          },
                          "maxPicks": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 24
                          }
                        },
                        "required": [
                          "type",
                          "options",
                          "maxPicks"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "scale"
                            ]
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 10
                          },
                          "lowLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          },
                          "highLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          }
                        },
                        "required": [
                          "type",
                          "max",
                          "lowLabel",
                          "highLabel"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "text"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "prompt",
                  "config"
                ],
                "additionalProperties": false
              },
              "number": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "open": {
                "type": "boolean"
              },
              "revealed": {
                "type": "boolean"
              },
              "count": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "buckets": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "average": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "text": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                      "format": "uuid"
                    },
                    "text": {
                      "type": "string"
                    },
                    "hidden": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "hidden"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "question",
              "number",
              "open",
              "revealed",
              "count",
              "buckets",
              "average",
              "text"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "title",
        "showBranding",
        "currentQuestionId",
        "pacing",
        "ended",
        "responsesExpiredAt",
        "deckId",
        "hasResponses",
        "questions"
      ],
      "additionalProperties": false
    }
  }
}
```

[Shared error details](https://poll.express/docs/api/index.md#errors)

## End a poll

`POST /api/v1/decks/{deckId}/end`

Close voting on every question and stop Live pacing. Existing responses stay available.

Authentication: Browser session or API key. Key scopes: poll.read, poll.live.

### Parameters

- `deckId` (path, required): `{"type":"string","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$","format":"uuid"}`

### Request schema

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "confirm": {
          "type": "boolean",
          "enum": [
            true
          ]
        }
      },
      "required": [
        "confirm"
      ],
      "additionalProperties": false
    },
    "example": {
      "confirm": true
    }
  }
}
```

### Example request

```sh
curl -sS -X POST "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/end" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"confirm":true}'
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/end", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"confirm":true}),
});
```

### Responses

- `200` **OK.** The request succeeded.
- `400` **Invalid.** The request doesn’t match the expected input.
- `401` **Unauthorized.** Sign in or supply a valid credential for this route.
- `403` **Forbidden.** The credential lacks permission, or the request isn’t allowed.
- `404` **Not found.** The resource doesn’t exist or isn’t available to you.
- `409` **Conflict.** The requested change conflicts with the current state or an account limit.
- `413` **Too large.** The request body exceeds the size limit.
- `429` **Rate limited.** Wait before sending more requests.
- `503` **Unavailable.** Poll Express couldn’t complete the request right now.

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "showBranding": {
          "type": "boolean"
        },
        "currentQuestionId": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "ended": {
          "type": "boolean"
        },
        "responsesExpiredAt": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "deckId": {
          "type": "string",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
          "format": "uuid"
        },
        "hasResponses": {
          "type": "boolean"
        },
        "display": {
          "type": "object",
          "properties": {
            "theme": {
              "type": "string",
              "enum": [
                "paper",
                "dark"
              ]
            },
            "qr": {
              "type": "boolean"
            },
            "qrQuestion": {
              "type": "boolean"
            },
            "textView": {
              "type": "string",
              "enum": [
                "answers",
                "cloud"
              ]
            },
            "focusQuestionId": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "additionalProperties": false
        },
        "presence": {
          "type": "object",
          "properties": {
            "displays": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "remotes": {
              "type": "object",
              "properties": {
                "phone": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "window": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "phone",
                "window"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "displays",
            "remotes"
          ],
          "additionalProperties": false
        },
        "questions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "question": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                    "format": "uuid"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "config": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "choice"
                            ]
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 160
                            },
                            "minItems": 2,
                            "maxItems": 24,
                            "uniqueItems": true
                          },
                          "maxPicks": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 24
                          }
                        },
                        "required": [
                          "type",
                          "options",
                          "maxPicks"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "scale"
                            ]
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 10
                          },
                          "lowLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          },
                          "highLabel": {
                            "type": "string",
                            "minLength": 0,
                            "maxLength": 100
                          }
                        },
                        "required": [
                          "type",
                          "max",
                          "lowLabel",
                          "highLabel"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "text"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "prompt",
                  "config"
                ],
                "additionalProperties": false
              },
              "number": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "open": {
                "type": "boolean"
              },
              "revealed": {
                "type": "boolean"
              },
              "count": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "buckets": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "average": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "text": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
                      "format": "uuid"
                    },
                    "text": {
                      "type": "string"
                    },
                    "hidden": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "hidden"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "question",
              "number",
              "open",
              "revealed",
              "count",
              "buckets",
              "average",
              "text"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "title",
        "showBranding",
        "currentQuestionId",
        "pacing",
        "ended",
        "responsesExpiredAt",
        "deckId",
        "hasResponses",
        "questions"
      ],
      "additionalProperties": false
    }
  }
}
```

[Shared error details](https://poll.express/docs/api/index.md#errors)
