Skip to main content
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
object
required
Chat data object containing title and message history
folder_id
string
ID of the folder to place the chat in

Response

id
string
required
Unique identifier for the newly created chat
user_id
string
required
ID of the user who owns the chat
title
string
required
Chat title
chat
object
required
Complete chat data object as provided in the request
created_at
integer
required
Unix timestamp (epoch seconds) when chat was created
updated_at
integer
required
Unix timestamp (epoch seconds) when chat was last updated
share_id
string
ID for sharing the chat (null for new chats)
archived
boolean
required
Whether the chat is archived (false for new chats)
pinned
boolean
required
Whether the chat is pinned (false for new chats)
meta
object
Metadata object (empty for new chats)
folder_id
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
}