v1

latestOpenAPI 3.0.22026-07-174617345.8 KB
Conversations

Retrieve messages that have been sent in a conversation.

Retrieve all messages sent within a conversation of an agent (formerly known as project) identified by its unique projectId and sessionId. This endpoint allows you to retrieve a collection of messages exchanged in a specific conversation. Messages contain the content, timestamps, and other relevant information shared during the course of the conversation. By providing the projectId and sessionId, you can access all the messages associated with that particular conversation within the agent context. Here is an example to retrieve messages of a conversation: API SDK.

get/api/v1/projects/{projectId}/conversations/{sessionId}/messages

Path parameters

projectIdinteger required
Example:1

The ID of the agent to get the messages for

sessionIdstring required
Example:1

The session ID of the converstaions to get the messages for

Query parameters

pageinteger

Page number to return

order'asc' | 'desc'
Example:desc

The order to sort the results by

Response

List all messages in a conversation

status'error' | 'success'

The status of the response

Example response

{
  "status": "success",
  "data": {
    "conversation": {
      "created_at": "2023-04-30 16:43:53",
      "updated_at": "2023-04-30 16:43:53",
      "deleted_at": "2023-04-30 16:43:53",
      "id": 1,
      "name": "Conversation 1",
      "session_id": "f1b9aaf0-5e4e-11eb-ae93-0242ac130002"
    },
    "messages": {
      "current_page": 1,
      "data": [
        {
          "id": 1,
          "user_id": 1,
          "user_query": "What is the meaning of life?",
          "openai_response": "The meaning of life is to be happy.",
          "created_at": "2021-01-01 00:00:00",
          "updated_at": "2021-01-01 00:00:00",
          "conversation_id": 1,
          "citations": [
            1,
            2,
            3
          ],
          "metadata": {
            "user_ip": "127.0.0.1",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko)",
            "external_id": "ext_id_1234567890",
            "request_source": "web"
          },
          "response_feedback": {
            "created_at": "2024-08-27T21:07:20.000000Z",
            "updated_at": "2024-08-27T21:07:20.000000Z",
            "user_id": 1,
            "reaction": "liked"
          }
        }
      ],
      "first_page_url": "https://app.customgpt.ai/api/v1/users?page=1",
      "from": 1,
      "last_page": 1,
      "last_page_url": "https://app.customgpt.ai/api/v1/users?page=1",
      "next_page_url": "https://app.customgpt.ai/api/v1/users?page=1",
      "path": "https://app.customgpt.ai/api/v1/users?page=1",
      "per_page": 10,
      "prev_page_url": "https://app.customgpt.ai/api/v1/users?page=1",
      "to": 1,
      "total": 1
    }
  }
}