The Conversations REST API provides complete management of conversation threads between personas and contacts. Handle conversation lifecycle, threading, context management, and integration with external platforms.
Base URL: https://your-api-name.mercury.ratiomachina.com Authentication: x-mercury-api-key: YOUR_API_KEY
No query parameters supported. Returns all conversations.
{
"conversations": [
{
"id": "456e7890-e89b-12d3-a456-426614174000",
"externalId": "conv789",
"personaId": "789e4567-e89b-12d3-a456-426614174000",
"contactId": "123e4567-e89b-12d3-a456-426614174000",
"personaName": "Sales Agent",
"contactName": "John Doe",
"contactEmail": "john@example.com",
"data": {"channel": "SMS", "priority": "high"},
"createdAt": "2024-01-15T10:35:00Z",
"updatedAt": "2024-01-15T10:45:00Z",
"messageCount": 8,
"latestMessage": {
"sender": "persona",
"message": "Thank you for your interest in our product!"
}
}
]
}{
"contactExternalId": "customer123",
"personaExternalId": "agent456",
"conversationExternalId": "conv789",
"conversationData": {
"channel": "SMS",
"priority": "high"
},
"contactData": {
"source": "website"
},
"personaData": {
"tone": "friendly"
},
"senderMessage": "Hello, I'm interested in your product",
"senderExternalId": "customer123",
"generatePersonaMessage": true,
"addGeneratedMessageToConversation": true
}{
"conversation": {
"id": "456e7890-e89b-12d3-a456-426614174000",
"externalId": "conv789",
"personaId": "789e4567-e89b-12d3-a456-426614174000",
"contactId": "123e4567-e89b-12d3-a456-426614174000",
"persona": {
"id": "789e4567-e89b-12d3-a456-426614174000",
"externalId": "agent456",
"name": "Sales Agent",
"role": "sales",
"data": {"tone": "friendly"}
},
"contact": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "customer123",
"name": "John Doe",
"email": "john@example.com",
"data": {"source": "website"}
},
"data": {"channel": "SMS"},
"messages": [
{
"id": "abc12345-e89b-12d3-a456-426614174000",
"conversationId": "456e7890-e89b-12d3-a456-426614174000",
"sender": "contact",
"message": "Hello, I'm interested in your product",
"data": {},
"createdAt": "2024-01-15T10:35:00Z"
}
],
"lastMessage": {
"id": "abc12345-e89b-12d3-a456-426614174000",
"sender": "contact",
"message": "Hello, I'm interested in your product",
"createdAt": "2024-01-15T10:35:00Z"
},
"createdAt": "2024-01-15T10:35:00Z",
"updatedAt": "2024-01-15T10:35:00Z"
},
"generatedPersonaMessage": {
"message": "Thank you for your interest! How can I help you today?",
"messageType": "initial",
"status": "complete"
}
}external_id - Conversation external IDNo query parameters supported.
{
"conversation": {
"id": "456e7890-e89b-12d3-a456-426614174000",
"externalId": "conv789",
"personaId": "789e4567-e89b-12d3-a456-426614174000",
"contactId": "123e4567-e89b-12d3-a456-426614174000",
"data": {"channel": "SMS"},
"createdAt": "2024-01-15T10:35:00Z",
"updatedAt": "2024-01-15T10:45:00Z",
"messages": [
{
"id": "abc12345-e89b-12d3-a456-426614174000",
"conversationId": "456e7890-e89b-12d3-a456-426614174000",
"sender": "contact",
"message": "Hello, I need help",
"data": {},
"createdAt": "2024-01-15T10:35:00Z"
}
],
"persona": {
"id": "789e4567-e89b-12d3-a456-426614174000",
"externalId": "agent456",
"name": "Sales Agent",
"data": {"tone": "friendly"},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
},
"contact": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "customer123",
"name": "John Doe",
"email": "john@example.com",
"phone": "555-0123",
"data": {"source": "website"},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}
}Updates conversation data field. Supports partial updates - only provided fields will be modified.
{
"data": {
"status": "active",
"priority": "high",
"channel": "SMS"
}
}{
"conversation": {
"id": "456e7890-e89b-12d3-a456-426614174000",
"externalId": "conv789",
"contactId": "123e4567-e89b-12d3-a456-426614174000",
"personaId": "789e4567-e89b-12d3-a456-426614174000",
"data": {"status": "active", "priority": "high"},
"createdAt": "2024-01-15T10:35:00Z",
"updatedAt": "2024-01-15T11:45:00Z",
"persona": {
"name": "Sales Agent",
"externalId": "agent456"
},
"contact": {
"name": "John Doe",
"externalId": "customer123"
}
}
}⚠️ Warning: Deleting a conversation will permanently remove all messages and cannot be undone. Consider archiving for data retention and compliance.
external_id - Conversation external IDNo query parameters supported.
{
"message": "Conversation deleted successfully",
"deletedConversation": {
"id": "456e7890-e89b-12d3-a456-426614174000",
"externalId": "conv789",
"external_id": "conv789",
"contactId": "123e4567-e89b-12d3-a456-426614174000",
"contact_id": "123e4567-e89b-12d3-a456-426614174000",
"personaId": "789e4567-e89b-12d3-a456-426614174000",
"persona_id": "789e4567-e89b-12d3-a456-426614174000"
}
}Archive multiple conversations by their external IDs instead of deleting them. Archived conversations retain all data.
{
"external_ids": [
"sales-lead-john-001",
"support-ticket-mary-456"
]
}{
"message": "2 conversation(s) archived successfully",
"archived": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "sales-lead-john-001",
"name": "Sales Lead John",
"archived": true
},
{
"id": "123e4567-e89b-12d3-a456-426614174001",
"externalId": "support-ticket-mary-456",
"name": "Support Ticket Mary",
"archived": true
}
],
"archived_count": 2,
"already_archived_count": 0,
"not_found_count": 0
}Delete multiple conversations by their external IDs.
⚠️ Warning: This will permanently delete the conversations and all associated messages.
{
"external_ids": [
"sales-lead-john-001",
"support-ticket-mary-456"
]
}{
"message": "2 conversation(s) deleted successfully",
"deletedCount": 2,
"deletedConversations": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "sales-lead-john-001",
"name": "Sales Lead John"
},
{
"id": "123e4567-e89b-12d3-a456-426614174001",
"externalId": "support-ticket-mary-456",
"name": "Support Ticket Mary"
}
],
"notFound": []
}