puter.threads.list()


Lists all child threads of a given parent thread.

Syntax

puter.threads.list(parent_uuid, options);

Parameters

parent_uuid (string) (required)

The UUID of the parent thread whose children should be listed.

options (object) (optional)

An object containing the following properties:

  • limit (number) (optional): Maximum number of threads to return. Default is server-defined.
  • offset (number) (optional): Number of threads to skip. Used for pagination. Default is 0.

Return value

An array of objects, each containing information about a child thread:

[
  {
    uuid: string,       // The UUID of the child thread
    content: any,       // The content stored in the child thread
    parent_uuid: string // The UUID of the parent thread
  },
  // ...more thread objects
]

Permissions Required

The current actor needs the thread:UUID-OF-PARENT:list permission to list child threads, unless they are the owner.

Example

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.threads.list('550e8400-e29b-41d4-a716-446655440000', { limit: 10 })
            .then(childThreads => {
                console.log("Child threads:", childThreads);
            })
            .catch(error => {
                console.error("Error listing threads:", error);
            });
    </script>
</body>
</html>