Ayra AI
|Docs

Conversation Details

Get complete conversation information

Retrieves complete details for a specific conversation including full transcript, recording URLs, detailed analytics, and all associated metadata.

Endpoint

GET https://api.ayra.ai/v1/conversations/{conversation_id}

Authentication

Requires API key with conversations:read permission.

Path Parameters

conversation_id(string, required) - The unique identifier of the conversation

Query Parameters

include_transcript(boolean) - Include full transcript. Default: true
include_recording(boolean) - Include recording URL. Default: true
include_analytics(boolean) - Include detailed analytics. Default: true

Request Examples

Basic Request:

curl https://api.ayra.ai/v1/conversations/conv_abc123xyz789 \
  -H "Authorization: Bearer sk_live_abc123xyz789"

Request Without Transcript (faster):

curl "https://api.ayra.ai/v1/conversations/conv_abc123xyz789?include_transcript=false" \
  -H "Authorization: Bearer sk_live_abc123xyz789"

JavaScript Example

async function getConversationDetails(conversationId, options = {}) {
  const params = new URLSearchParams({
    include_transcript: options.include_transcript !== false,
    include_recording: options.include_recording !== false,
    include_analytics: options.include_analytics !== false
  });

  try {
    const response = await axios.get(
      `https://api.ayra.ai/v1/conversations/${conversationId}?${params}`,
      {
        headers: {
          'Authorization': 'Bearer sk_live_abc123xyz789'
        }
      }
    );
    
    console.log('Conversation details retrieved');
    return response.data;
  } catch (error) {
    console.error('Error fetching conversation:', error.response.data);
    throw error;
  }
}

// Example: Get full conversation details
getConversationDetails('conv_abc123xyz789').then(conversation => {
  console.log(`Duration: ${conversation.data.duration}s`);
  console.log(`Sentiment: ${conversation.data.sentiment}`);
  console.log(`Transcript length: ${conversation.data.transcript.length} characters`);
});

Python Example

def get_conversation_details(conversation_id, include_transcript=True, include_recording=True):
    url = f'https://api.ayra.ai/v1/conversations/{conversation_id}'
    headers = {
        'Authorization': 'Bearer sk_live_abc123xyz789'
    }
    
    params = {
        'include_transcript': include_transcript,
        'include_recording': include_recording,
        'include_analytics': True
    }
    
    response = requests.get(url, headers=headers, params=params)
    
    if response.status_code == 200:
        data = response.json()
        conversation = data['data']
        print(f"Conversation: {conversation['id']}")
        print(f"Duration: {conversation['duration']}s")
        print(f"Sentiment: {conversation['sentiment']}")
        return data
    else:
        print('Error:', response.json())
        raise Exception(f'Failed to get conversation: {response.status_code}')

# Example usage
conversation = get_conversation_details('conv_abc123xyz789')

# Access transcript if included
if 'transcript' in conversation['data']:
    print(f"Transcript: {conversation['data']['transcript'][:200]}...")

Response

Success Response (200 OK):

Note: The full response is extensive. Key fields include: id, agent_id, caller_number, status, duration, sentiment, transcript (with messages array), recording (with URL), analytics, and integrations.

{
  "data": {
    "id": "conv_abc123xyz789",
    "agent_id": "agent_abc123",
    "caller_number": "+15551234567",
    "status": "completed",
    "duration": 323,
    "sentiment": "positive",
    "sentiment_score": 0.87,
    "transcript": {
      "full_text": "Agent: Thank you for calling...",
      "messages": [...],
      "word_count": 156
    },
    "recording": {
      "url": "https://recordings.ayra.ai/conv_abc123xyz789.mp3",
      "duration": 323,
      "expires_at": "2025-02-15T14:35:23Z"
    },
    "analytics": {
      "interruptions": 0,
      "average_response_time": 1.8,
      "keywords_detected": ["billing", "refund"]
    }
  }
}

Error Responses

404 Not Found:

{
  "error": {
    "type": "not_found",
    "message": "Conversation not found",
    "code": "conversation_not_found"
  }
}

403 Forbidden - No Access:

{
  "error": {
    "type": "permission_error",
    "message": "You don't have permission to access this conversation",
    "code": "insufficient_permissions"
  }
}

Notes

  • Recording URLs are pre-signed and expire after the time specified in expires_at
  • Transcript messages include speaker timestamps allowing synchronization with recordings
  • In-progress conversations return partial data that updates in real-time
  • Sentiment scores range from -1 (very negative) to +1 (very positive)
  • Analytics data is computed asynchronously and may take a few seconds after call completion

Ready to transform your agency?

Start building with Ayra today. No credit card required.