Publish a child-task file artifact¶
Save a file generated by the current managed child task to its user’s chat file volume and publish a task artifact.
POST https://api.moi.matrixorigin.cn/v5/workspaces/{id}/runtime-artifacts
Before you call this API¶
Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5. For private deployments, use the corresponding product API URL.
Use the same MOI_ENDPOINT, MOI_API_KEY, MOI_RUNTIME_AUTHORIZATION, and MOI_WORKSPACE_ID connection group in the managed child environment. BASE_URL uses MOI_ENDPOINT; WORKSPACE_ID uses MOI_WORKSPACE_ID. MOI_RUNTIME_AUTHORIZATION already includes Bearer. An ordinary PAT cannot replace child-task identity.
Request parameters¶
curl --fail-with-body -sS -X POST "$BASE_URL/workspaces/$WORKSPACE_ID/runtime-artifacts" \
-H "X-API-Key: $MOI_API_KEY" \
-H "X-MOI-Runtime-Authorization: $MOI_RUNTIME_AUTHORIZATION" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-F "file=@$ARTIFACT_FILE"
Field |
Type |
Required |
Description |
|---|---|---|---|
|
file |
Yes |
Nonempty file, at most 32MiB each. File name must have no path and be at most 255 bytes. |
Use only the current child environment’s technical API key, runtime proof, and Workspace group, with a proof permitting artifact publication. An image-analysis proof without this capability is insufficient. agent.use and volume write permissions are checked before reading the upload body; write authorization is repeated at save time.
Successful response¶
{
"file_id": "file-example",
"original_name": "report.txt",
"size": 7,
"md5": "a9346fbaf920e99acc512e8dcc57fa3c",
"artifact_id": "artifact-example",
"sha256": "sha256:331d26d6d8f862e46ba900811be8a7a1e4dbaa229b14c99becfd5e5151490d95"
}
Field/response item |
Type |
Description |
|---|---|---|
|
string |
ID used to read the file. |
|
string |
Saved file name. |
|
integer |
File size in bytes. |
|
string |
Content MD5. |
|
string |
Task artifact ID, distinct from file_id. |
|
string |
Content digest with sha256: prefix. |
Successful responses have no uniform code/data wrapper; temporary files and image streams return bytes directly.
Error responses¶
{
"error_code": "runtime_artifact_upload_denied"
}
HTTP |
code/format |
Condition |
|---|---|---|
400 |
Numeric 2/message |
Path and single Workspace request header disagree. |
400 |
runtime_artifact_file_required |
No usable nonempty file part. |
400 |
runtime_artifact_upload_denied |
File name, artifact input, or task is ineligible for publication. |
403 |
runtime_artifact_upload_denied |
Artifact capability or authorization denied. |
413 |
runtime_artifact_upload_denied |
File or request limit exceeded. |
404 |
runtime_artifact_upload_denied |
Required file or business object missing. |
503 |
runtime_artifact_upload_unavailable |
Dependency or publication unavailable. |
Outer identity/task-proof rejection may precede this handler. Retain raw HTTP, machine codes, and actual diagnostics; do not apply other file-protocol error envelopes.