> ## Documentation Index
> Fetch the complete documentation index at: https://docs.askplane.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a session

> Title required. Optional first poll stays `draft` until open.
Returns `{ id, k, code }`. Keep `k` secret.




## OpenAPI

````yaml /openapi.yaml post /api/sessions
openapi: 3.1.0
info:
  title: Askplane Session API
  version: 0.0.1
  summary: Same /api/sessions/* routes the web app and PowerPoint add-in already call.
  description: >
    Contract for web, the PowerPoint pane, and a later MCP wrapper. **Not a
    second API.**

    Same `/api/sessions/*` routes: no versioned second surface.


    Host auth (any one): cookie `ws_host`, `Authorization: Bearer` (same HMAC as
    the cookie),

    or per-room host key `k` (`?k=` or JSON `k`). Mint a Bearer with `POST
    /api/me/token`

    (cookie only). Logout does not revoke it.


    Audience: join once, then cookie `ws_part`. Room cap is **200**
    (`ROOM_CAP`).

    Create leaves a poll in `draft` until open.


    Mintlify reads this file from `mintlify/docs.json` (`api.openapi` + Session
    API tab).
  contact:
    name: Askplane
    url: https://www.askplane.com
servers:
  - url: https://www.askplane.com
    description: Production
  - url: http://localhost:3000
    description: Local
security:
  - bearerAuth: []
  - cookieAuth: []
tags:
  - name: Sessions
    description: Create, list, update, end, export.
  - name: Polls
    description: Draft, open, close. One live poll at a time.
  - name: Audience
    description: Join, vote, ask.
  - name: Questions
    description: Host moderate (approve, highlight, hide, unpin).
  - name: Auth
    description: Cookie-only Bearer mint.
paths:
  /api/sessions:
    post:
      tags:
        - Sessions
      summary: Create a session
      description: |
        Title required. Optional first poll stays `draft` until open.
        Returns `{ id, k, code }`. Keep `k` secret.
      operationId: createSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionBody'
      responses:
        '200':
          description: Created session plus host key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionCreated'
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
      security:
        - bearerAuth: []
        - cookieAuth: []
components:
  schemas:
    CreateSessionBody:
      type: object
      required:
        - title
      properties:
        title:
          type: string
        prompt:
          type: string
          description: If set, creates a draft poll.
        options:
          type: array
          items:
            type: string
          description: 2–8 labels when the kind needs options.
        kind:
          $ref: '#/components/schemas/PollKind'
        correctIndex:
          type: integer
          description: Quiz key index into `options`.
        tz:
          type: string
          description: IANA TZ. Default UTC. Session auto-ends at that EOD.
        k:
          type: string
    SessionCreated:
      type: object
      required:
        - id
        - k
        - code
      properties:
        id:
          type: string
          format: uuid
        k:
          type: string
          description: Host key. Treat as a secret.
        code:
          type: string
          description: 5-char join code.
    PollKind:
      type: string
      enum:
        - multiple_choice
        - word_cloud
        - quiz
        - rating
        - open_text
        - ranking
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  responses:
    Error:
      description: '{ error } plus HTTP status. asJson strips ok.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Same HMAC as cookie `ws_host`. Mint via `POST /api/me/token`.
    cookieAuth:
      type: apiKey
      in: cookie
      name: ws_host
      description: Browser host cookie after login.

````