Upload a visitor attachment

Validates visitor and conversation first, then reserves the entire multipart request length. Request limit: 201 MiB. Publications share a 1 GiB rolling 24-hour budget and a 100-reservation attempt limit. Failed/abandoned attempts still count. Returned files and file_token are staged, not yet associated with model runs. Sending attachments requires canonical parts/attachments and each file’s credential.

POST https://api.moi.matrixorigin.cn/v5/public/webapp/files

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.

Prepare links and visitor identity in the same environment. Do not supply a product PAT or workspace request headers.

Request

curl --request POST \
  "$BASE_URL/public/webapp/files?webapp=$AGENT_ID&t=$WEBAPP_TOKEN&s=$WEBAPP_SESSION&conversation_id=$CONVERSATION_ID" \
  --form "file=@$UPLOAD_FILE"

Parameter

Location

Type

Required

Description

webapp

Queries

string

Yes

Agent ID associated with the link.

t

Queries

string

Yes

Currently valid publication token. For short-code links, resolve first, then use the short code as t.

s

Queries

string

Yes

Visitor session credential for the same publication.

conversation_id

Queries

string

Yes

Current visitor’s active conversation ID.

file

Multipart form

file

Yes

File to upload; actual content at most 200 MiB.

Successful response

{
  "code": 0,
  "data": {
    "file_id": "file-example",
    "workspace_id": "workspace-example",
    "volume_id": 1,
    "name": "example.txt",
    "size": 5,
    "md5": "example-md5",
    "file_token": "example-file-credential"
  }
}

Success returns HTTP 200 and numeric code=0. Read data’s object descriptions alongside the example. The conversation creation example is only a field excerpt.

Error responses

Public errors and identity handling distinguishes unavailable/disabled links, invalid sessions, parameters, and system failures.

Last updated on