Create a conversation¶
Create a local conversation with metadata and optional item summaries.
POST https://token.moi.matrixorigin.cn/v1/conversations
Before you begin¶
Prepare a personal access token with Genesis access.
Request body¶
Set $GENESIS_ACCESS_TOKEN to your personal access token.
curl -X POST "https://token.moi.matrixorigin.cn/v1/conversations" \
-H "Authorization: Bearer $GENESIS_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"metadata": {
"purpose": "support"
},
"items": [
{
"type": "message",
"role": "user"
}
]
}'
Local items retain summaries such as type, role, and status. Store message bodies in your application.
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
object |
No |
Custom conversation metadata. |
|
any |
No |
Caller-defined keys and values, such as |
|
array of object |
No |
Item summaries to add when creating the conversation. |
|
string |
No |
Item type, such as |
|
string |
No |
Item role, such as |
|
string |
No |
Item status; defaults to |
Successful response¶
A successful request returns the new conversation and its metadata.
{
"id": "$CONVERSATION_ID",
"object": "conversation",
"metadata": {
"purpose": "support"
},
"status": "active",
"created_at": 1780000000,
"updated_at": 1780000000
}
Field |
Type |
Description |
|---|---|---|
|
string |
Conversation identifier for retrieval, updates, and deletion. |
|
string |
Always |
|
object |
Custom conversation metadata. |
|
any |
Caller-defined keys and values, such as |
|
string |
Conversation status; |
|
integer |
Creation time as a Unix timestamp in seconds. |
|
integer |
Last update time as a Unix timestamp in seconds. |
Error response¶
HTTP 400 is returned when the request body is not a JSON object. Send an object before retrying.
{
"error": {
"message": "request body must be a JSON object",
"type": "invalid_request",
"code": "invalid_request"
}
}
Field |
Type |
Description |
|---|---|---|
|
object |
Error details. |
|
string |
Error description. |
|
string |
Error type. |
|
string |
Error code. |
Next steps¶
Keep the returned id to Retrieve a conversation or Create a conversation item.