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
Chat data object containing title and message history
Show Chat Object
Show Chat Object
Title for the chat
ID of the folder to place the chat in
Response
Unique identifier for the newly created chat
ID of the user who owns the chat
Chat title
Complete chat data object as provided in the request
Unix timestamp (epoch seconds) when chat was created
Unix timestamp (epoch seconds) when chat was last updated
ID for sharing the chat (null for new chats)
Whether the chat is archived (false for new chats)
Whether the chat is pinned (false for new chats)
Metadata object (empty for new chats)
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
}
⌘I