{"components":{"schemas":{"ChatRequest":{"properties":{"id":{"description":"Chat id; groups the questions of one conversation in the chat history","maxLength":200,"type":"string"},"messages":{"items":{"$ref":"#/components/schemas/UIMessage"},"maxItems":40,"minItems":1,"type":"array"}},"required":["messages"],"type":"object"},"Error":{"properties":{"error":{"properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"type":"object"}},"type":"object"},"UIMessage":{"description":"AI SDK UI message. Only user/assistant text parts are used. Text of all parts: at most 4000 characters for a user message, 12000 for an assistant message, 100000 for all messages together.","properties":{"id":{"type":"string"},"parts":{"items":{"properties":{"text":{"maxLength":12000,"type":"string"},"type":{"example":"text","type":"string"}},"required":["type"],"type":"object"},"maxItems":50,"type":"array"},"role":{"enum":["user","assistant"],"type":"string"}},"required":["id","role","parts"],"type":"object"}},"securitySchemes":{"apiKey":{"bearerFormat":"nsk_ai_…","scheme":"bearer","type":"http"}}},"info":{"description":"Server-to-server chat API. Answers from the bot's indexed content and streams the answer as an AI SDK UI message stream with optional source-url parts controlled by the saved bot source-display setting.","title":"Chat API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/api/v1/chat":{"post":{"operationId":"chat","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}},"required":true},"responses":{"200":{"content":{"text/event-stream":{"schema":{"description":"AI SDK UI message stream: text-delta; optional source-url (web pages) and source-document parts (uploaded documents, no URL; sourceId = citation number) when saved showSources is true; messageMetadata.sourcesVisible identifies display mode; finish includes messageMetadata.usage","type":"string"}}},"description":"Streamed answer"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"invalid_request, invalid_messages, message_too_long, answer_too_long, conversation_too_long, too_many_parts or no_question"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"invalid_api_key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"rate_limited (see Retry-After), budget_exceeded or plan_limit_reached"}},"security":[{"apiKey":[]}],"summary":"Ask the bot a question"}},"/api/v1/chat/end":{"post":{"description":"Idempotent. Unknown ids also return ok. Active answers finish before finalization. Reusing an ended id starts a new session. Idle sessions end automatically, default 30 minutes.","operationId":"endChat","requestBody":{"content":{"application/json":{"schema":{"properties":{"id":{"maxLength":200,"minLength":1,"type":"string"},"reason":{"default":"explicit","enum":["explicit","reset"],"type":"string"}},"required":["id"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"const":true,"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"End accepted (also for unknown ids)"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"invalid_request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"invalid_api_key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"rate_limited (see Retry-After)"}},"security":[{"apiKey":[]}],"summary":"End a conversation owned by this API key"}},"/api/v1/chat/policy":{"get":{"description":"Days after the last question that the bot owner's team keeps questions and answers (30, 90, 180 or 365, chosen by the team). For the notice next to the chat. Counts against the key's rate limit: cache it for a few minutes.","operationId":"chatPolicy","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"retentionDays":{"enum":[30,90,180,365],"type":"integer"}},"required":["retentionDays"],"type":"object"}}},"description":"The current retention of the bot's team"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"invalid_api_key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"rate_limited (see Retry-After)"}},"security":[{"apiKey":[]}],"summary":"How long chats of this bot are stored"}},"/api/v1/mcp":{"post":{"description":"Model Context Protocol server of the key's bot (Streamable HTTP, stateless). The body is one JSON-RPC 2.0 message or an array of up to 10; methods: initialize, ping, tools/list, tools/call (tools \"ask\" and \"search\"). Responses are JSON; notifications get 202. Tool calls count against the key's rate limit and budgets; limits come back as tool results with isError.","operationId":"mcp","requestBody":{"content":{"application/json":{"schema":{"description":"JSON-RPC 2.0 request, notification or batch","type":"object"}}},"required":true},"responses":{"200":{"description":"JSON-RPC response (or array of responses for a batch)"},"202":{"description":"Only notifications were sent"},"400":{"description":"Not JSON, or an empty or too large batch"},"401":{"description":"Missing, unknown or revoked API key"}},"security":[{"apiKey":[]}],"summary":"MCP server of the bot"}}},"servers":[{"url":"https://aiduko.com"}]}