> ## 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.

# List albums in a library

> Returns a paginated list of albums ordered by creation time (newest first), optionally filtered by asset membership or ID. Use this to enumerate a user's albums or to find which albums contain a specific asset (via `asset_id`).

`list_albums` returns album metadata only — to list the assets inside a particular album, use `list_album_assets` or `list_assets` with `album_id`.

**Pagination** is cursor-based: when `has_more` is true, pass the `id` of the last album in `data` as `starting_after_id` to fetch the next page.



## OpenAPI

````yaml https://api.gumnut.ai/openapi.json get /api/albums
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/albums:
    get:
      tags:
        - albums
      summary: List albums in a library
      description: >-
        Returns a paginated list of albums ordered by creation time (newest
        first), optionally filtered by asset membership or ID. Use this to
        enumerate a user's albums or to find which albums contain a specific
        asset (via `asset_id`).


        `list_albums` returns album metadata only — to list the assets inside a
        particular album, use `list_album_assets` or `list_assets` with
        `album_id`.


        **Pagination** is cursor-based: when `has_more` is true, pass the `id`
        of the last album in `data` as `starting_after_id` to fetch the next
        page.
      operationId: list_albums
      parameters:
        - name: library_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Library to list albums from. Optional if the user has a single
              library; required when they have multiple.
            title: Library Id
          description: >-
            Library to list albums from. Optional if the user has a single
            library; required when they have multiple.
        - name: asset_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Return only albums that contain this asset. Useful for answering
              'which albums is this photo in?' without calling
              `list_album_assets`.
            title: Asset Id
          description: >-
            Return only albums that contain this asset. Useful for answering
            'which albums is this photo in?' without calling
            `list_album_assets`.
        - name: ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            description: >-
              Look up specific albums by ID (max 200; each ID has the `album_`
              prefix). Accepts multiple `ids=` query params or a single
              comma-delimited value (e.g., `ids=album_1,album_2`).
            title: Ids
          description: >-
            Look up specific albums by ID (max 200; each ID has the `album_`
            prefix). Accepts multiple `ids=` query params or a single
            comma-delimited value (e.g., `ids=album_1,album_2`).
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 200
            minimum: 1
            description: >-
              Maximum number of albums to return per page (1–200). Defaults to
              20.
            default: 20
            title: Limit
          description: Maximum number of albums to return per page (1–200). Defaults to 20.
        - name: starting_after_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Cursor for pagination. Pass the `id` of the last album in the
              previous response's `data` to fetch the next page. Omit for the
              first page.
            title: Starting After Id
          description: >-
            Cursor for pagination. Pass the `id` of the last album in the
            previous response's `data` to fetch the next page. Omit for the
            first page.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedAlbumsResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PaginatedAlbumsResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/AlbumResponse'
          type: array
          title: Data
          description: List of albums
        has_more:
          type: boolean
          title: Has More
          description: >-
            True if there are more albums after this page. Pass the last album's
            `id` as `starting_after_id` to fetch the next page.
      type: object
      required:
        - data
        - has_more
      title: PaginatedAlbumsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AlbumResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique album identifier with 'album_' prefix
        name:
          type: string
          title: Name
          description: Display name of the album
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional description text for the album
        asset_count:
          type: integer
          title: Asset Count
          description: Total number of assets in this album
        album_cover_asset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Album Cover Asset Id
          description: >-
            ID of the asset displayed as the album cover. May be a
            server-selected default when the album has no explicit cover set, or
            null when the album has no live assets.
        asset_urls:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/AssetVariant'
              type: object
            - type: 'null'
          title: Asset Urls
          description: 'Asset variants for the album cover: ''thumbnail'''
        start_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Start Date
          description: >-
            The oldest asset date (local_datetime) in the album, or null if
            empty
        end_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End Date
          description: >-
            The newest asset date (local_datetime) in the album, or null if
            empty
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When this album was created
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: When this album was last updated
      type: object
      required:
        - id
        - name
        - asset_count
        - created_at
        - updated_at
      title: AlbumResponse
      description: Represents a collection of assets organized by the user.
    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
    AssetVariant:
      properties:
        url:
          type: string
          title: Url
          description: URL to fetch this image variant
        mimetype:
          type: string
          title: Mimetype
          description: MIME type of the served image
        width:
          anyOf:
            - type: integer
            - type: 'null'
          title: Width
          description: Target width in pixels (null if unknown)
      type: object
      required:
        - url
        - mimetype
      title: AssetVariant
      description: A single image variant with its URL, MIME type, and target width.

````