KrosAI Docs
DashboardGet Started
  • Getting Started
    • Introduction
    • Quickstart Guide
    • Authentication
  • OpenAI SDK Compatability
  • Endpoints
    • Completions API
      • Create Chat Completion
    • Translation API
    • Text Summarization API
    • Audio Transcription API
    • Sentiment Analysis API
  • AGENT
    • Agents API
      • Create Agent
      • List Agents
      • Get Agent
      • Update Agent
      • Delete Agent
      • Start Voice Session
    • Conversations API
      • Create Conversation
      • List Conversations
      • Get Conversation
      • Get Conversation Messages
    • Knowledge Base API
      • Create Knowledge Base
      • List Knowledge Base
      • Upload Document
      • List Document
  • Resources
    • AI Voice Agents
    • In-App Voice Assistants
    • Virtual Health Assistants
    • EdTech Language Tutors
  • SDKS
    • Node.JS SDK
    • React Native SDK
    • Flutter
Powered by GitBook
On this page
  • Endpoint
  • Parameters
  • Authentication
  • Response
  • Example Request
  • Example Response
  • Error Responses
  • Notes
  1. AGENT
  2. Conversations API

Get Conversation Messages

Retrieves all messages from a specific conversation.

Endpoint

GET /v1/conversations/{conversation_id}/messages

Parameters

Parameter
Type
Required
Description

conversation_id

string

Yes

Unique identifier of the conversation

Authentication

Requires a valid API key or user authentication token.

Response

Returns an array of message objects in chronological order.

Response Format

[
  {
    "id": "string",
    "conversation_id": "string",
    "role": "string",
    "content": "string",
    "created_at": "datetime"
  }
]

Response Fields

Field
Type
Description

id

string

Unique identifier for the message

conversation_id

string

ID of the conversation this message belongs to

role

string

Role of the message sender ("system", "user", "assistant")

content

string

Text content of the message

created_at

datetime

When the message was created

Example Request

curl -X GET "https://api.krosai.com/v1/conversations/conv-b2c3d4e5-f6g7-8901-bcde-fg2345678901/messages" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

[
  {
    "id": "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "conversation_id": "conv-b2c3d4e5-f6g7-8901-bcde-fg2345678901",
    "role": "system",
    "content": "You are a helpful product support agent...",
    "created_at": "2023-07-10T15:30:00Z"
  },
  {
    "id": "msg-b2c3d4e5-f6g7-8901-bcde-fg2345678901",
    "conversation_id": "conv-b2c3d4e5-f6g7-8901-bcde-fg2345678901",
    "role": "assistant",
    "content": "Hello! How can I help you today?",
    "created_at": "2023-07-10T15:30:05Z"
  },
  {
    "id": "msg-c3d4e5f6-g7h8-9012-cdef-gh3456789012",
    "conversation_id": "conv-b2c3d4e5-f6g7-8901-bcde-fg2345678901",
    "role": "user",
    "content": "I need help with product setup",
    "created_at": "2023-07-10T15:30:15Z"
  }
]

Error Responses

Status Code
Description

401

Unauthorized - Invalid or missing API key

403

Forbidden - Not authorized to access this conversation

404

Not Found - Conversation not found

500

Internal Server Error

Notes

  • Messages are returned in chronological order (oldest first)

  • The first message is typically a system message containing the agent's instructions

  • For voice conversations, messages contain transcribed text

  • All participants' messages are included in the conversation history

  • Messages are stored permanently for record-keeping

PreviousGet ConversationNextKnowledge Base API

Last updated 2 months ago