AIChatGetArtifact¶
GET ai/chat/artifact
Returns a full artifact of an answer. Runs and the conversation history carry only a short
descriptor (result.artifacts, message.metadata.artifacts); the full code is loaded here,
on demand.
Today the only type is stscript.source_proposal of the
StScript assistant: the code the editor had when the question was asked
(base), the proposed new code (proposal) and the report of the server check. An artifact
never changes after it is created.
Access Control¶
Allowed: client, manager, admin. Only artifacts of the current session, account and an
existing conversation. A foreign, deleted or unknown artifact gives the same 404.
Request¶
GET https://{broker_domain}/ai/chat/artifact?artifactId=art_…&accountLogin=7777864
Authorization: <JWT_TOKEN>
{
"command": "AIChatGetArtifact",
"extID": "1",
"data": { "artifactId": "art_…", "accountLogin": 7777864 }
}
const artifact = await platform.AIChatGetArtifact({ artifactId, accountLogin });
Parameters¶
| Parameter | Type | Description |
|---|---|---|
artifactId |
string | Id from result.artifacts of AIChatGetRun or from the history |
accountLogin |
int | Account context. Must be the account of the original request: after switching the account the old artifact is not returned |
Response Data¶
{
"id": "art_…",
"type": "stscript.source_proposal",
"schema": 1,
"runId": "run_…",
"conversationId": "conv_…",
"messageId": "msg_…",
"createdAt": "2026-10-15T12:00:00Z",
"accountLogin": 7777864,
"runtimeId": "stscript-dsl-sha256:3de9a0c52570c0657861ab27d2ca22d3e46a59015e87043ae066c270cc236c99",
"referenceVersion": "reference-…",
"operation": "modify",
"title": "EMA",
"summary": "Added a second EMA.",
"changes": ["Added input slowLength", "Added a plot of the second average"],
"base": {
"documentId": "a3cb73aa-f567-4105-b080-14cb172ef1c9",
"documentVersion": 12,
"scriptId": 42,
"kind": "indicator",
"sourceHash": "sha256:…",
"source": "script(\"EMA\", kind=\"indicator\")\ninput length = 20\nma = ta.ema(close, length)\nplot(ma)\n"
},
"proposal": {
"language": "stscript",
"kind": "indicator",
"sourceHash": "sha256:…",
"source": "script(\"EMA\", kind=\"indicator\")\ninput length = 20\ninput slowLength = 50\nma = ta.ema(close, length)\nslow = ta.ema(close, slowLength)\nplot(ma)\nplot(slow)\n"
},
"validation": {
"schema": 1,
"runtimeId": "stscript-dsl-sha256:3de9a0c52570c0657861ab27d2ca22d3e46a59015e87043ae066c270cc236c99",
"referenceVersion": "reference-…",
"sourceHash": "sha256:…",
"status": "passed",
"checks": { "parse": "passed", "validate": "passed", "compile": "passed", "policy": "passed" },
"execution": { "status": "not_run", "reason": "NOT_ENABLED" },
"diagnostics": [],
"limitations": ["NO_BACKTEST", "NO_LIVE_EXECUTION"]
},
"canApply": true
}
| Field | Description |
|---|---|
base |
The snapshot the request was made with. Before applying, the editor must still hold base.sourceHash in the same documentId |
base.kind, proposal.kind |
The kind of the document when the request was made and the kind declared by the proposal's script(...). They may differ: asked to turn an indicator into a robot, the assistant proposes a robot, checked as a robot — robot validation and the dryRun = 1 policy |
proposal.source |
The complete new source — not a patch. Build the difference from base.source and proposal.source |
validation |
The server check of exactly proposal.sourceHash; see Validation report |
canApply |
true only when validation.status is passed. A failed proposal is returned for review with canApply: false |
canApply is the server's verdict on the proposal, not on the open editor: the interface
still checks the account, document, runtime and base hash, verifies that proposal.source
hashes to proposal.sourceHash, re-checks it with the local validator and applies it only
by an explicit user action. See Apply a proposal.
Errors¶
| Code | Error | Description |
|---|---|---|
400 |
AI_INVALID_DATA |
A client session of an account owner did not pass accountLogin |
403 |
AI_ACCESS_DENIED |
The session type may not use the assistant |
404 |
AI_ARTIFACT_NOT_FOUND |
Unknown artifact, an artifact of another session or account, or its conversation was deleted |