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

# Update Discussion



## OpenAPI

````yaml /openapi/mio-openapi.json patch /api/v1/discussions/{discussion_id}
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/discussions/{discussion_id}:
    patch:
      tags:
        - community-discussions
      summary: Update Discussion
      operationId: >-
        community_discussions.patch_community_discussions_patch_discussions_by_discussion_id
      parameters:
        - in: path
          name: discussion_id
          required: true
          schema:
            title: Discussion Id
            type: string
        - in: query
          name: hub_id
          required: true
          schema:
            title: Hub Id
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              additionalProperties: true
              description: JSON:API partial-update envelope.
              properties:
                data:
                  properties:
                    attributes:
                      description: >-
                        Partial update — send only the fields you want to
                        change. title/body/attachments/external_video_embeds are
                        accepted here but not schema-documented (see this
                        endpoint's docstring); `poll` is fully documented below.
                      properties:
                        poll:
                          anyOf:
                            - additionalProperties: false
                              description: >-
                                A poll object: ``options`` is a list of 2-10
                                plain string labels

                                (each 1-280 characters after trimming
                                surrounding whitespace; blank or

                                whitespace-only labels and embedded NUL bytes
                                are rejected).

                                ``duration_days`` is an integer from 1 to 7 —
                                the poll closes that many

                                days after it is created. No other fields are
                                accepted. This shape is

                                used both to create a poll and, on an existing
                                discussion, to submit a

                                poll where the discussion does not already have
                                one — see the

                                ``poll`` field description on the discussion
                                create/edit endpoints for

                                the full mutation contract.
                              properties:
                                duration_days:
                                  maximum: 7
                                  minimum: 1
                                  title: Duration Days
                                  type: integer
                                options:
                                  items:
                                    description: >-
                                      The server trims surrounding whitespace
                                      before validating and persists the TRIMMED
                                      value — a label consisting only of
                                      whitespace (or empty) is rejected, and
                                      embedded NUL (\u0000) bytes are rejected.
                                      `maxLength` is measured against this RAW
                                      (untrimmed) value, not the trimmed one: a
                                      label padded with leading/trailing
                                      whitespace whose RAW length exceeds 280
                                      but TRIMMED length does not is a known,
                                      intentionally conservative case where this
                                      schema rejects an instance the server
                                      actually accepts (there is no schema
                                      keyword that can express 'trim, then
                                      measure').
                                    maxLength: 280
                                    pattern: ^(?=.*\S)[^\x00]*$
                                    type: string
                                  maxItems: 10
                                  minItems: 2
                                  title: Options
                                  type: array
                              required:
                                - options
                                - duration_days
                              title: PollEditInput
                              type: object
                            - type: 'null'
                          description: >-
                            Edit the discussion's poll. Key absent — poll left
                            unchanged. Key `null` — the poll is removed
                            entirely, including its votes; this is allowed
                            regardless of the poll's state (open, closed, with
                            or without votes). Key present as an object (same
                            shape as create: 2-10 plain string options,
                            duration_days 1-7, no option ids) — creates a new
                            poll, but ONLY when the discussion does not already
                            have one. If a poll already exists, an object value
                            is rejected with 409 `poll_replacement_not_allowed`
                            — replacing an existing poll in one step is not
                            supported, in any state. To change a poll, remove it
                            first (`poll: null`), then create the new one in a
                            separate request. Malformed option/duration values
                            return 422 `invalid_attribute`.
                      type: object
                  required:
                    - attributes
                  type: object
              required:
                - data
              title: Body
              type: object
        required: true
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                $ref: >-
                  #/components/schemas/JsonApiResponse_DiscussionResponseAttributes_
          description: Successful Response
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    JsonApiResponse_DiscussionResponseAttributes_:
      properties:
        data:
          $ref: '#/components/schemas/JsonApiResource_DiscussionResponseAttributes_'
        included:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Included
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - data
      title: JsonApiResponse[DiscussionResponseAttributes]
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    JsonApiResource_DiscussionResponseAttributes_:
      properties:
        attributes:
          $ref: '#/components/schemas/DiscussionResponseAttributes'
        id:
          title: Id
          type: string
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        relationships:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Relationships
        type:
          title: Type
          type: string
      required:
        - id
        - type
        - attributes
      title: JsonApiResource[DiscussionResponseAttributes]
      type: object
    JsonApiLinks:
      properties:
        self:
          anyOf:
            - type: string
            - type: 'null'
          title: Self
      title: JsonApiLinks
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    DiscussionResponseAttributes:
      properties:
        attachments:
          anyOf:
            - items:
                $ref: '#/components/schemas/RenderableAttachment'
              type: array
            - type: 'null'
          title: Attachments
        author_contact_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Contact Id
        author_display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Display Name
        author_membership_status:
          anyOf:
            - enum:
                - active
                - banned
                - soft_banned
                - left
              type: string
            - type: 'null'
          title: Author Membership Status
        author_photo_thumbnail_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Photo Thumbnail Url
        author_photo_thumbnail_url_expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Author Photo Thumbnail Url Expires At
        author_photo_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Photo Url
        author_photo_url_expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Author Photo Url Expires At
        author_role:
          anyOf:
            - enum:
                - owner
                - admin
                - moderator
                - member
              type: string
            - type: 'null'
          title: Author Role
        body:
          anyOf:
            - type: string
            - type: 'null'
          title: Body
        comment_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Comment Count
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        deleted_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Deleted At
        external_video_embeds:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: External Video Embeds
        hub_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Hub Id
        is_broadcast:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Broadcast
        is_locked:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Locked
        is_pinned:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Pinned
        is_published:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Published
        last_activity_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Activity At
        poll:
          anyOf:
            - $ref: '#/components/schemas/PollAttributes'
            - type: 'null'
        published_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Published At
        reaction_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reaction Count
        reactions:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Reactions
        report_count:
          default: 0
          description: >-
            Number of moderation reports on this resource, across ALL statuses
            (pending, dismissed, actioned). Present ONLY for an active,
            non-banned hub owner/admin/moderator — the key is omitted entirely
            for any other viewer. Clients MUST treat absence as 'not authorized
            / not supplied', never as zero.
          minimum: 0
          title: Report Count
          type: integer
        reported_by_me:
          default: false
          description: >-
            True when the requesting member has already filed a report against
            this resource. Present for any authenticated member; omitted
            entirely for an anonymous viewer. Clients MUST treat absence as
            'unknown', never as false.
          title: Reported By Me
          type: boolean
        repost:
          anyOf:
            - $ref: '#/components/schemas/RepostBlockAttributes'
            - type: 'null'
        repost_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Repost Count
        scheduled_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Scheduled At
        space_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Space Id
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
        team_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Team Id
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
      title: DiscussionResponseAttributes
      type: object
    RenderableAttachment:
      properties:
        asset_kind:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Kind
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: File Id
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        id:
          title: Id
          type: string
        media_id:
          title: Media Id
          type: string
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        role:
          title: Role
          type: string
        size_bytes:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size Bytes
        status_upload:
          anyOf:
            - type: string
            - type: 'null'
          title: Status Upload
        thumbnail_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Thumbnail Url
        thumbnail_url_expires_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Thumbnail Url Expires At
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        url_expires_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Url Expires At
      required:
        - id
        - media_id
        - role
      title: RenderableAttachment
      type: object
    PollAttributes:
      description: >-
        A single-choice poll attached to a discussion.


        Built field-by-field by ``app.community.poll_read`` (member scope) —

        never via ``model_dump()`` of the ORM rows. ``viewer_voted`` /

        ``viewer_option_id`` are member-scope only; the anon read path

        (``app.community.anon_read.AnonPollAttributes``) omits both entirely,
        not

        just nulls them, since an anonymous request has no viewer identity.
      properties:
        closed:
          title: Closed
          type: boolean
        deadline_at:
          format: date-time
          title: Deadline At
          type: string
        id:
          title: Id
          type: string
        options:
          items:
            $ref: '#/components/schemas/PollOptionAttributes'
          title: Options
          type: array
        total_votes:
          title: Total Votes
          type: integer
        viewer_option_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Viewer Option Id
        viewer_voted:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Viewer Voted
      required:
        - id
        - deadline_at
        - closed
        - total_votes
        - options
      title: PollAttributes
      type: object
    RepostBlockAttributes:
      additionalProperties: false
      properties:
        author_display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Display Name
        author_photo_thumbnail_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Photo Thumbnail Url
        author_photo_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Photo Url
        body:
          anyOf:
            - type: string
            - type: 'null'
          title: Body
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        published_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Published At
        space_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Space Name
        space_slug:
          anyOf:
            - type: string
            - type: 'null'
          title: Space Slug
        state:
          enum:
            - visible
            - locked
            - deleted
            - unavailable
          title: State
          type: string
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
      required:
        - state
      title: RepostBlockAttributes
      type: object
    PollOptionAttributes:
      description: >-
        A single selectable option on a poll.


        ``vote_count`` is documentation-only here (this model drives OpenAPI

        generation, not runtime field filtering — see
        ``RepostBlockAttributes``'s

        docstring for why: the routes that carry this shape return a raw

        ``JSONResponse``). The ACTUAL omit-vs-present gating —

        ``vote_count`` present only when the viewer has voted or the poll is

        closed — is implemented field-by-field in

        ``app.community.poll_read.build_poll_attrs_member``.
      properties:
        id:
          title: Id
          type: string
        label:
          title: Label
          type: string
        position:
          title: Position
          type: integer
        vote_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Vote Count
      required:
        - id
        - label
        - position
      title: PollOptionAttributes
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````