{"openapi":"3.1.0","info":{"title":"KLinePic Agent API","version":"2026-06-02","summary":"Trade review chart API for external agents with a quota-limited free tier.","description":"Use this contract to discover KLinePic Agent API endpoints, authentication, idempotency, quota-aware responses, async batch jobs, image download, and callback semantics. The Free plan includes 30 chart renders and 2 batch jobs per month with a required KLinePic watermark. Preflight does not consume render quota.","termsOfService":"https://klinepic.com/TERMS.md","contact":{"name":"KLinePic","url":"https://klinepic.com/guides/trade-review-chart-api/"},"license":{"name":"Proprietary","url":"https://klinepic.com/TERMS.md"}},"servers":[{"url":"https://klinepic.com","description":"Production"}],"tags":[{"name":"Agent API","description":"Endpoints intended for automation and external agents."}],"paths":{"/api/agents/openapi.json":{"get":{"tags":["Agent API"],"summary":"Download the machine-readable Agent API contract","operationId":"getAgentOpenApi","security":[],"responses":{"200":{"description":"OpenAPI document","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/me":{"get":{"tags":["Agent API"],"summary":"Check credential, quota, policy, and endpoint capabilities","operationId":"getAgentCapability","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"responses":{"200":{"description":"Credential and quota snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCapabilityResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/preflight":{"post":{"tags":["Agent API"],"summary":"Validate a chart or batch request and estimate quota before rendering","operationId":"preflightAgentReviewRequest","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPreflightRequest"}}}},"responses":{"200":{"description":"No-charge validation and quota projection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPreflightResponse"}}}},"400":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-chart":{"post":{"tags":["Agent API"],"summary":"Generate one trade review chart","operationId":"createAgentReviewChart","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewChartRequest"}}}},"responses":{"200":{"description":"JSON chart payload or raw image bytes when responseFormat is png, jpeg, or webp.","headers":{"x-agent-request-id":{"schema":{"type":"string"},"description":"Resolved request id."},"x-kline-idempotent-replay":{"schema":{"type":"string","enum":["1"]},"description":"Present when the response was replayed from idempotency storage."},"x-kline-image-format":{"schema":{"type":"string","enum":["png","jpeg","webp"]},"description":"Raw image format when responseFormat is png, jpeg, or webp."},"x-kline-image-mime-type":{"schema":{"type":"string","enum":["image/png","image/jpeg","image/webp"]},"description":"Raw image MIME type when responseFormat is png, jpeg, or webp."},"x-kline-image-bytes":{"schema":{"type":"integer"},"description":"Raw image byte size when responseFormat is png, jpeg, or webp."},"x-kline-image-sha256":{"schema":{"type":"string"},"description":"SHA-256 digest of the raw image bytes."},"x-kline-image-width":{"schema":{"type":"integer"},"description":"Image width in pixels when known."},"x-kline-image-height":{"schema":{"type":"integer"},"description":"Image height in pixels when known."},"x-kline-png-bytes":{"schema":{"type":"integer"},"description":"PNG byte size when responseFormat=png."},"x-kline-png-sha256":{"schema":{"type":"string"},"description":"SHA-256 digest of the PNG bytes when responseFormat=png."},"x-kline-png-valid":{"schema":{"type":"boolean"},"description":"Whether the returned bytes have a valid PNG header when responseFormat=png."},"x-kline-png-width":{"schema":{"type":"integer"},"description":"PNG width when responseFormat=png and the PNG header is valid."},"x-kline-png-height":{"schema":{"type":"integer"},"description":"PNG height when responseFormat=png and the PNG header is valid."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewChartResponse"}},"image/png":{"schema":{"type":"string","contentEncoding":"binary"}},"image/jpeg":{"schema":{"type":"string","contentEncoding":"binary"}},"image/webp":{"schema":{"type":"string","contentEncoding":"binary"}}}},"400":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch":{"post":{"tags":["Agent API"],"summary":"Create an async batch review chart job","operationId":"createAgentReviewBatch","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewBatchCreateRequest"}}}},"responses":{"202":{"description":"Batch job accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewBatchCreateResponse"}}}},"400":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch/{jobId}/retry":{"post":{"tags":["Agent API"],"summary":"Retry failed trades from an async batch review job","operationId":"retryAgentReviewBatchFailures","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewBatchRetryRequest"}}}},"responses":{"202":{"description":"Retry batch job accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewBatchCreateResponse"}}}},"400":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch/{jobId}":{"get":{"tags":["Agent API"],"summary":"Read async batch status and generated image links","operationId":"getAgentReviewBatch","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"responses":{"200":{"description":"Batch job status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewBatchStatusResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch/{jobId}/wait":{"get":{"tags":["Agent API"],"summary":"Wait briefly for an async batch job to reach a terminal state","operationId":"waitForAgentReviewBatch","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}},{"name":"timeoutMs","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":60000,"default":25000},"description":"Maximum time to hold the request before returning the latest job snapshot."},{"name":"intervalMs","in":"query","required":false,"schema":{"type":"integer","minimum":250,"maximum":5000,"default":1000},"description":"Polling interval used by the server while waiting."},{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"responses":{"200":{"description":"Latest batch job status, with wait metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewBatchWaitResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch/{jobId}/events":{"get":{"tags":["Agent API"],"summary":"Stream async batch progress as server-sent events","operationId":"streamAgentReviewBatchEvents","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}},{"name":"timeoutMs","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":300000,"default":60000},"description":"Maximum time to keep the event stream open before sending batch.timeout."},{"name":"intervalMs","in":"query","required":false,"schema":{"type":"integer","minimum":250,"maximum":5000,"default":1000},"description":"Polling interval used by the server between progress snapshots."},{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"responses":{"200":{"description":"Server-sent batch.snapshot, batch.terminal, or batch.timeout events","content":{"text/event-stream":{"schema":{"type":"string"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch/{jobId}/manifest":{"get":{"tags":["Agent API"],"summary":"Return a machine-readable artifact manifest for a batch job","operationId":"getAgentReviewBatchManifest","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"responses":{"200":{"description":"Batch artifact manifest with URLs, hashes, sizes, and PNG dimensions where available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentReviewBatchManifestResponse"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch/{jobId}/images/{fileName}":{"get":{"tags":["Agent API"],"summary":"Download one generated PNG from a batch job","operationId":"getAgentReviewBatchImage","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}},{"name":"fileName","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"responses":{"200":{"description":"PNG image","content":{"image/png":{"schema":{"type":"string","contentEncoding":"binary"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/agents/review-batch/{jobId}/archive":{"get":{"tags":["Agent API"],"summary":"Download all successful batch images as a ZIP archive","operationId":"getAgentReviewBatchArchive","security":[{"bearerAuth":[]},{"xKlineAgentKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-Agent-Request-Id","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Stable client request id for idempotency and support lookup."}],"responses":{"200":{"description":"ZIP archive","content":{"application/zip":{"schema":{"type":"string","contentEncoding":"binary"}}}},"401":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Authentication or policy failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"webhooks":{"agentBatchCompleted":{"post":{"tags":["Agent API"],"summary":"Agent batch completion callback","description":"KLinePic sends this request to the caller-supplied callbackUrl when a batch reaches a terminal state.","operationId":"postAgentBatchCompletedCallback","security":[],"parameters":[{"name":"x-kline-event","in":"header","required":true,"schema":{"type":"string","const":"batch.completed"},"description":"Callback event name."},{"name":"x-kline-batch-job-id","in":"header","required":true,"schema":{"type":"string"},"description":"Batch job id in the callback payload."},{"name":"x-kline-signature","in":"header","required":false,"schema":{"type":"string","pattern":"^[a-f0-9]{64}$"},"description":"Hex HMAC-SHA256 over the raw JSON body when callback signing is configured."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentBatchCallbackPayload"}}}},"responses":{"200":{"description":"Callback accepted."},"204":{"description":"Callback accepted with no response body."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Use Authorization: Bearer <kline_agent_...>. Account tokens also work for owner-side calls."},"xKlineAgentKey":{"type":"apiKey","in":"header","name":"X-KLine-Agent-Key","description":"Alternative header for Agent API keys."}},"schemas":{"ErrorResponse":{"type":"object","required":["ok","code","message","requestId"],"properties":{"ok":{"type":"boolean","const":false},"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"issues":{"type":"array","items":{"type":"object","additionalProperties":true}}},"additionalProperties":true},"AgentCapabilityResponse":{"type":"object","required":["ok","requestId","credential","account","capabilities"],"properties":{"ok":{"type":"boolean","const":true},"requestId":{"type":"string"},"credential":{"type":"object","additionalProperties":true},"account":{"type":"object","additionalProperties":true},"availability":{"type":"object","properties":{"apiAvailable":{"type":"boolean"},"code":{"type":"string"},"message":{"type":"string"}},"additionalProperties":true},"capabilities":{"$ref":"#/components/schemas/AgentCapabilities"}}},"AgentCapabilities":{"type":"object","required":["openApi","responseFormats","recommendedDataSource","allowedDataSources","templateIds","layoutPresets","indicatorProfiles","endpoints"],"properties":{"openApi":{"type":"string","const":"/api/agents/openapi.json"},"responseFormats":{"type":"array","items":{"type":"string","enum":["json","png","jpeg","webp"]}},"recommendedDataSource":{"type":"string","const":"csv"},"allowedDataSources":{"type":"array","items":{"type":"string"}},"templateIds":{"type":"array","items":{"type":"string","enum":["clean-review","content-card","risk-first","minimal","team-branded"]}},"layoutPresets":{"type":"array","items":{"type":"string","enum":["standard","compact","wide","square"]}},"indicatorProfiles":{"type":"array","items":{"type":"string","enum":["standard","trend","momentum","risk","minimal"]}},"endpoints":{"type":"object","additionalProperties":true},"idempotency":{"type":"object","additionalProperties":true},"callback":{"type":"object","additionalProperties":true}}},"AgentIndicatorConfig":{"type":"object","required":["ma","ema","volumeMa","macd","kdj","rsi","boll","atr","vwap"],"properties":{"ma":{"type":"array","items":{"type":"object","required":["period","visible"],"properties":{"period":{"type":"integer","minimum":1},"visible":{"type":"boolean"}},"additionalProperties":false}},"ema":{"type":"array","items":{"type":"object","required":["period","visible"],"properties":{"period":{"type":"integer","minimum":1},"visible":{"type":"boolean"}},"additionalProperties":false}},"volumeMa":{"type":"array","items":{"type":"object","required":["period","visible"],"properties":{"period":{"type":"integer","minimum":1},"visible":{"type":"boolean"}},"additionalProperties":false}},"macd":{"type":"object","required":["fast","slow","signal","visible"],"properties":{"fast":{"type":"integer","minimum":1},"slow":{"type":"integer","minimum":1},"signal":{"type":"integer","minimum":1},"visible":{"type":"boolean"}},"additionalProperties":false},"kdj":{"type":"object","required":["n","m1","m2","visible"],"properties":{"n":{"type":"integer","minimum":1},"m1":{"type":"integer","minimum":1},"m2":{"type":"integer","minimum":1},"visible":{"type":"boolean"}},"additionalProperties":false},"rsi":{"type":"object","required":["period","visible"],"properties":{"period":{"type":"integer","minimum":1},"visible":{"type":"boolean"}},"additionalProperties":false},"boll":{"type":"object","required":["period","stdMult","visible"],"properties":{"period":{"type":"integer","minimum":1},"stdMult":{"type":"number","exclusiveMinimum":0},"visible":{"type":"boolean"}},"additionalProperties":false},"atr":{"type":"object","required":["period","visible"],"properties":{"period":{"type":"integer","minimum":1},"visible":{"type":"boolean"}},"additionalProperties":false},"vwap":{"type":"object","required":["anchor","visible"],"properties":{"anchor":{"type":"string","enum":["daily","holding","custom"]},"customStart":{"type":"string","format":"date-time"},"visible":{"type":"boolean"}},"additionalProperties":false}},"additionalProperties":true},"AgentThemeOverrides":{"type":"object","additionalProperties":false,"description":"Hex-only color overrides. Use #RRGGBB values; arbitrary CSS strings are not accepted.","properties":{"background":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"grid":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"axis":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"candleUp":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"candleDown":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"candleLimitUp":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"candleLimitDown":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"ma":{"type":"array","items":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"minItems":1,"maxItems":8},"ema":{"type":"array","items":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"minItems":1,"maxItems":8},"boll":{"type":"object","additionalProperties":false,"properties":{"middle":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"upper":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"lower":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"}}},"vwap":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"macd":{"type":"object","additionalProperties":false,"properties":{"dif":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"dea":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"histogramUp":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"histogramDown":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"}}},"kdj":{"type":"object","additionalProperties":false,"properties":{"k":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"d":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"j":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"}}},"rsi":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"atr":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"volume":{"type":"object","additionalProperties":false,"properties":{"up":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"down":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"ma":{"type":"array","items":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"minItems":1,"maxItems":8}}},"annotations":{"type":"object","additionalProperties":false,"properties":{"buyMarker":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"sellMarker":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"buyPriceLine":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"sellPriceLine":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"holdingBg":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"maxProfit":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"drawdown":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"dividend":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"}}},"infoPanel":{"type":"object","additionalProperties":false,"properties":{"bg":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"border":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"text":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"label":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"valuePositive":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"valueNegative":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"accentCyan":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"accentRed":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"},"accentPurple":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"}}},"watermark":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","example":"#10b981"}}},"AgentStyleOverrides":{"type":"object","additionalProperties":false,"description":"Safe numeric size controls for SVG decorations. Omit to keep the template default sizes.","properties":{"annotation":{"type":"object","additionalProperties":false,"description":"Controls trade labels, marker triangles/circles, and annotation line widths.","properties":{"textScale":{"type":"number","minimum":0.6,"maximum":1.8,"default":1,"description":"Scales annotation label text."},"markerScale":{"type":"number","minimum":0.6,"maximum":2,"default":1,"description":"Scales trade marker triangles and point circles."},"lineWidthScale":{"type":"number","minimum":0.5,"maximum":2.5,"default":1,"description":"Scales SVG annotation strokes such as price lines and connectors."}}},"watermark":{"type":"object","additionalProperties":false,"properties":{"textScale":{"type":"number","minimum":0.6,"maximum":1.8,"default":1,"description":"Scales the built-in rendered watermark text."}}}}},"AgentChartOutput":{"type":"object","additionalProperties":false,"properties":{"layoutPreset":{"type":"string","enum":["standard","compact","wide","square"],"default":"standard","description":"standard=1280x800@2x, compact=960x600@1x, wide=1280x720@2x, square=1200x1200@1x. Explicit width, height, or scale wins over the preset."},"width":{"type":"integer","minimum":640,"maximum":4096,"default":1280},"height":{"type":"integer","minimum":400,"maximum":4096,"default":800},"scale":{"type":"number","minimum":1,"maximum":3,"default":2,"description":"PNG pixel ratio. 1280x800 with scale=2 returns a 2560x1600 PNG."},"locale":{"type":"string","enum":["zh-CN","zh-TW","en-US","ja-JP","ko-KR"],"default":"zh-CN","description":"Language used for rendered chart labels and built-in watermark text."},"timezone":{"type":"string","example":"America/New_York","description":"Optional IANA timezone used for displayed timestamps. It does not change trade math or data matching."},"showInfoPanel":{"type":"boolean","default":true,"description":"Set false to remove the right-side summary panel and give the K-line more horizontal room."},"infoPanelFields":{"type":"array","items":{"type":"string","enum":["returnPct","pnlAmount","maxProfit","maxDrawdown","turnover","holdingTime","buyTime","sellTime","direction","entryCount","exitCount","entryAvg","exitAvg","entryAmount","exitAmount","holdingBars","maxProfitTime","drawdownRange","benchmark","postExitMove","postExitTime"]},"minItems":1,"maxItems":21,"description":"Optional allow-list for right-side summary panel metrics. Omit it to render the full panel."},"infoPanelMode":{"type":"string","enum":["reserved","overlay"],"default":"reserved","description":"reserved keeps chart space clear for the summary panel. overlay places the panel over the chart and is mainly useful for compact previews."},"annotationDensity":{"type":"string","enum":["smart","full","balanced","minimal","none"],"default":"smart","description":"Controls chart annotation detail. smart clusters crowded buy/sell markers, full keeps all labels, balanced keeps trade labels with less range detail, minimal keeps only markers/range, none hides SVG annotations."},"markerLabelTemplate":{"type":"string","minLength":1,"maxLength":96,"example":"{label} {price} x{quantity}","description":"Optional template for buy/sell marker labels. Supported tokens: {label}, {action}, {side}, {price}, {quantity}, {tradeId}, {symbol}, {name}, {fee}, {note}. Omit it to keep the built-in localized labels."},"themeOverrides":{"$ref":"#/components/schemas/AgentThemeOverrides"},"styleOverrides":{"$ref":"#/components/schemas/AgentStyleOverrides"},"showWatermark":{"type":"boolean","default":true},"watermark":{"oneOf":[{"type":"string","minLength":1,"maxLength":120},{"type":"boolean"}],"description":"Custom watermark text, or false to hide the default watermark."},"title":{"type":"string","minLength":1,"maxLength":160},"subtitle":{"type":"string","minLength":1,"maxLength":160},"footer":{"type":"string","minLength":1,"maxLength":160},"logoText":{"type":"string","minLength":1,"maxLength":48,"description":"Short text logo badge, for example a strategy or team name."}}},"AgentChartPayload":{"type":"object","required":["tradesText","tradesFormat","symbol","source"],"properties":{"templateId":{"type":"string","enum":["clean-review","content-card","risk-first","minimal","team-branded"],"example":"clean-review","description":"Built-in chart style. It fills common defaults for window size, indicators, sub-panels, imageTheme, and layout. Caller fields still override the template."},"tradesText":{"type":"string","minLength":1,"description":"Trade events as CSV or JSON. CSV columns: trade_id,symbol,event_type,position_side,time,price,quantity. Optional columns include name,fee,note.","example":"trade_id,symbol,event_type,position_side,time,price,quantity\nT1,BTCUSDT,buy,long,2024-01-02T12:00:00.000Z,42210,0.2\nT1,BTCUSDT,sell,long,2024-01-02T14:30:00.000Z,43020,0.2"},"tradesFormat":{"type":"string","enum":["csv","json"],"example":"csv"},"preBars":{"type":"integer","minimum":1,"default":120,"example":120,"description":"Number of bars to show before the first trade event. Defaults from templateId or 120."},"postBars":{"type":"integer","minimum":0,"default":40,"example":40,"description":"Number of bars to show after the last trade event. Defaults from templateId or 40."},"minDisplayBars":{"type":"integer","minimum":1,"default":80,"example":80},"indicatorConfig":{"$ref":"#/components/schemas/AgentIndicatorConfig","description":"Raw indicator settings. Omit this when templateId or indicatorProfile is enough. If both are present, raw fields override the selected profile."},"indicatorProfile":{"type":"string","enum":["standard","trend","momentum","risk","minimal"],"example":"momentum","default":"standard","description":"Reusable named indicator combination. It fills indicatorConfig and default sub-panels unless the caller supplies raw indicatorConfig or showSubPanels."},"showSubPanels":{"type":"array","items":{"type":"string","enum":["volume","macd","kdj","rsi","atr","pnl"]},"example":["volume","pnl"],"default":["volume","pnl"]},"imageTheme":{"type":"string","enum":["darkUs","darkCn","lightUs","lightCn"],"example":"darkUs","default":"darkUs","description":"Output image style. This controls the generated chart only, not the website light/dark mode."},"theme":{"type":"string","enum":["darkUs","darkCn","lightUs","lightCn"],"example":"darkUs","default":"darkUs","deprecated":true,"description":"Deprecated alias for imageTheme. It is still accepted for old callers."},"layoutPreset":{"type":"string","enum":["standard","compact","wide","square"],"example":"wide","description":"Convenience layout applied before explicit width, height, or scale. You can also put this field under output."},"output":{"$ref":"#/components/schemas/AgentChartOutput","description":"Optional PNG layout, size, scale, locale/timezone, and branding text. This is applied to both single chart and batch chart output."},"period":{"type":"string","enum":["1m","5m","15m","30m","60m","1h","4h","1d"],"default":"1d","example":"15m"},"market":{"type":"string","enum":["cn-a","us-stock","crypto","futures","forex"],"default":"cn-a","example":"crypto"},"source":{"type":"string","enum":["tushare","akshare","binance","csv"],"example":"csv","description":"Use csv for the most stable paid API integration. Other values are available only when enabled on the server."},"klineCsv":{"type":"string","minLength":1,"description":"Required when source=csv. CSV columns: symbol,time,open,high,low,close,volume. Optional columns include amount,adjust.","example":"symbol,time,open,high,low,close,volume\nBTCUSDT,2024-01-02T12:00:00.000Z,42310,42450,42180,42210,1080"},"tushareToken":{"type":"string","description":"Required when source=tushare. Do not send this unless the caller intentionally uses Tushare."},"symbol":{"type":"string","minLength":1,"maxLength":32,"example":"BTCUSDT","description":"The symbol to render for this single chart. It must match the trade records and K-line CSV."}},"allOf":[{"if":{"properties":{"source":{"const":"csv"}},"required":["source"]},"then":{"properties":{"klineCsv":{}},"required":["klineCsv"]}},{"if":{"properties":{"source":{"const":"tushare"}},"required":["source"]},"then":{"properties":{"tushareToken":{}},"required":["tushareToken"]}}],"additionalProperties":true},"AgentBatchPayload":{"type":"object","required":["tradesText","tradesFormat","source"],"properties":{"templateId":{"type":"string","enum":["clean-review","content-card","risk-first","minimal","team-branded"],"example":"clean-review","description":"Built-in chart style. It fills common defaults for window size, indicators, sub-panels, imageTheme, and layout. Caller fields still override the template."},"tradesText":{"type":"string","minLength":1,"description":"Trade events as CSV or JSON. CSV columns: trade_id,symbol,event_type,position_side,time,price,quantity. Optional columns include name,fee,note.","example":"trade_id,symbol,event_type,position_side,time,price,quantity\nT1,BTCUSDT,buy,long,2024-01-02T12:00:00.000Z,42210,0.2\nT1,BTCUSDT,sell,long,2024-01-02T14:30:00.000Z,43020,0.2"},"tradesFormat":{"type":"string","enum":["csv","json"],"example":"csv"},"preBars":{"type":"integer","minimum":1,"default":120,"example":120,"description":"Number of bars to show before the first trade event. Defaults from templateId or 120."},"postBars":{"type":"integer","minimum":0,"default":40,"example":40,"description":"Number of bars to show after the last trade event. Defaults from templateId or 40."},"minDisplayBars":{"type":"integer","minimum":1,"default":80,"example":80},"indicatorConfig":{"$ref":"#/components/schemas/AgentIndicatorConfig","description":"Raw indicator settings. Omit this when templateId or indicatorProfile is enough. If both are present, raw fields override the selected profile."},"indicatorProfile":{"type":"string","enum":["standard","trend","momentum","risk","minimal"],"example":"momentum","default":"standard","description":"Reusable named indicator combination. It fills indicatorConfig and default sub-panels unless the caller supplies raw indicatorConfig or showSubPanels."},"showSubPanels":{"type":"array","items":{"type":"string","enum":["volume","macd","kdj","rsi","atr","pnl"]},"example":["volume","pnl"],"default":["volume","pnl"]},"imageTheme":{"type":"string","enum":["darkUs","darkCn","lightUs","lightCn"],"example":"darkUs","default":"darkUs","description":"Output image style. This controls the generated chart only, not the website light/dark mode."},"theme":{"type":"string","enum":["darkUs","darkCn","lightUs","lightCn"],"example":"darkUs","default":"darkUs","deprecated":true,"description":"Deprecated alias for imageTheme. It is still accepted for old callers."},"layoutPreset":{"type":"string","enum":["standard","compact","wide","square"],"example":"wide","description":"Convenience layout applied before explicit width, height, or scale. You can also put this field under output."},"output":{"$ref":"#/components/schemas/AgentChartOutput","description":"Optional PNG layout, size, scale, locale/timezone, and branding text. This is applied to both single chart and batch chart output."},"period":{"type":"string","enum":["1m","5m","15m","30m","60m","1h","4h","1d"],"default":"1d","example":"15m"},"market":{"type":"string","enum":["cn-a","us-stock","crypto","futures","forex"],"default":"cn-a","example":"crypto"},"source":{"type":"string","enum":["tushare","akshare","binance","csv"],"example":"csv","description":"Use csv for the most stable paid API integration. Other values are available only when enabled on the server."},"klineCsv":{"type":"string","minLength":1,"description":"Required when source=csv. CSV columns: symbol,time,open,high,low,close,volume. Optional columns include amount,adjust.","example":"symbol,time,open,high,low,close,volume\nBTCUSDT,2024-01-02T12:00:00.000Z,42310,42450,42180,42210,1080"},"tushareToken":{"type":"string","description":"Required when source=tushare. Do not send this unless the caller intentionally uses Tushare."}},"allOf":[{"if":{"properties":{"source":{"const":"csv"}},"required":["source"]},"then":{"properties":{"klineCsv":{}},"required":["klineCsv"]}},{"if":{"properties":{"source":{"const":"tushare"}},"required":["source"]},"then":{"properties":{"tushareToken":{}},"required":["tushareToken"]}}],"additionalProperties":true},"AgentPreflightRequest":{"type":"object","required":["kind"],"properties":{"requestId":{"type":"string","minLength":1,"maxLength":128},"kind":{"type":"string","enum":["review-chart","review-batch"]},"chart":{"$ref":"#/components/schemas/AgentChartPayload","description":"Required when kind=review-chart. Flat chart fields are also accepted for simple callers."},"batch":{"$ref":"#/components/schemas/AgentBatchPayload","description":"Required when kind=review-batch. Flat batch fields are also accepted for simple callers."}},"additionalProperties":true},"AgentPreflightResponse":{"type":"object","required":["ok","requestId","kind","chargeable","estimatedCost","validation","quota","account","warnings"],"properties":{"ok":{"type":"boolean","const":true},"requestId":{"type":"string"},"kind":{"type":"string","enum":["review-chart","review-batch"]},"chargeable":{"type":"boolean","const":false},"estimatedCost":{"$ref":"#/components/schemas/AgentEstimatedCost"},"validation":{"type":"object","additionalProperties":true},"quota":{"$ref":"#/components/schemas/AgentPreflightQuota"},"account":{"type":"object","additionalProperties":true},"apiKey":{"type":"object","additionalProperties":true},"warnings":{"type":"array","items":{"type":"string"}}}},"AgentEstimatedCost":{"type":"object","required":["charts","batches"],"properties":{"charts":{"type":"integer","minimum":0},"batches":{"type":"integer","minimum":0}}},"AgentPreflightQuota":{"type":"object","properties":{"account":{"type":"object","additionalProperties":true},"apiKey":{"type":"object","additionalProperties":true}},"additionalProperties":true},"AgentReviewChartRequest":{"type":"object","properties":{"requestId":{"type":"string","minLength":1,"maxLength":128},"responseFormat":{"type":"string","enum":["json","png","jpeg","webp"],"default":"json"},"includeDataUri":{"type":"boolean","default":false},"includeSvgOverlay":{"type":"boolean","default":true},"chart":{"$ref":"#/components/schemas/AgentChartPayload","description":"Chart request payload accepted by /api/chart. Recommended source is csv with klineCsv supplied by the caller."}},"additionalProperties":true},"AgentReviewChartResponse":{"type":"object","required":["ok","requestId","chart","account"],"properties":{"ok":{"type":"boolean","const":true},"requestId":{"type":"string"},"chart":{"type":"object","required":["mimeType","encoding","pngBase64","metadata","warnings"],"properties":{"mimeType":{"type":"string","const":"image/png"},"encoding":{"type":"string","const":"base64"},"pngBase64":{"type":"string"},"metadata":{"type":"object","required":["bytes","sha256","validPng"],"properties":{"bytes":{"type":"integer","minimum":0},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"validPng":{"type":"boolean"},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1}}},"dataUri":{"type":"string"},"fileName":{"type":"string"},"svgOverlay":{"type":"string"},"summary":{"type":"object","additionalProperties":true},"warnings":{"type":"array","items":{}}}},"account":{"type":"object","additionalProperties":true},"apiKey":{"type":"object","additionalProperties":true},"commercialState":{"type":"object","additionalProperties":true}}},"AgentReviewBatchCreateRequest":{"type":"object","properties":{"requestId":{"type":"string","minLength":1,"maxLength":128},"callbackUrl":{"type":"string","format":"uri","description":"Optional public HTTPS callback URL."},"batch":{"$ref":"#/components/schemas/AgentBatchPayload","description":"Batch request payload accepted by /api/batch/jobs."}},"additionalProperties":true},"AgentReviewBatchRetryRequest":{"type":"object","properties":{"requestId":{"type":"string","minLength":1,"maxLength":128},"callbackUrl":{"type":"string","format":"uri","description":"Optional public HTTPS callback URL for the retry job."},"batch":{"$ref":"#/components/schemas/AgentBatchPayload","description":"Full batch request payload. The server only reruns trade_id values that failed in the source job."}},"additionalProperties":true},"AgentReviewBatchCreateResponse":{"type":"object","required":["ok","requestId","job","links","account"],"properties":{"ok":{"type":"boolean","const":true},"requestId":{"type":"string"},"job":{"$ref":"#/components/schemas/AgentBatchJob"},"links":{"$ref":"#/components/schemas/AgentBatchLinks"},"signedLinks":{"$ref":"#/components/schemas/AgentSignedBatchLinks"},"account":{"type":"object","additionalProperties":true},"apiKey":{"type":"object","additionalProperties":true},"commercialState":{"type":"object","additionalProperties":true}}},"AgentReviewBatchStatusResponse":{"type":"object","required":["ok","requestId","job","links","account"],"properties":{"ok":{"type":"boolean","const":true},"requestId":{"type":"string"},"job":{"$ref":"#/components/schemas/AgentBatchJob"},"links":{"$ref":"#/components/schemas/AgentBatchLinks"},"signedLinks":{"$ref":"#/components/schemas/AgentSignedBatchLinks"},"account":{"type":"object","additionalProperties":true},"apiKey":{"type":"object","additionalProperties":true},"commercialState":{"type":"object","additionalProperties":true}}},"AgentReviewBatchWaitResponse":{"type":"object","required":["ok","requestId","job","links","account","wait"],"properties":{"ok":{"type":"boolean","const":true},"requestId":{"type":"string"},"job":{"$ref":"#/components/schemas/AgentBatchJob"},"links":{"$ref":"#/components/schemas/AgentBatchLinks"},"signedLinks":{"$ref":"#/components/schemas/AgentSignedBatchLinks"},"account":{"type":"object","additionalProperties":true},"apiKey":{"type":"object","additionalProperties":true},"commercialState":{"type":"object","additionalProperties":true},"wait":{"type":"object","required":["terminal","timedOut","elapsedMs","timeoutMs","intervalMs"],"properties":{"terminal":{"type":"boolean","description":"True when the returned job is completed, failed, or cancelled."},"timedOut":{"type":"boolean","description":"True when timeoutMs elapsed before a terminal state."},"elapsedMs":{"type":"integer","minimum":0},"timeoutMs":{"type":"integer","minimum":0},"intervalMs":{"type":"integer","minimum":0}}}}},"AgentReviewBatchManifestResponse":{"type":"object","required":["ok","requestId","job","links","manifest","account"],"properties":{"ok":{"type":"boolean","const":true},"requestId":{"type":"string"},"job":{"$ref":"#/components/schemas/AgentBatchJob"},"links":{"$ref":"#/components/schemas/AgentBatchLinks"},"signedLinks":{"$ref":"#/components/schemas/AgentSignedBatchLinks"},"manifest":{"$ref":"#/components/schemas/AgentBatchManifest"},"account":{"type":"object","additionalProperties":true},"apiKey":{"type":"object","additionalProperties":true},"commercialState":{"type":"object","additionalProperties":true}}},"AgentBatchManifest":{"type":"object","required":["jobId","generatedAt","status","terminal","counts","links","retention","artifacts"],"properties":{"jobId":{"type":"string"},"generatedAt":{"type":"string","format":"date-time"},"status":{"type":"string"},"terminal":{"type":"boolean"},"counts":{"type":"object","required":["total","completed","success","failed"],"properties":{"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"success":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0}}},"links":{"$ref":"#/components/schemas/AgentBatchLinks"},"signedLinks":{"$ref":"#/components/schemas/AgentSignedBatchLinks"},"retention":{"type":"object","required":["filesAvailable"],"properties":{"filesAvailable":{"type":"boolean"},"filesDeletedAt":{"type":"string","format":"date-time"}}},"artifacts":{"type":"object","required":["images","archive","report"],"properties":{"images":{"type":"array","items":{"type":"object","required":["tradeId","status","available"],"properties":{"tradeId":{"type":"string"},"status":{"type":"string"},"available":{"type":"boolean"},"fileName":{"type":"string"},"imageUrl":{"type":"string","format":"uri"},"signedImageUrl":{"type":"string","format":"uri","description":"Temporary signed image URL that can be fetched without an API key until artifactExpiresAt."},"mimeType":{"type":"string"},"bytes":{"type":"integer","minimum":0},"sha256":{"type":"string"},"validPng":{"type":"boolean"},"width":{"type":"integer","minimum":0},"height":{"type":"integer","minimum":0},"statusCode":{"type":"integer","minimum":100},"errorCode":{"type":"string"},"error":{"type":"string"}},"additionalProperties":true}},"archive":{"type":"object","required":["url","mimeType"],"properties":{"url":{"type":"string","format":"uri"},"signedUrl":{"type":"string","format":"uri"},"signedExpiresAt":{"type":"string","format":"date-time"},"mimeType":{"type":"string"}}},"report":{"type":"object","required":["fileName","includedInArchive","mimeType"],"properties":{"fileName":{"type":"string"},"includedInArchive":{"type":"boolean"},"mimeType":{"type":"string"}}}}}}},"AgentBatchCallbackPayload":{"type":"object","required":["event","ok","job","links"],"properties":{"event":{"type":"string","const":"batch.completed"},"ok":{"type":"boolean","description":"True when the batch completed successfully. False means the batch reached failed or cancelled."},"requestId":{"type":"string","description":"Caller request id from batch creation or retry when supplied."},"job":{"$ref":"#/components/schemas/AgentBatchJob"},"links":{"$ref":"#/components/schemas/AgentBatchLinks"},"signedLinks":{"$ref":"#/components/schemas/AgentSignedBatchLinks"}},"additionalProperties":true},"AgentBatchJob":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","running","completed","failed","cancelled"]},"total":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"success":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"retryRequestAvailable":{"type":"boolean","description":"True when the underlying batch job retained a safe retry payload. Public Agent retry requests still send a full batch payload; the server uses the source job to rerun failed trades only."},"callback":{"type":"object","properties":{"configured":{"type":"boolean","const":true},"attempts":{"type":"integer","minimum":0},"maxAttempts":{"type":"integer","minimum":1},"lastAttemptAt":{"type":"string","format":"date-time"},"nextAttemptAt":{"type":"string","format":"date-time"},"deliveredAt":{"type":"string","format":"date-time"},"error":{"type":"string"}},"additionalProperties":true},"results":{"type":"array","items":{"type":"object","properties":{"tradeId":{"type":"string"},"status":{"type":"string"},"fileName":{"type":"string"},"imageUrl":{"type":"string","format":"uri","description":"Absolute URL for downloading this PNG."},"signedImageUrl":{"type":"string","format":"uri","description":"Temporary signed URL for downloading this PNG without sending an API key."}},"additionalProperties":true}}},"additionalProperties":true},"AgentBatchLinks":{"type":"object","required":["status","wait","events","manifest","archive"],"properties":{"status":{"type":"string","format":"uri"},"wait":{"type":"string","format":"uri"},"events":{"type":"string","format":"uri"},"manifest":{"type":"string","format":"uri"},"archive":{"type":"string","format":"uri"}}},"AgentSignedBatchLinks":{"type":"object","required":["manifest","archive","expiresAt","expiresAtUnix"],"properties":{"manifest":{"type":"string","format":"uri","description":"Temporary signed manifest URL that can be fetched without an API key."},"archive":{"type":"string","format":"uri","description":"Temporary signed ZIP archive URL that can be fetched without an API key."},"expiresAt":{"type":"string","format":"date-time"},"expiresAtUnix":{"type":"integer","minimum":1}}}}},"x-kline-agent-contract":{"freeTier":{"chartsPerMonth":30,"batchJobsPerMonth":2,"watermarkRequired":true,"preflightChargesQuota":false},"recommendedDataSource":"csv","allowedDataSources":["tushare","akshare","binance","csv"],"idempotencyHeader":"X-Agent-Request-Id","preflightPath":"/api/agents/preflight","waitPath":"/api/agents/review-batch/{jobId}/wait","eventsPath":"/api/agents/review-batch/{jobId}/events","manifestPath":"/api/agents/review-batch/{jobId}/manifest","signedArtifactQueryParams":["artifactExpiresAt","artifactToken"],"signedLinksSchema":"#/components/schemas/AgentSignedBatchLinks","callbackSignatureHeader":"x-kline-signature","callbackPayloadSchema":"#/components/schemas/AgentBatchCallbackPayload","callbackHeaders":{"event":"x-kline-event","jobId":"x-kline-batch-job-id","signature":"x-kline-signature"},"requestSchemas":{"chart":"#/components/schemas/AgentChartPayload","batch":"#/components/schemas/AgentBatchPayload","preflight":"#/components/schemas/AgentPreflightRequest"}}}