Create a UI protocol session record¶
Save a session record for the current user. This request does not call a model.
POST https://api.moi.matrixorigin.cn/v5/sessions
Before you call this API¶
Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5; use the corresponding product API URL for a dedicated deployment.
Configure identity, workspace, and numeric record IDs in the same environment. This entry point uses ordinary product authentication and rejects additional task-runtime authorization headers.
Request¶
curl --request POST \
"$BASE_URL/sessions" \
--header "X-API-Key: $MOI_KEY" \
--header "X-Workspace-ID: $WORKSPACE_ID" \
--header "Content-Type: application/json" \
--data-raw '{"title":"临时会话","config":"{}"}'
Parameter |
Location |
Type |
Required |
Description |
|---|---|---|---|---|
|
Headers |
string |
Yes |
Target workspace ID. |
|
Body |
string |
No |
Session title, default empty string. |
|
Body |
string |
No |
Application source. Omission, null, or an empty string uses moi. |
|
Body |
string |
No |
Configuration text; JSON configuration must also be a string. |
|
Body |
array (strings) |
No |
Request binding accepts this field, but the current creation operation does not save tag relationships. |
Success returns HTTP 200, unlike the workspace LLM creation API’s 201. Save the numeric ID returned. There is no business request_id deduplication; if the outcome is unknown, query first to avoid duplicate creation.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"id": 41,
"title": "临时会话",
"source": "moi",
"user_id": "user-example",
"config": "{}",
"tags": [],
"created_at": 1794445200,
"updated_at": 1794445200
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
OK on success; HTTP status 200. |
|
string |
OK on success. |
|
object |
Error responses¶
Error formats and result confirmation distinguishes session-detail not-found errors from generic service errors at other entry points.