Skip to main content

Conversation API

Create conversation sessions for chat features, including AI chat, image analysis, and document chat.

Overview

The Conversation API allows you to create conversation sessions that serve as containers for chat interactions. These conversations can be used with different AI models and support various chat types including standard AI chat, image analysis, and document-based conversations.

Endpoint

Authentication

All requests require authentication using an API key in the request header.

FieldValue
API-KEY<api-key>
Content-Typeapplication/json

Request Parameters

Required Parameters

ParameterTypeRequiredDescription
typestring✔️Conversation type (see supported types below)
titlestring✔️Conversation title (maximum 91 characters)
modelstring✔️AI model to use for the conversation

Optional Parameters

ParameterTypeRequiredDescription
fileListarray-File ID list from Asset API (required for CHAT_WITH_PDF)

Supported Conversation Types

TypeDescriptionfileList Required
CHAT_WITH_AIStandard AI chat conversationNo
CHAT_WITH_IMAGEChat with image analysisNo
CHAT_WITH_PDFMulti-document chat with PDFsYes

Example Request

Basic Conversation

fetch('https://api.1min.ai/api/conversations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'API-KEY': 'YOUR_API_KEY'
},
body: JSON.stringify({
title: 'My AI Conversation',
type: 'CHAT_WITH_AI',
model: 'gpt-4o-mini'
})
})

Conversation with PDF Files

fetch('https://api.1min.ai/api/conversations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'API-KEY': 'YOUR_API_KEY'
},
body: JSON.stringify({
title: 'Document Analysis Chat',
type: 'CHAT_WITH_PDF',
model: 'gpt-4o-mini',
fileList: [
'20ad0277-74df-4629-8c50-56a2549acbd7',
'73560309-5804-4092-99d7-0a262fba92f5'
]
})
})

Response

Success Response (200)

{
"conversation": {
"uuid": "20ad0277-74df-4629-8c50-56a2549acbd7",
"title": "My AI Conversation",
"status": "ACTIVE",
"createdAt": "2024-09-30T06:35:42.236Z",
"metadata": {
"fileToken": 5006,
"fileCharacter": 17197
},
"conversationFile": [
{
"conversationId": "20ad0277-74df-4629-8c50-56a2549acbd7",
"fileId": "66effbd5-dcbf-47f7-9f0c-7a2a02bd5b11",
"createdAt": "2024-09-30T06:35:42.236Z",
"createdBy": "SYSTEM",
"updatedAt": "2024-09-30T06:35:42.236Z",
"updatedBy": "SYSTEM"
},
{
"conversationId": "20ad0277-74df-4629-8c50-56a2549acbd7",
"fileId": "73560309-5804-4092-99d7-0a262fba92f5",
"createdAt": "2024-09-30T06:35:42.236Z",
"createdBy": "SYSTEM",
"updatedAt": "2024-09-30T06:35:42.236Z",
"updatedBy": "SYSTEM"
}
]
}
}

Response Fields

conversation Object

FieldTypeDescription
uuidstringUnique identifier for the conversation
titlestringConversation title
statusstringConversation status (ACTIVE, INACTIVE, etc.)
createdAtstringCreation timestamp (ISO 8601)
metadataobjectConversation metadata (file stats, etc.)
conversationFilearrayList of files associated with the conversation

metadata Object

FieldTypeDescription
fileTokennumberTotal token count from files
fileCharacternumberTotal character count from files

conversationFile Object

FieldTypeDescription
conversationIdstringAssociated conversation ID
fileIdstringFile identifier from Asset API
createdAtstringFile association creation timestamp
createdBystringWho created the file association
updatedAtstringLast update timestamp
updatedBystringWho last updated the file association

Usage with AI Feature API

Once you have created a conversation using this API, you can use the conversation ID with the AI Feature API to send chat messages within the conversation context.

Example Chat with Context

{
"type": "CHAT_WITH_AI",
"conversationId": "20ad0277-74df-4629-8c50-56a2549acbd7",
"model": "gpt-4o-mini",
"promptObject": {
"prompt": "Hello, how can you help me?",
"isMixed": false,
"webSearch": false
}
}

Error Responses

Bad Request (400)

{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Missing required parameters or invalid format"
}
}

Unauthorized (401)

{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}

Forbidden (403)

{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "Insufficient permissions or quota exceeded"
}
}

Unprocessable Entity (422)

{
"success": false,
"error": {
"code": "UNPROCESSABLE_ENTITY",
"message": "Invalid file IDs or unsupported model"
}
}