Skip to content

Download Comments

On this page you will learn how to download the comments of your Kelvin components, for one component, for a group of components or for all of them.

Available Guides

Overview

Threads and Comments

Comments in Kelvin live in Threads.

A Thread is the conversation of one Kelvin component, for example a Recommendation. The ID of the Thread is the KRN of that component, such as krn:recommendation:0198a7b0-0000-7000-8000-000000000001.

A Comment is a single message in that conversation. Every Comment has a thread_id that tells you which Thread, and so which component, it belongs to.

Recommendation   krn:recommendation:0198a7b0-0000-7000-8000-000000000001
└── Thread       id = krn:recommendation:0198a7b0-0000-7000-8000-000000000001
    ├── Comment  thread_id = krn:recommendation:0198a7b0-0000-7000-8000-000000000001
    ├── Comment  thread_id = krn:recommendation:0198a7b0-0000-7000-8000-000000000001
    └── Comment  thread_id = krn:recommendation:0198a7b0-0000-7000-8000-000000000001

This means that to download the comments of a component, you ask for the Comments of the Thread that has the KRN of that component.

The Endpoints

Three endpoints are used to export comments. You need the kelvin.permission.threads.read permission to use them.

Endpoint What it does
GET /threads/list Lists the Threads. Use it to find which components have a conversation.
GET /threads/{thread_id}/get Gets one Thread.
POST /threads/comments/list Lists the Comments. This is the one that downloads the comments.

Note

The two Threads endpoints return the Threads only, not the comments inside them. To download the comments you always use threads/comments/list.

Choose Which Comments You Want

You choose the comments by sending filters in the body of threads/comments/list. All the filters are optional.

Filter What it selects
thread_ids The Comments of these Threads. You can give one KRN or many.
ids These specific Comments, by Comment ID.
Both Only the Comments that match ids and thread_ids together.
None, an empty {} All the Comments.

The filters are combined with AND. Inside one filter, a list of values means any of the values, so thread_ids with two KRNs returns the Comments of both Threads.

For example, this body asks for one specific Comment, but only if it belongs to that Recommendation.

Comments list filters
1
2
3
4
5
6
7
8
{
  "ids": [
    "0198a7b0-4c2e-7000-8000-3f9a12bd77e1"
  ],
  "thread_ids": [
    "krn:recommendation:0198a7b0-0000-7000-8000-000000000001"
  ]
}

Guides

Find the Threads

Start here if you want to see which components have a conversation.

API cURL Example
1
2
3
4
curl -X "GET" \
  "https://<url.kelvin.ai>/api/v4/threads/list" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json"

To list only some Threads, add one ids parameter for each Thread, using the KRN of the component.

API cURL Example
1
2
3
4
curl -X "GET" \
  "https://<url.kelvin.ai>/api/v4/threads/list?ids=krn:recommendation:0198a7b0-0000-7000-8000-000000000001&ids=krn:recommendation:0198a7b0-0000-7000-8000-000000000002" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json"

The response is a list of Threads. Each Thread has the fields in the Thread reference.

API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# List all the Threads
response = client.thread.list_threads()

# Or list only some Threads
response = client.thread.list_threads(
    ids=[
        "krn:recommendation:0198a7b0-0000-7000-8000-000000000001",
        "krn:recommendation:0198a7b0-0000-7000-8000-000000000002",
    ]
)

# Convert the response into a Pandas DataFrame
df = response.to_df()

# Print the result
print(df)

Get a Thread

Use this when you already know the component and want to see its Thread.

API cURL Example
1
2
3
4
curl -X "GET" \
  "https://<url.kelvin.ai>/api/v4/threads/krn:recommendation:0198a7b0-0000-7000-8000-000000000001/get" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json"

You will receive a response body with a status code of 200, indicating a successful operation. For example, the response body might look like this:

API cURL Example Response
{
  "id": "krn:recommendation:0198a7b0-0000-7000-8000-000000000001",
  "resources": [
    "krn:asset:pcp_01"
  ],
  "contexts": [
    "krn:recommendation:0198a7b0-0000-7000-8000-000000000001"
  ],
  "created": "2026-08-21T15:12:33.582724Z",
  "created_by": "krn:user:test@kelvininc.com",
  "updated": "2026-08-21T15:12:33.582724Z",
  "updated_by": "krn:user:test@kelvininc.com"
}
API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# Get one Thread
response = client.thread.get_thread(
    thread_id="krn:recommendation:0198a7b0-0000-7000-8000-000000000001"
)

# Print the result
print(response)

Download All Comments

Send an empty filter and you get every Comment.

API cURL Example
1
2
3
4
5
6
curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/threads/comments/list" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{}'

The response is a list of Comments. Each Comment has the fields in the Comment reference.

The results are paginated, read Pagination to get all the pages.

API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# List all the Comments
response = client.thread.list_thread_comments(data={})

# Convert the response into a Pandas DataFrame
df = response.to_df()

# Print the result
print(df)

Download the Comments of One Component

Use the KRN of the component in thread_ids. In this example we will get the Comments of one Recommendation.

API cURL Example
curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/threads/comments/list" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
        "thread_ids": [
          "krn:recommendation:0198a7b0-0000-7000-8000-000000000001"
        ]
     }'

You will receive a response body with a status code of 200, indicating a successful operation. For example, the response body might look like this:

API cURL Example Response
{
  "pagination": {
    "next_page": null,
    "previous_page": null
  },
  "data": [
    {
      "id": "0198a7b0-4c2e-7000-8000-3f9a12bd77e1",
      "thread_id": "krn:recommendation:0198a7b0-0000-7000-8000-000000000001",
      "text": "Comment text",
      "mentions": [
        "krn:user:jane.doe"
      ],
      "metadata": {
        "pinned": true
      },
      "created": "2026-08-21T15:12:33.582724Z",
      "created_by": "krn:user:test@kelvininc.com",
      "updated": "2026-08-21T15:12:33.582724Z",
      "updated_by": "krn:user:test@kelvininc.com"
    }
  ]
}
API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# List the Comments of one component
response = client.thread.list_thread_comments(
    data={
        "thread_ids": [
            "krn:recommendation:0198a7b0-0000-7000-8000-000000000001",
        ],
    }
)

# Convert the response into a Pandas DataFrame
df = response.to_df()
df = df[["thread_id", "text", "created_by"]]

# Print the result
print(df)

The response will look like this;

API Client (Python) Example Response
                                                 thread_id          text                   created_by
0  krn:recommendation:0198a7b0-0000-7000-8000-000000000001  Comment text  krn:user:test@kelvininc.com

Download the Comments of a Group of Components

Give more than one KRN in thread_ids. In this example we will get the Comments of two Recommendations at the same time.

API cURL Example
curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/threads/comments/list" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
        "thread_ids": [
          "krn:recommendation:0198a7b0-0000-7000-8000-000000000001",
          "krn:recommendation:0198a7b0-0000-7000-8000-000000000002"
        ]
     }'

The response is a list with the Comments of both components. Use the thread_id of each Comment to know which component it belongs to.

API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# List the Comments of a group of components
response = client.thread.list_thread_comments(
    data={
        "thread_ids": [
            "krn:recommendation:0198a7b0-0000-7000-8000-000000000001",
            "krn:recommendation:0198a7b0-0000-7000-8000-000000000002",
        ],
    }
)

# Convert the response into a Pandas DataFrame
df = response.to_df()
df = df[["thread_id", "text", "created_by"]]

# Print the result
print(df)

Download Specific Comments

Use ids to download Comments by their Comment ID. If you add thread_ids as well, you only get the Comments that match both.

API cURL Example
curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/threads/comments/list" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
        "ids": [
          "0198a7b0-4c2e-7000-8000-3f9a12bd77e1"
        ],
        "thread_ids": [
          "krn:recommendation:0198a7b0-0000-7000-8000-000000000001"
        ]
     }'
API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# List specific Comments
response = client.thread.list_thread_comments(
    data={
        "ids": [
            "0198a7b0-4c2e-7000-8000-3f9a12bd77e1",
        ],
        "thread_ids": [
            "krn:recommendation:0198a7b0-0000-7000-8000-000000000001",
        ],
    }
)

# Convert the response into a Pandas DataFrame
df = response.to_df()

# Print the result
print(df)

Reference

Thread

Field Description
id The Thread identifier. For Kelvin components this is the KRN of the component (e.g. krn:recommendation:<id>, krn:pcid:<change_id>, krn:datatag:<id>).
resources Asset KRNs the Thread is about.
contexts KRNs of any kind that give the Thread context.
created UTC time when the Thread was created, formatted in RFC 3339.
created_by User KRN that created the Thread.
updated UTC time when the Thread or any of its Comments were last updated, formatted in RFC 3339.
updated_by User KRN that last updated the Thread or one of its Comments.

Comment

Field Description
id The unique ID of the Comment.
thread_id The Thread the Comment belongs to. For Kelvin components this is the KRN of the component.
text The text of the Comment.
mentions A list of user KRNs mentioned in the Comment.
metadata Free-form JSON object stored with the Comment.
created UTC time when the Comment was created, formatted in RFC 3339.
created_by User KRN that authored the Comment.
updated UTC time when the Comment was last updated, formatted in RFC 3339.
updated_by User KRN that last updated the Comment.

Pagination

threads/list and threads/comments/list return their results in pages. You can control this with these query parameters.

Parameter Description
pagination_type cursor (default), limits or stream. cursor and limits return one page of results, stream returns all the results.
page_size Number of results in each page, from 1 to 10000. The default is 20.
page The page number you want. Used only with limits.
next Bookmark of where to start the next page. Used only with cursor.
previous Bookmark of where to end the previous page. Used only with cursor.
direction asc (default) or desc. The sorting order of sort_by.
sort_by Sort by id, created, created_by, updated or updated_by.

In the Kelvin API Client (Python) you can pass the same options as arguments, for example page_size=100.