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

# List digest instances

> Returns the digest instances for a schedule, one per user, with cursor paging. Use it to see what has accumulated before a digest releases.



## OpenAPI

````yaml /openapi-specs/openapi.documented.yml get /digests/schedules/{schedule_id}/instances
openapi: 3.0.1
info:
  title: Courier
  description: The Courier REST API for sending and managing notifications across channels.
  version: 0.0.1
servers:
  - url: https://api.courier.com
    description: Production
security: []
paths:
  /digests/schedules/{schedule_id}/instances:
    get:
      tags:
        - Digests
      summary: List digest instances
      description: >-
        Returns the digest instances for a schedule, one per user, with cursor
        paging. Use it to see what has accumulated before a digest releases.
      operationId: digests_listInstances
      parameters:
        - name: schedule_id
          in: path
          description: >-
            The ID of the digest schedule, in the form `sch/{uuid}`. The value
            must be URL-encoded (e.g.
            `sch%2F00000000-0000-0000-0000-000000000000`).
          required: true
          schema:
            type: string
        - name: cursor
          in: query
          description: >-
            A cursor token from a previous response, used to fetch the next page
            of results.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: >-
            The maximum number of digest instances to return. Defaults to 20,
            with a maximum of 100.
          required: false
          schema:
            type: integer
            default: 20
            maximum: 100
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DigestInstanceListResponse'
              examples:
                Example1:
                  value:
                    type: list
                    has_more: false
                    cursor: null
                    url: >-
                      /digests/schedules/sch%2F00000000-0000-0000-0000-000000000000/instances
                    next_url: null
                    items:
                      - digest_instance_id: a1b2c3d4-0000-0000-0000-000000000000
                        status: IN_PROGRESS
                        event_count: 3
                        user_id: user-123
                        tenant_id: tenant-abc
                        disabled: false
                        created_at: '2024-01-01T00:00:00.000Z'
                        categories:
                          - category_key: comments
                            retain: first
                        category_key_counts:
                          comments: 3
        '403':
          description: The digest schedule does not belong to the authenticated workspace.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              examples:
                Unauthorized:
                  value:
                    message: Unauthorized
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Courier from '@trycourier/courier';


            const client = new Courier({
              apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
            });


            const digestInstanceListResponse = await
            client.digests.schedules.listInstances('schedule_id');


            console.log(digestInstanceListResponse.has_more);
        - lang: Python
          source: >-
            import os

            from courier import Courier


            client = Courier(
                api_key=os.environ.get("COURIER_API_KEY"),  # This is the default and can be omitted
            )

            digest_instance_list_response =
            client.digests.schedules.list_instances(
                schedule_id="schedule_id",
            )

            print(digest_instance_list_response.has_more)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/trycourier/courier-go\"\n\t\"github.com/trycourier/courier-go/option\"\n)\n\nfunc main() {\n\tclient := courier.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdigestInstanceListResponse, err := client.Digests.Schedules.ListInstances(\n\t\tcontext.TODO(),\n\t\t\"schedule_id\",\n\t\tcourier.DigestScheduleListInstancesParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", digestInstanceListResponse.HasMore)\n}\n"
        - lang: Java
          source: >-
            package com.courier.example;


            import com.courier.client.CourierClient;

            import com.courier.client.okhttp.CourierOkHttpClient;

            import com.courier.models.digests.DigestInstanceListResponse;

            import
            com.courier.models.digests.schedules.ScheduleListInstancesParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    CourierClient client = CourierOkHttpClient.fromEnv();

                    DigestInstanceListResponse digestInstanceListResponse = client.digests().schedules().listInstances("schedule_id");
                }
            }
        - lang: Ruby
          source: >-
            require "courier"


            courier = Courier::Client.new(api_key: "My API Key")


            digest_instance_list_response =
            courier.digests.schedules.list_instances("schedule_id")


            puts(digest_instance_list_response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Courier\Client;

            use Courier\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API
            Key');


            try {
              $digestInstanceListResponse = $client->digests->schedules->listInstances(
                'schedule_id', cursor: 'cursor', limit: 100
              );

              var_dump($digestInstanceListResponse);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: >-
            using System;

            using TryCourier;

            using TryCourier.Models.Digests.Schedules;


            CourierClient client = new();


            ScheduleListInstancesParams parameters = new() { ScheduleID =
            "schedule_id" };


            var digestInstanceListResponse = await
            client.Digests.Schedules.ListInstances(parameters);


            Console.WriteLine(digestInstanceListResponse);
        - lang: CLI
          source: |-
            courier digests:schedules list-instances \
              --api-key 'My API Key' \
              --schedule-id schedule_id
components:
  schemas:
    DigestInstanceListResponse:
      title: DigestInstanceListResponse
      type: object
      properties:
        type:
          type: string
          enum:
            - list
          description: Always `list` for a paginated list response.
        items:
          type: array
          items:
            $ref: '#/components/schemas/DigestInstance'
          description: The digest instances for this page of results.
        has_more:
          type: boolean
          description: Whether there are more digest instances to fetch using the cursor.
        cursor:
          type: string
          nullable: true
          description: >-
            A cursor token for fetching the next page of results, or null when
            there are none.
        url:
          type: string
          description: The path of the current request.
        next_url:
          type: string
          nullable: true
          description: >-
            The path to fetch the next page of results, or null when there are
            none.
      required:
        - type
        - items
        - has_more
    DigestInstance:
      title: DigestInstance
      type: object
      properties:
        digest_instance_id:
          type: string
          description: A unique identifier for the digest instance.
        status:
          type: string
          enum:
            - IN_PROGRESS
            - COMPLETED
          description: >-
            The status of the digest instance. `IN_PROGRESS` instances are still
            accumulating events; `COMPLETED` instances have been released.
        event_count:
          type: integer
          description: The total number of events received for this instance.
        user_id:
          type: string
          description: The ID of the user this digest instance belongs to.
        tenant_id:
          type: string
          nullable: true
          description: The ID of the tenant this digest instance belongs to, if any.
        categories:
          type: array
          items:
            $ref: '#/components/schemas/DigestCategory'
          description: The categories configured for the digest.
        category_key_counts:
          type: object
          additionalProperties:
            type: integer
          description: >-
            A map of category key to the number of events received for that
            category.
        disabled:
          type: boolean
          description: Whether the digest instance has been disabled.
        created_at:
          type: string
          description: An ISO 8601 timestamp of when the digest instance was created.
      required:
        - digest_instance_id
        - status
        - event_count
        - user_id
    DigestCategory:
      title: DigestCategory
      type: object
      properties:
        category_key:
          type: string
          description: The key that identifies the category within the digest.
        retain:
          type: string
          enum:
            - first
            - last
            - highest
            - lowest
            - none
          description: >-
            Which events to keep when the number of events exceeds the retention
            limit for the category.
        sort_key:
          type: string
          description: >-
            The data key used to order events when `retain` is `highest` or
            `lowest`.
      required:
        - category_key
        - retain
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````