跳到主要内容

aiPromptsImportBundle

AiImportResult aiPromptsImportBundle(AiPromptsImportBundleRequest)

POST /api/2.0/ai/prompts/import-bundle

Import bundle

Writes a bundle produced by GET api/2.0/ai/prompts/export back into the caller's library. mode decides how: replace deletes the current prompts and folders before writing, and merge writes the bundle on top of what is already there. The bundle's shape - version 1, folders and prompts arrays of objects with string ids, names and texts - and the folder references inside it are validated before anything is written, so a corrupt bundle is rejected whole rather than applied halfway: 400 with the refusals in errors, or 409 when every refusal is a name that already exists in the library. replace is destructive and cannot be undone - export first if the current library matters.

Parameters​

NameInTypeDescriptionNotes
AiPromptsImportBundleRequestbodyAiPromptsImportBundleRequest[required]

Responses​

Status codeDescriptionTypeResponse headers
200Whether the bundle was written, how many prompts it imported, and what was refused.AiImportResult-
400The bundle is malformed, references a folder it does not carry, holds an empty entry or two entries of the same name, or mode is unknown.AiImportResult-
401Missing asc_auth_key cookie or Authorization header.AiErrorResponse-
403AI is disabled for this portal, the caller is a guest, or the room named by entityId is one the caller cannot open. Relayed from the DocSpace AI service or the Files API.AiErrorResponse-
409Every refused entry is a name that already exists in the library (merge only).AiImportResult-
413The request body is larger than 100 KB, the JSON parser's limit on this route.AiErrorResponse-
500Unhandled failure. The reason is logged server-side and never echoed back.AiErrorResponse-

Return type​

AiImportResult

Authorization​

cookieAuth, bearerAuth

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json