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.
Field | Value |
---|---|
API-KEY | <api-key> |
Content-Type | application/json |
Request Parameters
Required Parameters
Parameter | Type | Required | Description |
---|---|---|---|
type | string | ✔️ | Conversation type (see supported types below) |
title | string | ✔️ | Conversation title (maximum 91 characters) |
model | string | ✔️ | AI model to use for the conversation |
Optional Parameters
Parameter | Type | Required | Description |
---|---|---|---|
fileList | array | - | File ID list from Asset API (required for CHAT_WITH_PDF) |
Supported Conversation Types
Type | Description | fileList Required |
---|---|---|
CHAT_WITH_AI | Standard AI chat conversation | No |
CHAT_WITH_IMAGE | Chat with image analysis | No |
CHAT_WITH_PDF | Multi-document chat with PDFs | Yes |
Example Request
Basic Conversation
- JavaScript
- cURL
- Python
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'
})
})
curl --location 'https://api.1min.ai/api/conversations' \
--header 'API-KEY: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"title": "My AI Conversation",
"type": "CHAT_WITH_AI",
"model": "gpt-4o-mini"
}'
import requests
url = "https://api.1min.ai/api/conversations"
headers = {
"Content-Type": "application/json",
"API-KEY": "YOUR_API_KEY"
}
data = {
"title": "My AI Conversation",
"type": "CHAT_WITH_AI",
"model": "gpt-4o-mini"
}
response = requests.post(url, headers=headers, json=data)
Conversation with PDF Files
- JavaScript
- cURL
- Python
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'
]
})
})
curl --location 'https://api.1min.ai/api/conversations' \
--header 'API-KEY: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"title": "Document Analysis Chat",
"type": "CHAT_WITH_PDF",
"model": "gpt-4o-mini",
"fileList": [
"20ad0277-74df-4629-8c50-56a2549acbd7",
"73560309-5804-4092-99d7-0a262fba92f5"
]
}'
import requests
url = "https://api.1min.ai/api/conversations"
headers = {
"Content-Type": "application/json",
"API-KEY": "YOUR_API_KEY"
}
data = {
"title": "Document Analysis Chat",
"type": "CHAT_WITH_PDF",
"model": "gpt-4o-mini",
"fileList": [
"20ad0277-74df-4629-8c50-56a2549acbd7",
"73560309-5804-4092-99d7-0a262fba92f5"
]
}
response = requests.post(url, headers=headers, json=data)
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
Field | Type | Description |
---|---|---|
uuid | string | Unique identifier for the conversation |
title | string | Conversation title |
status | string | Conversation status (ACTIVE, INACTIVE, etc.) |
createdAt | string | Creation timestamp (ISO 8601) |
metadata | object | Conversation metadata (file stats, etc.) |
conversationFile | array | List of files associated with the conversation |
metadata Object
Field | Type | Description |
---|---|---|
fileToken | number | Total token count from files |
fileCharacter | number | Total character count from files |
conversationFile Object
Field | Type | Description |
---|---|---|
conversationId | string | Associated conversation ID |
fileId | string | File identifier from Asset API |
createdAt | string | File association creation timestamp |
createdBy | string | Who created the file association |
updatedAt | string | Last update timestamp |
updatedBy | string | Who 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"
}
}