curl -X POST "https://your-domain.com/api/chats/new" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chat": {
"title": "New AI Conversation",
"history": {
"messages": {
"msg-1": {
"id": "msg-1",
"role": "user",
"content": "Hello!",
"timestamp": 1709164800
}
},
"currentId": "msg-1"
}
},
"folder_id": null
}'
{
"id": "770g0622-g4bd-63f6-c938-668877662222",
"user_id": "user-123",
"title": "New AI Conversation",
"chat": {
"title": "New AI Conversation",
"history": {
"messages": {
"msg-1": {
"id": "msg-1",
"role": "user",
"content": "Hello!",
"timestamp": 1709164800
}
},
"currentId": "msg-1"
}
},
"created_at": 1709337600,
"updated_at": 1709337600,
"share_id": null,
"archived": false,
"pinned": false,
"meta": {},
"folder_id": null
}
Chat & Messages
Create Chat
Create a new chat conversation
POST
/
api
/
chats
/
new
curl -X POST "https://your-domain.com/api/chats/new" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chat": {
"title": "New AI Conversation",
"history": {
"messages": {
"msg-1": {
"id": "msg-1",
"role": "user",
"content": "Hello!",
"timestamp": 1709164800
}
},
"currentId": "msg-1"
}
},
"folder_id": null
}'
{
"id": "770g0622-g4bd-63f6-c938-668877662222",
"user_id": "user-123",
"title": "New AI Conversation",
"chat": {
"title": "New AI Conversation",
"history": {
"messages": {
"msg-1": {
"id": "msg-1",
"role": "user",
"content": "Hello!",
"timestamp": 1709164800
}
},
"currentId": "msg-1"
}
},
"created_at": 1709337600,
"updated_at": 1709337600,
"share_id": null,
"archived": false,
"pinned": false,
"meta": {},
"folder_id": null
}
Creates a new chat with the provided chat data and optional folder assignment.
Request Body
object
required
Chat data object containing title and message history
Show Chat Object
Show Chat Object
string
default:"New Chat"
Title for the chat
string
ID of the folder to place the chat in
Response
string
required
Unique identifier for the newly created chat
string
required
ID of the user who owns the chat
string
required
Chat title
object
required
Complete chat data object as provided in the request
integer
required
Unix timestamp (epoch seconds) when chat was created
integer
required
Unix timestamp (epoch seconds) when chat was last updated
string
ID for sharing the chat (null for new chats)
boolean
required
Whether the chat is archived (false for new chats)
boolean
required
Whether the chat is pinned (false for new chats)
object
Metadata object (empty for new chats)
string
ID of the folder containing this chat
curl -X POST "https://your-domain.com/api/chats/new" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chat": {
"title": "New AI Conversation",
"history": {
"messages": {
"msg-1": {
"id": "msg-1",
"role": "user",
"content": "Hello!",
"timestamp": 1709164800
}
},
"currentId": "msg-1"
}
},
"folder_id": null
}'
{
"id": "770g0622-g4bd-63f6-c938-668877662222",
"user_id": "user-123",
"title": "New AI Conversation",
"chat": {
"title": "New AI Conversation",
"history": {
"messages": {
"msg-1": {
"id": "msg-1",
"role": "user",
"content": "Hello!",
"timestamp": 1709164800
}
},
"currentId": "msg-1"
}
},
"created_at": 1709337600,
"updated_at": 1709337600,
"share_id": null,
"archived": false,
"pinned": false,
"meta": {},
"folder_id": null
}