# Polls

A poll holds questions, a join code and settings. In the API it’s called a deck.

## List polls

`GET /api/v1/decks`

List your polls with question counts and recent response totals.

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

### Example request

```sh
curl -sS "https://poll.express/api/v1/decks" \
  -H "Authorization: Bearer $POLL_KEY"
```

Browser session:

```js
const response = await fetch("/api/v1/decks", {
  credentials: "include",
});
```

### Example response

```json
[]
```

### 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"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "code": {
            "type": "string"
          },
          "pacing": {
            "type": "string",
            "enum": [
              "live",
              "self"
            ]
          },
          "questionCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "totalResponses": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastResponseAt": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "title",
          "code",
          "pacing",
          "questionCount",
          "totalResponses",
          "lastResponseAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    },
    "example": []
  }
}
```

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

## Create a poll

`POST /api/v1/decks`

Create a poll with optional questions. An empty draft cannot receive answers. New polls have results links enabled by default.

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

### Request schema

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "showResultsToVoters": {
          "type": "string",
          "enum": [
            "never",
            "afterVote",
            "afterClose"
          ]
        },
        "allowChange": {
          "type": "boolean"
        },
        "showBranding": {
          "type": "boolean"
        },
        "shareResults": {
          "type": "boolean"
        },
        "questions": {
          "type": "array",
          "items": {
            "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
          },
          "maxItems": 40
        }
      },
      "additionalProperties": false
    },
    "example": {
      "title": "Workshop check-in",
      "questions": [
        {
          "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" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"title":"Workshop check-in","questions":[{"prompt":"What should we cover next?","config":{"type":"choice","options":["Examples","Questions"]}}]}'
```

Browser session:

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

### Example response

```json
{
  "id": "6b114677-7751-4930-a2da-31fcad879038",
  "title": "Workshop check-in",
  "code": "K7RD4M",
  "resultsKey": "EXAMPLE_RESULTS_KEY_DO_NOT_REUSE",
  "pacing": "live",
  "showResultsToVoters": "afterVote",
  "allowChange": true,
  "showBranding": true,
  "shareResults": true,
  "createdAt": 1795620000000,
  "updatedAt": 1795620000000,
  "responsesExpiredAt": null,
  "questions": [
    {
      "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": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "showResultsToVoters": {
          "type": "string",
          "enum": [
            "never",
            "afterVote",
            "afterClose"
          ]
        },
        "allowChange": {
          "type": "boolean"
        },
        "showBranding": {
          "type": "boolean"
        },
        "shareResults": {
          "type": "boolean"
        },
        "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"
        },
        "code": {
          "type": "string"
        },
        "resultsKey": {
          "type": "string"
        },
        "createdAt": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "updatedAt": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "responsesExpiredAt": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "questions": {
          "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
          }
        }
      },
      "required": [
        "title",
        "pacing",
        "showResultsToVoters",
        "allowChange",
        "showBranding",
        "shareResults",
        "id",
        "code",
        "resultsKey",
        "createdAt",
        "updatedAt",
        "responsesExpiredAt",
        "questions"
      ],
      "additionalProperties": false
    },
    "example": {
      "id": "6b114677-7751-4930-a2da-31fcad879038",
      "title": "Workshop check-in",
      "code": "K7RD4M",
      "resultsKey": "EXAMPLE_RESULTS_KEY_DO_NOT_REUSE",
      "pacing": "live",
      "showResultsToVoters": "afterVote",
      "allowChange": true,
      "showBranding": true,
      "shareResults": true,
      "createdAt": 1795620000000,
      "updatedAt": 1795620000000,
      "responsesExpiredAt": null,
      "questions": [
        {
          "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 sharing links

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

Read join, QR and results links. Shared results URLs are null when sharing is off. Owner download URLs still require a browser session.

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

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038/links", {
  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": {
        "joinUrl": {
          "type": "string"
        },
        "resultsUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "embedUrls": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "paper": {
                  "type": "string"
                },
                "dark": {
                  "type": "string"
                },
                "transparent": {
                  "type": "string"
                }
              },
              "required": [
                "paper",
                "dark",
                "transparent"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "csvUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "jsonUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "downloadCsvUrl": {
          "type": "string"
        },
        "downloadJsonUrl": {
          "type": "string"
        },
        "qrSvgUrl": {
          "type": "string"
        },
        "qrPngUrl": {
          "type": "string"
        },
        "iframe": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "code": {
          "type": "string"
        },
        "displayCode": {
          "type": "string"
        },
        "presenterUrl": {
          "type": "string"
        },
        "questions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "joinUrl": {
                "type": "string"
              },
              "resultsUrl": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "embedUrls": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "paper": {
                        "type": "string"
                      },
                      "dark": {
                        "type": "string"
                      },
                      "transparent": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "paper",
                      "dark",
                      "transparent"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "csvUrl": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "jsonUrl": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "downloadCsvUrl": {
                "type": "string"
              },
              "downloadJsonUrl": {
                "type": "string"
              },
              "qrSvgUrl": {
                "type": "string"
              },
              "qrPngUrl": {
                "type": "string"
              },
              "iframe": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "position": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "prompt": {
                "type": "string"
              }
            },
            "required": [
              "joinUrl",
              "resultsUrl",
              "embedUrls",
              "csvUrl",
              "jsonUrl",
              "downloadCsvUrl",
              "downloadJsonUrl",
              "qrSvgUrl",
              "qrPngUrl",
              "iframe",
              "position",
              "prompt"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "joinUrl",
        "resultsUrl",
        "embedUrls",
        "csvUrl",
        "jsonUrl",
        "downloadCsvUrl",
        "downloadJsonUrl",
        "qrSvgUrl",
        "qrPngUrl",
        "iframe",
        "code",
        "displayCode",
        "presenterUrl",
        "questions"
      ],
      "additionalProperties": false
    }
  }
}
```

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

## Rotate results links

`POST /api/v1/decks/{deckId}/results-link/rotate`

Replace all shared results, embed and feed URLs. The old links stop working. The join code stays the same.

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
          ]
        }
      },
      "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/results-link/rotate" \
  -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/results-link/rotate", {
  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": {
        "joinUrl": {
          "type": "string"
        },
        "resultsUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "embedUrls": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "paper": {
                  "type": "string"
                },
                "dark": {
                  "type": "string"
                },
                "transparent": {
                  "type": "string"
                }
              },
              "required": [
                "paper",
                "dark",
                "transparent"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "csvUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "jsonUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "downloadCsvUrl": {
          "type": "string"
        },
        "downloadJsonUrl": {
          "type": "string"
        },
        "qrSvgUrl": {
          "type": "string"
        },
        "qrPngUrl": {
          "type": "string"
        },
        "iframe": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "code": {
          "type": "string"
        },
        "displayCode": {
          "type": "string"
        },
        "presenterUrl": {
          "type": "string"
        },
        "questions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "joinUrl": {
                "type": "string"
              },
              "resultsUrl": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "embedUrls": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "paper": {
                        "type": "string"
                      },
                      "dark": {
                        "type": "string"
                      },
                      "transparent": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "paper",
                      "dark",
                      "transparent"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "csvUrl": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "jsonUrl": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "downloadCsvUrl": {
                "type": "string"
              },
              "downloadJsonUrl": {
                "type": "string"
              },
              "qrSvgUrl": {
                "type": "string"
              },
              "qrPngUrl": {
                "type": "string"
              },
              "iframe": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "position": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "prompt": {
                "type": "string"
              }
            },
            "required": [
              "joinUrl",
              "resultsUrl",
              "embedUrls",
              "csvUrl",
              "jsonUrl",
              "downloadCsvUrl",
              "downloadJsonUrl",
              "qrSvgUrl",
              "qrPngUrl",
              "iframe",
              "position",
              "prompt"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "joinUrl",
        "resultsUrl",
        "embedUrls",
        "csvUrl",
        "jsonUrl",
        "downloadCsvUrl",
        "downloadJsonUrl",
        "qrSvgUrl",
        "qrPngUrl",
        "iframe",
        "code",
        "displayCode",
        "presenterUrl",
        "questions"
      ],
      "additionalProperties": false
    }
  }
}
```

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

## Get a poll

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

Read one poll’s settings and 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" \
  -H "Authorization: Bearer $POLL_KEY"
```

Browser session:

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

### Example response

```json
{
  "id": "6b114677-7751-4930-a2da-31fcad879038",
  "title": "Workshop check-in",
  "code": "K7RD4M",
  "resultsKey": "EXAMPLE_RESULTS_KEY_DO_NOT_REUSE",
  "pacing": "live",
  "showResultsToVoters": "afterVote",
  "allowChange": true,
  "showBranding": true,
  "shareResults": true,
  "createdAt": 1795620000000,
  "updatedAt": 1795620000000,
  "responsesExpiredAt": null,
  "questions": [
    {
      "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": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "showResultsToVoters": {
          "type": "string",
          "enum": [
            "never",
            "afterVote",
            "afterClose"
          ]
        },
        "allowChange": {
          "type": "boolean"
        },
        "showBranding": {
          "type": "boolean"
        },
        "shareResults": {
          "type": "boolean"
        },
        "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"
        },
        "code": {
          "type": "string"
        },
        "resultsKey": {
          "type": "string"
        },
        "createdAt": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "updatedAt": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "responsesExpiredAt": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "questions": {
          "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
          }
        }
      },
      "required": [
        "title",
        "pacing",
        "showResultsToVoters",
        "allowChange",
        "showBranding",
        "shareResults",
        "id",
        "code",
        "resultsKey",
        "createdAt",
        "updatedAt",
        "responsesExpiredAt",
        "questions"
      ],
      "additionalProperties": false
    },
    "example": {
      "id": "6b114677-7751-4930-a2da-31fcad879038",
      "title": "Workshop check-in",
      "code": "K7RD4M",
      "resultsKey": "EXAMPLE_RESULTS_KEY_DO_NOT_REUSE",
      "pacing": "live",
      "showResultsToVoters": "afterVote",
      "allowChange": true,
      "showBranding": true,
      "shareResults": true,
      "createdAt": 1795620000000,
      "updatedAt": 1795620000000,
      "responsesExpiredAt": null,
      "questions": [
        {
          "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)

## Update a poll

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

Change only the settings you send. Turning sharing back on restores the old URLs unless you rotate the results link first.

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

Changing settings other than the title also requires `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": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "showResultsToVoters": {
          "type": "string",
          "enum": [
            "never",
            "afterVote",
            "afterClose"
          ]
        },
        "allowChange": {
          "type": "boolean"
        },
        "showBranding": {
          "type": "boolean"
        },
        "shareResults": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "example": {
      "title": "Workshop Q&A"
    }
  }
}
```

### Example request

```sh
curl -sS -X PATCH "https://poll.express/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038" \
  -H "Authorization: Bearer $POLL_KEY" \
  -H "Content-Type: application/json" \
  --data '{"title":"Workshop Q&A"}'
```

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038", {
  method: "PATCH",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"title":"Workshop Q&A"}),
});
```

### Example response

```json
{
  "id": "6b114677-7751-4930-a2da-31fcad879038",
  "title": "Workshop Q&A",
  "code": "K7RD4M",
  "resultsKey": "EXAMPLE_RESULTS_KEY_DO_NOT_REUSE",
  "pacing": "live",
  "showResultsToVoters": "afterVote",
  "allowChange": true,
  "showBranding": true,
  "shareResults": true,
  "createdAt": 1795620000000,
  "updatedAt": 1795620000000,
  "responsesExpiredAt": null,
  "questions": [
    {
      "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": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "pacing": {
          "type": "string",
          "enum": [
            "live",
            "self"
          ]
        },
        "showResultsToVoters": {
          "type": "string",
          "enum": [
            "never",
            "afterVote",
            "afterClose"
          ]
        },
        "allowChange": {
          "type": "boolean"
        },
        "showBranding": {
          "type": "boolean"
        },
        "shareResults": {
          "type": "boolean"
        },
        "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"
        },
        "code": {
          "type": "string"
        },
        "resultsKey": {
          "type": "string"
        },
        "createdAt": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "updatedAt": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "responsesExpiredAt": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "questions": {
          "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
          }
        }
      },
      "required": [
        "title",
        "pacing",
        "showResultsToVoters",
        "allowChange",
        "showBranding",
        "shareResults",
        "id",
        "code",
        "resultsKey",
        "createdAt",
        "updatedAt",
        "responsesExpiredAt",
        "questions"
      ],
      "additionalProperties": false
    },
    "example": {
      "id": "6b114677-7751-4930-a2da-31fcad879038",
      "title": "Workshop Q&A",
      "code": "K7RD4M",
      "resultsKey": "EXAMPLE_RESULTS_KEY_DO_NOT_REUSE",
      "pacing": "live",
      "showResultsToVoters": "afterVote",
      "allowChange": true,
      "showBranding": true,
      "shareResults": true,
      "createdAt": 1795620000000,
      "updatedAt": 1795620000000,
      "responsesExpiredAt": null,
      "questions": [
        {
          "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)

## Delete a poll

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

Permanently delete the poll and its responses. Its join and results links stop working.

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"}`

### Example request

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

Browser session:

```js
const response = await fetch("/api/v1/decks/6b114677-7751-4930-a2da-31fcad879038", {
  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)
