Suggested Topics

API methods related to the Context.ai generated topics

List Suggested Topics

All suggested topics

GET https://api.context.ai/api/v1/suggested_topics

Fetches a list of all suggested topics. If tenant_id is provided, fetches the suggested topics for the given tenant, otherwise fetches the suggested topics for the top level Context.ai account associated with the API key.

Query Parameters

NameTypeDescription

tenant_id

String

The tenant_id for which you would like to fetch conversations.

path

Integer

Page number of results to return. Defaults to 1.

per_page

Integer

Number of results to return per page. Defaults to 20.

{
  "count": 1,
  "topics": [
    {
      "id": "01RJW65wl1iZiWWVqTuCQ",
      "name": "running shoes",
      "conversations_sample": [
        {
          "metadata": {
            "id": "pzbGrCEWgKi99HHnwWxUi",
            "metadata": {
              "model": "gpt-3.5-turbo",
              "user_id": 3242
            },
            "sentiment_trend": "up|flat|down",
            "topics": [
              {
                "id": "w4AnzB9iENa1_AVfWI3sr",
                "name": "football shoes"
              }
            ],
            "suggested_topics": [
              {
                "id": "QOAwUCRhhlpmDCH534lBu",
                "name": "opening hours"
              }
            ],
            "messages": [
              {
                "type": "message",
                "event_timestamp": "2022-09-27 18:00:00.000",
                "role": "system|assistant|user",
                "message": "hola mundo!",
                "rating": -1,
                "language": "es",
                "translation": "hello world!",
                "sentiment": 0.2,
                "topics": {
                  "name": "football shoes",
                  "id": "w4AnzB9iENa1_AVfWI3sr"
                },
                "suggested_topics": {
                  "id": "QOAwUCRhhlpmDCH534lBu",
                  "name": "opening hours"
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

List Conversations

All conversations within a suggested topic

GET https://api.context.ai/api/v1/suggested_topics/:id/conversations

Fetches conversations within a suggested topic. If tenant_id is provided, fetches the conversations for the given tenant, otherwise fetches the conversations for the top level Context.ai account associated with the API key.

Path Parameters

NameTypeDescription

id

String

ID of the suggested topic

Query Parameters

NameTypeDescription

tenant_id

String

The tenant_id for which you would like to fetch conversations.

If tenant_id is passed, the suggested topic must be associated to the given tenant, else a permissions exception will be raised.

end_time

String

ISO-8601 timestamp indicating the start of when you would like to fetch conversations.

Defaults to now.

start_time

String

ISO-8601 timestamp indicating the start of when you would like to fetch conversations.

Defaults to 7 days ago.

page

Integer

Page number of results to return. Defaults to 1.

per_page

Integer

Number of results to return per page. Defaults to 20.

{
  "count": 1,
  "conversations": [
    {
      "metadata": {
        "id": "pzbGrCEWgKi99HHnwWxUi",
        "metadata": {
          "model": "gpt-3.5-turbo",
          "user_id": 3242
        },
        "sentiment_trend": "up|flat|down",
        "topics": [
          {
            "id": "w4AnzB9iENa1_AVfWI3sr",
            "name": "football shoes",
          }
        ],
        "suggested_topics": [
          {
            "id": "QOAwUCRhhlpmDCH534lBu",
            "name": "opening hours",
          }
        ],
        "messages": [
          {
            "type": "message",
            "event_timestamp": "2022-09-27 18:00:00.000",
            "role": "system|assistant|user",
            "message": "hola mundo!",
            "rating": -1,
            "language": "es",
            "translation": "hello world!",
            "sentiment": 0.2,
            "topics": {
              "name": "football shoes",
              "id": "w4AnzB9iENa1_AVfWI3sr",
            },
            "suggested_topics": {
              "id": "QOAwUCRhhlpmDCH534lBu",
              "name": "opening hours",
            }
          }
        }
      ]
    }
  ]
}

Last updated