Read Conversation

Retrieve the complete message history for a specific chat conversation. This endpoint returns all messages in chronological order, including user inputs and AI responses.

Endpoint

GET/readConversation
Fetch the complete conversation history for a specific chat ID, including all messages, timestamps, and metadata.
https://chat-api.atriai.chat/readConversation

Authentication

Type:
Bearer Token
Header:
Authorization
Your project-specific API key for the Chat service

Query Parameters

The following query parameters can be included in the URL:

URL Query Parameters

chat_idstringREQUIRED

The unique identifier for the chat conversation you want to retrieve

Validation Rules

The following validation rules apply to the request:

chat_id is required

A valid chat_id must be provided as a query parameter

Valid API key required

A valid project-specific API key must be provided in the Authorization header

Chat must belong to project

Only conversations that belong to the authenticated project can be accessed

Chat must exist

The specified chat_id must correspond to an existing conversation

Response Schema

The API returns an array of message objects with the following structure:

[].msg_idstring

Unique identifier for the individual message

[].rolestring

The role of the message sender - either 'user' or 'assistant'

[].contentstring

The actual message content/text

[].timestampstring

ISO timestamp when the message was created

[].classificationstring

Message classification (e.g., 'question', 'greeting', 'request') - present on user messages

[].citationsarray[object]

Array of citation objects containing sources and references - present on assistant messages

Response Structure Details

Understanding the conversation response format:

Message Ordering

Messages are returned in chronological order, starting with the earliest message first

Role Alternation

Messages typically alternate between 'user' and 'assistant' roles, representing the conversation flow

Timestamps

All timestamps are in ISO 8601 format (UTC timezone) for consistent parsing

Citations

Assistant messages may include citations array with sources used to generate the response

Classifications

User messages include a classification field indicating the type/intent of the message

Use Cases

Common scenarios where this endpoint is useful:

  • Display conversation history in your chat interface
  • Export conversation data for analysis or archival
  • Customer support review of user interactions
  • Debugging and troubleshooting conversation flows
  • Analytics on conversation patterns and user behavior
  • Compliance and audit trails for conversations
  • Context restoration when resuming conversations
  • Training data extraction for AI model improvement

Error Scenarios

Common error cases and their meanings:

404Chat Not Found

The specified chat_id does not exist or does not belong to your project

401Unauthorized

Invalid or missing API key in the Authorization header

400Missing Parameters

The chat_id query parameter is required but was not provided

Usage Examples

Common usage patterns for the Read Conversation endpoint:

Read Conversation

Retrieve the complete history of a conversation

https://chat-api.atriai.chat/readConversation?chat_id=chat_20240711_143052_abc123

Response Example

Example response showing a complete conversation:

[
  {
    "msg_id": "msg_chat_20240711_143052_abc123_001",
    "role": "user",
    "content": "Hello, I need help with my account",
    "timestamp": "2024-07-11T14:30:52.123Z",
    "classification": "greeting"
  },
  {
    "msg_id": "msg_chat_20240711_143052_abc123_002",
    "role": "assistant",
    "content": "Hello! I'm happy to help you. What specific issue are you experiencing?",
    "timestamp": "2024-07-11T14:30:55.456Z",
    "citations": [
      {
        "source": "knowledge_base",
        "reference": "Customer Support Guidelines v3.2",
        "confidence": 0.92
      }
    ]
  },
  {
    "msg_id": "msg_chat_20240711_143052_abc123_003",
    "role": "user",
    "content": "I can't access my dashboard",
    "timestamp": "2024-07-11T14:31:20.789Z",
    "classification": "request"
  },
  {
    "msg_id": "msg_chat_20240711_143052_abc123_004",
    "role": "assistant",
    "content": "I understand. Let me help you troubleshoot this issue...",
    "timestamp": "2024-07-11T14:31:25.321Z",
    "citations": []
  }
]

Try it out

Select a language to see how to make a request to the AI Chat API

C
cURL Request
curl -L 'https://chat-api.atriai.chat/readConversation?chat_id=your_chat_id_here' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY'
!

API Key Required

Replace YOUR_API_KEY with your actual api key to authenticate requests.