Create conversation

POST/v1/conversations

Create a new conversation handle that can be passed to POST /v1/responses as conversation when the selected model supports conversation threading. This endpoint returns a conversation ID and echoes the supplied metadata.

Authentication

Authorization Bearer

API key as bearer token in Authorization header.

Request Body

modelstring

Model ID you plan to use. Also accepted as metadata.model_id.

Example: "glm-5.1"

metadataobjectdefault:{}

Custom metadata echoed by the response.

metadata.model_idstring

Model ID to associate with the conversation.

metadata.session_namestring

Human-readable session name.

metadata.titlestring

Conversation title.

sourcestringdefault:ep

Caller identifier, such as ep for end-user playground.

Response

idstring

Conversation ID. Format: conv_<24-hex-chars>.

objectstring

Always conversation.

created_atinteger

Unix timestamp.

main_conversation_idstring

Same as id. Included for clients that distinguish main and branch conversations.

metadataobject

Echo of the resolved metadata.

metadata.model_idstring

Resolved model ID.

metadata.session_namestring

Resolved session name.

metadata.titlestring

Resolved conversation title, when provided.

sourcestring

Echo of the request source.

Request

1curl -X POST https://api.token360.ai/v1/conversations \
2  -H "Authorization: Bearer sk-your-api-key" \
3  -H "Content-Type: application/json" \
4  -d '{
5    "model": "glm-5.1",
6    "metadata": {"session_name": "Project Discussion"}
7  }'

Response

1{
2  "id": "your-conversation-id",
3  "object": "conversation",
4  "created_at": 1776351739,
5  "main_conversation_id": "your-conversation-id",
6  "metadata": {
7    "model_id": "glm-5.1",
8    "session_name": "Project Discussion"
9  },
10  "source": "ep"
11}
Was this page helpful?