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

# Set a stack's cover

> Pins one of the stack's own live members as its cover (`primary_asset_id`). Setting a cover marks the stack as user-owned (`origin = user`), which freezes it — membership included — against burst re-detection, so neither the chosen cover nor the frame grouping is ever silently reverted by a later detection pass.

`primary_asset_id` cannot be null: there is no manual clear-cover operation. A pin clears automatically when the pinned frame is removed from the stack or permanently deleted.



## OpenAPI

````yaml https://api.gumnut.ai/openapi.json patch /api/stacks/{stack_id}
openapi: 3.1.0
info:
  title: Gumnut API
  description: API for using Gumnut to manage photos and videos
  version: 0.1.0
servers: []
security: []
paths:
  /api/stacks/{stack_id}:
    patch:
      tags:
        - stacks
      summary: Set a stack's cover
      description: >-
        Pins one of the stack's own live members as its cover
        (`primary_asset_id`). Setting a cover marks the stack as user-owned
        (`origin = user`), which freezes it — membership included — against
        burst re-detection, so neither the chosen cover nor the frame grouping
        is ever silently reverted by a later detection pass.


        `primary_asset_id` cannot be null: there is no manual clear-cover
        operation. A pin clears automatically when the pinned frame is removed
        from the stack or permanently deleted.
      operationId: update_stack
      parameters:
        - name: stack_id
          in: path
          required: true
          schema:
            type: string
            description: >-
              Stack ID (with `asset_stack_` prefix) of the stack to pin a cover
              on.
            title: Stack Id
          description: >-
            Stack ID (with `asset_stack_` prefix) of the stack to pin a cover
            on.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StackUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StackResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    StackUpdate:
      properties:
        primary_asset_id:
          type: string
          title: Primary Asset Id
          description: >-
            Asset ID (with `asset_` prefix) to pin as the stack's cover. Must be
            a live, current member of this stack — get member IDs from
            `list_assets` with `stack_id`.
      type: object
      required:
        - primary_asset_id
      title: StackUpdate
    StackResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique stack identifier with 'asset_stack_' prefix
        primary_asset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Primary Asset Id
          description: >-
            ID of the asset the user pinned as the stack's cover, or null if
            none is pinned. Null for an auto-detected burst unless a user has
            since pinned a cover — there is no server-selected default, so a
            client showing a stack with no pinned cover picks its own. A pinned
            cover that has been trashed keeps its ID here; it is cleared only
            once the asset is permanently deleted.
        asset_count:
          type: integer
          title: Asset Count
          description: >-
            Number of live assets in this stack. Excludes trashed members, so it
            can drop below the number of frames originally grouped.
        origin:
          $ref: '#/components/schemas/StackOrigin'
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When this stack was created
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: When this stack was last updated
      type: object
      required:
        - id
        - asset_count
        - origin
        - created_at
        - updated_at
      title: StackResponse
      description: Represents a group of assets displayed as a single tile.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StackOrigin:
      type: string
      enum:
        - auto_burst
        - user
      title: StackOrigin
      description: >-
        How a stack came to exist.


        `auto_burst` marks a stack the burst detector created from the time +

        EXIF-camera signal; `user` marks a stack a user created or edited
        (manual

        create, set-cover, add/remove, unstack). The distinction is what keeps

        re-detection from stomping a user's correction — the detection pass
        skips

        `user` stacks.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````