# Questions

HTTP requests and responses for questions.

## List questions

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

List a poll’s questions in presentation order.

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/questions" \
  -H "Authorization: Bearer $POLL_KEY"
```

Browser session:

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

### Example response

```json
[
  {
    "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
    "prompt": "What should we cover next?",
    "config": {
      "type": "choice",
      "options": [
        "Examples",
        "Questions"
      ],
      "maxPicks": 1
    }
  }
]
```

### 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": "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"
          },
          "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
      }
    },
    "example": [
      {
        "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
        "prompt": "What should we cover next?",
        "config": {
          "type": "choice",
          "options": [
            "Examples",
            "Questions"
          ],
          "maxPicks": 1
        }
      }
    ]
  }
}
```

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

## Add a question

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

Add a choice, scale or short-text question at the end of the poll.

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

### 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": {
        "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"
              ],
              "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"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text"
                  ]
                }
              },
              "required": [
                "type"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "prompt",
        "config"
      ],
      "additionalProperties": false
    },
    "example": {
      "prompt": "What should we cover next?",
      "config": {
        "type": "choice",
        "options": [
          "Examples",
          "Questions"
        ]
      }
    }
  }
}
```

### Example request

```sh
curl -sS -X POST "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"prompt":"What should we cover next?","config":{"type":"choice","options":["Examples","Questions"]}}'
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"prompt":"What should we cover next?","config":{"type":"choice","options":["Examples","Questions"]}}),
});
```

### Example response

```json
{
  "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
  "prompt": "What should we cover next?",
  "config": {
    "type": "choice",
    "options": [
      "Examples",
      "Questions"
    ],
    "maxPicks": 1
  }
}
```

### Responses

- `201` **Created.** The request created a resource.
- `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": {
        "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
    },
    "example": {
      "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
      "prompt": "What should we cover next?",
      "config": {
        "type": "choice",
        "options": [
          "Examples",
          "Questions"
        ],
        "maxPicks": 1
      }
    }
  }
}
```

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

## Reorder questions

`PATCH /api/v1/decks/{deckId}/questions/order`

Send every current question ID once. Confirm a change of order when the poll has responses. Numbered links follow the new order.

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

### 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": {
        "questionIds": {
          "type": "array",
          "items": {
            "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"
          },
          "maxItems": 40
        },
        "expectedQuestionIds": {
          "type": "array",
          "items": {
            "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"
          },
          "maxItems": 40
        },
        "confirm": {
          "type": "boolean",
          "enum": [
            true
          ]
        }
      },
      "required": [
        "questionIds"
      ],
      "additionalProperties": false
    },
    "example": {
      "questionIds": [
        "d021f5e3-48d1-4caf-a29d-30a14273e650"
      ],
      "confirm": true
    }
  }
}
```

### Example request

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

Browser session:

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

### Example response

```json
[
  {
    "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
    "prompt": "What should we cover next?",
    "config": {
      "type": "choice",
      "options": [
        "Examples",
        "Questions"
      ],
      "maxPicks": 1
    }
  }
]
```

### 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": "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"
          },
          "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
      }
    },
    "example": [
      {
        "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
        "prompt": "What should we cover next?",
        "config": {
          "type": "choice",
          "options": [
            "Examples",
            "Questions"
          ],
          "maxPicks": 1
        }
      }
    ]
  }
}
```

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

## Get a question

`GET /api/v1/decks/{deckId}/questions/{questionId}`

Read a question’s wording and configuration by ID.

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"}`
- `questionId` (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/questions/d021f5e3-48d1-4caf-a29d-30a14273e650" \
  -H "Authorization: Bearer $POLL_KEY"
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions/d021f5e3-48d1-4caf-a29d-30a14273e650", {
  credentials: "include",
});
```

### Example response

```json
{
  "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
  "prompt": "What should we cover next?",
  "config": {
    "type": "choice",
    "options": [
      "Examples",
      "Questions"
    ],
    "maxPicks": 1
  }
}
```

### 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": {
        "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
    },
    "example": {
      "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
      "prompt": "What should we cover next?",
      "config": {
        "type": "choice",
        "options": [
          "Examples",
          "Questions"
        ],
        "maxPicks": 1
      }
    }
  }
}
```

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

## Replace a question

`PUT /api/v1/decks/{deckId}/questions/{questionId}`

Structural edits are blocked after a response is recorded. Close voting if needed and reset responses before replacing the structure.

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

### 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"}`
- `questionId` (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": {
        "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"
              ],
              "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"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text"
                  ]
                }
              },
              "required": [
                "type"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "prompt",
        "config"
      ],
      "additionalProperties": false
    },
    "example": {
      "prompt": "What should we cover next?",
      "config": {
        "type": "choice",
        "options": [
          "Examples",
          "Questions"
        ]
      }
    }
  }
}
```

### Example request

```sh
curl -sS -X PUT "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions/d021f5e3-48d1-4caf-a29d-30a14273e650" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"prompt":"What should we cover next?","config":{"type":"choice","options":["Examples","Questions"]}}'
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions/d021f5e3-48d1-4caf-a29d-30a14273e650", {
  method: "PUT",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"prompt":"What should we cover next?","config":{"type":"choice","options":["Examples","Questions"]}}),
});
```

### Example response

```json
{
  "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
  "prompt": "What should we cover next?",
  "config": {
    "type": "choice",
    "options": [
      "Examples",
      "Questions"
    ],
    "maxPicks": 1
  }
}
```

### 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": {
        "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
    },
    "example": {
      "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
      "prompt": "What should we cover next?",
      "config": {
        "type": "choice",
        "options": [
          "Examples",
          "Questions"
        ],
        "maxPicks": 1
      }
    }
  }
}
```

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

## Edit question wording

`PATCH /api/v1/decks/{deckId}/questions/{questionId}`

Change a prompt, choice labels by zero-based index, or scale end labels without clearing responses.

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

### 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"}`
- `questionId` (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": {
        "prompt": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "optionLabels": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "index": {
                "type": "integer",
                "minimum": 0,
                "maximum": 23
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              }
            },
            "required": [
              "index",
              "label"
            ],
            "additionalProperties": false
          },
          "minItems": 1,
          "maxItems": 24
        },
        "lowLabel": {
          "type": "string",
          "minLength": 0,
          "maxLength": 100
        },
        "highLabel": {
          "type": "string",
          "minLength": 0,
          "maxLength": 100
        }
      },
      "additionalProperties": false,
      "minProperties": 1
    },
    "example": {
      "optionLabels": [
        {
          "index": 0,
          "label": "Worked examples"
        }
      ]
    }
  }
}
```

### Example request

```sh
curl -sS -X PATCH "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions/d021f5e3-48d1-4caf-a29d-30a14273e650" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"optionLabels":[{"index":0,"label":"Worked examples"}]}'
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions/d021f5e3-48d1-4caf-a29d-30a14273e650", {
  method: "PATCH",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"optionLabels":[{"index":0,"label":"Worked examples"}]}),
});
```

### Example response

```json
{
  "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
  "prompt": "What should we cover next?",
  "config": {
    "type": "choice",
    "options": [
      "Worked examples",
      "Questions"
    ],
    "maxPicks": 1
  }
}
```

### 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": {
        "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
    },
    "example": {
      "id": "d021f5e3-48d1-4caf-a29d-30a14273e650",
      "prompt": "What should we cover next?",
      "config": {
        "type": "choice",
        "options": [
          "Worked examples",
          "Questions"
        ],
        "maxPicks": 1
      }
    }
  }
}
```

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

## Delete a question

`DELETE /api/v1/decks/{deckId}/questions/{questionId}`

Delete a question and its responses. Existing numbered links may now point somewhere else.

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

### 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"}`
- `questionId` (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 -X DELETE "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions/d021f5e3-48d1-4caf-a29d-30a14273e650" \
  -H "Authorization: Bearer $POLL_KEY"
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/questions/d021f5e3-48d1-4caf-a29d-30a14273e650", {
  method: "DELETE",
  credentials: "include",
});
```

### Responses

- `204` **No content.** The request succeeded and returns no body.
- `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.

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