// This file was generated by the Opapi Generator
/* eslint-disable */
/* prettier-ignore */
import * as opapi from '@bpinternal/opapi'
export type State = opapi.State<'File', never, 'files'>
export const state = {
  "operations": {
    "upsertFile": {
      "name": "upsertFile",
      "path": "/v1/files",
      "description": "Creates or updates a file using the `key` parameter as unique identifier. Updating a file will erase the existing content of the file. Upload the file content by sending it in a PUT request to the `uploadUrl` returned in the response.",
      "method": "put",
      "requestBody": {
        "description": "Properties of the file to create or update.",
        "schema": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
            },
            "tags": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "maxLength": 1000
              },
              "description": "File tags as an object of key-value pairs. Tag values should be of `string` (text) type."
            },
            "size": {
              "type": "number",
              "description": "File size in bytes. This will count against your File Storage quota. If the `index` parameter is set to `true`, this will also count against your Vector DB Storage quota."
            },
            "index": {
              "default": false,
              "type": "boolean",
              "description": "Set to a value of 'true' to index the file in vector storage. Only certain file formats are currently supported for indexing. Files larger than 95 MB cannot be indexed. Note that if a file is indexed, it will count towards both the Vector DB Storage quota and the File Storage quota of the workspace."
            },
            "indexing": {
              "type": "object",
              "properties": {
                "configuration": {
                  "type": "object",
                  "properties": {
                    "parsing": {
                      "type": "object",
                      "properties": {
                        "minimumParagraphLength": {
                          "type": "integer",
                          "minimum": 50,
                          "maximum": 2000,
                          "description": "The minimum length a standalone paragraph should have. If a paragraph is shorter than this, it will be merged with the next immediate paragraph."
                        },
                        "smartCleanup": {
                          "type": "boolean",
                          "description": "(Team/Enterprise plan only, charged as AI Spend) Enabling this will use a lightweight/inexpensive LLM to clean up the extracted content of PDF files before indexing them to increase the quality of the stored vectors, as PDFs often store raw text in unusual ways which when extracted may result in formatting issues (e.g. broken sentences/paragraphs, unexpected headings, garbled characters, etc.) that can affect retrieval performance for certain user queries if left untouched.\n\nNotes:\n- This feature is only available in Team and Enterprise plans.\n- This feature is only available for PDF files. If the file isn't a PDF, this setting will be ignored and no AI Spend will be incurred.\n- We recommend using this feature for PDFs that have custom layouts or design. For simple text-based PDFs like documents and books, this feature is usually not necessary.\n- The smart cleanup takes some time to perform due to the LLM calls involved, so enabling it will increase the total time it takes to index the file.\n- We take steps to prevent the original text from being fundamentally changed but due to the nature of LLMs this could theoretically still happen so it's recommended to review the passages generated for the file after indexing to ensure the content is still accurate.\n- This feature is limited to the first 30 pages or 20 KB of text in the PDF file (whichever comes first). If the file has more content than these limits then the rest of the file will be indexed as-is without any cleanup. If you need to clean up the content of the entire file, consider splitting it into smaller files."
                        }
                      },
                      "additionalProperties": false
                    },
                    "chunking": {
                      "type": "object",
                      "properties": {
                        "maximumChunkLength": {
                          "type": "integer",
                          "minimum": 100,
                          "maximum": 5000,
                          "description": "The maximum length of a chunk in characters."
                        },
                        "embeddedContextLevels": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 3,
                          "description": "The number of surrounding context levels to include in the vector embedding of the chunk."
                        },
                        "embedBreadcrumb": {
                          "type": "boolean",
                          "description": "Include the breadcrumb of the chunk in the vector embedding."
                        }
                      },
                      "additionalProperties": false
                    },
                    "summarization": {
                      "type": "object",
                      "properties": {
                        "enable": {
                          "default": false,
                          "type": "boolean",
                          "description": "(Team/Enterprise plan only, charged as AI Spend) Create summaries for this file and index them as standalone vectors. Enabling this option will incur in AI Spend cost (charged to the workspace of the bot) to generate the summaries based on the amount of content in the file and the summarization model used.\n\nPlease note that this feature is only available in Team and Enterprise plans."
                        },
                        "modelType": {
                          "default": "balanced",
                          "type": "string",
                          "enum": [
                            "inexpensive",
                            "balanced",
                            "accurate"
                          ],
                          "description": "The model type to use for summarization."
                        },
                        "minimumInputLength": {
                          "type": "integer",
                          "minimum": 1000,
                          "maximum": 10000,
                          "description": "The minimum length a section of the file should have to create a summary of it."
                        },
                        "outputTokenLimit": {
                          "type": "integer",
                          "minimum": 1000,
                          "maximum": 10000,
                          "description": "The maximum length of a summary (in tokens)."
                        },
                        "generateMasterSummary": {
                          "type": "boolean",
                          "description": "Generate a summary of the entire file and index it as a standalone vector."
                        }
                      },
                      "additionalProperties": false
                    },
                    "stack": {
                      "type": "string",
                      "enum": [
                        "legacy",
                        "realtime-v1"
                      ],
                      "description": "If not set, the default indexing stack will be used."
                    },
                    "vision": {
                      "type": "object",
                      "properties": {
                        "transcribePages": {
                          "description": "(Team/Enterprise plan only, charged as AI Spend) For PDF files, set this option to `true` or pass an array with specific page numbers to use a vision-enabled LLM to transcribe each page of the PDF as standalone vectors and index them.\n\nThis feature is useful when a PDF file contains custom designs or layouts, or when your document has many infographics, which require visual processing in order to index the file effectively, as the default text-based indexing may not be enough to allow your bot to correctly understand the content in your PDFs.\n\nNotes:\n- This feature is only available in Team and Enterprise plans.\n- Enabling this feature will incur in AI Spend cost to use a vision-enabled LLM to index the PDF pages.\n- This is limited to a maximum of 100 pages of the PDF. If the file has more pages then the rest of the pages will NOT be transcribed using this vision feature, and will be processed using the default text-based indexing instead. If you need to transcribe the entire file using vision, please split it into smaller files.\n- Pages that are vision-transcribed will not be processed by the default text-based indexing to avoid duplicate content in the index.\n- This feature is only available for PDF files. If the file isn't a PDF, this setting will be ignored and no AI Spend will be incurred."
                        },
                        "indexPages": {
                          "description": "(Team/Enterprise plan only, charged as AI Spend) For PDF files, set this option to `true` or pass an array with specific page numbers to use a vision-enabled LLM to index each page of the PDF as a standalone image.\n\nEnabling this feature will allow Autonomous Nodes in your bot to answer visual or higher-level questions about the content in these pages that can usually not be answered correctly by the default text-based indexing or visual transcription.\n\nThis feature is useful when a PDF has:\n- Tables with complex layouts\n- Charts, diagrams or infographics\n- Photos or images that can be used to answer user queries\n\nNotes:\n- This feature is only available in Team and Enterprise plans.\n- Enabling this will incur in extra AI Spend cost and additional File Storage usage, in order to use a vision-enabled LLM to visually index the PDF pages and store them as standalone page images in the bot's file storage.\n- Enabling this may increase the overall AI Spend cost of your bot as your bot may pass one or more indexed page images to a vision-enabled LLM for answering user queries.\n- This is limited to the first 100 pages of the PDF. If the file has more pages then the rest of the pages will NOT be vision-indexed. If you need to visually index the entire file, please split it into smaller files.\n- This feature is only available for PDF files. If the file isn't a PDF, this setting will be ignored and no AI Spend will be incurred."
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "description": "Configuration to use for indexing the file, will be stored in the file's metadata for reference.",
                  "additionalProperties": false
                }
              },
              "required": [
                "configuration"
              ],
              "additionalProperties": false
            },
            "accessPolicies": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "public_content",
                  "integrations"
                ]
              },
              "description": "File access policies. Add \"public_content\" to allow public access to the file content. Add \"integrations\" to allow read, search and list operations for any integration installed in the bot."
            },
            "contentType": {
              "type": "string",
              "description": "File content type. If omitted, the content type will be inferred from the file extension (if any) specified in `key`. If a content type cannot be inferred, the default is \"application/octet-stream\"."
            },
            "expiresAt": {
              "type": "string",
              "format": "date-time",
              "description": "Expiry timestamp in ISO 8601 format with UTC timezone. After expiry, the File will be deleted. Must be in the future. Cannot be more than 90 days from now. The value up to minutes is considered. Seconds and milliseconds are ignored."
            },
            "publicContentImmediatelyAccessible": {
              "type": "boolean",
              "description": "Use when your file has \"public_content\" in its access policy and you need the file\\'s content to be immediately accessible through its URL after the file has been uploaded without having to wait for the upload to be processed by our system.\n\nIf set to `true`, the `x-amz-tagging` HTTP header with a value of `public=true` will need to be sent in the HTTP PUT request to the `uploadUrl` in order for the upload request to work."
            },
            "metadata": {
              "description": "Custom metadata for the file expressed as an object of key-value pairs. The values can be of any type."
            }
          },
          "required": [
            "key",
            "size"
          ],
          "title": "upsertFileBody",
          "additionalProperties": false
        }
      },
      "contentType": "application/json",
      "section": "files",
      "response": {
        "description": "The created or updated file",
        "schema": {
          "type": "object",
          "properties": {
            "file": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "File ID"
                },
                "botId": {
                  "type": "string",
                  "description": "The ID of the bot the file belongs to"
                },
                "key": {
                  "type": "string",
                  "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
                },
                "url": {
                  "type": "string",
                  "description": "URL to retrieve the file content. This URL will be ready to use once the file is uploaded.\n\nIf the file has a `public_content` policy, this will contain the permanent public URL to retrieve the file, otherwise this will contain a temporary pre-signed URL to download the file which should be used shortly after retrieving and should not be stored long-term as the URL will expire after a short timeframe."
                },
                "size": {
                  "type": "number",
                  "description": "File size in bytes. Non-null if file upload status is \"COMPLETE\".",
                  "nullable": true
                },
                "contentType": {
                  "type": "string",
                  "description": "MIME type of the file's content"
                },
                "tags": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "description": "The tags of the file as an object of key/value pairs"
                },
                "metadata": {
                  "type": "object",
                  "additionalProperties": {
                    "nullable": true
                  },
                  "description": "Metadata of the file as an object of key/value pairs. The values can be of any type."
                },
                "createdAt": {
                  "type": "string",
                  "description": "File creation timestamp in ISO 8601 format"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "File last update timestamp in ISO 8601 format"
                },
                "accessPolicies": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "integrations",
                      "public_content"
                    ]
                  },
                  "description": "Access policies configured for the file."
                },
                "index": {
                  "type": "boolean",
                  "description": "Whether the file was requested to be indexed for search or not."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "upload_pending",
                    "upload_failed",
                    "upload_completed",
                    "indexing_pending",
                    "indexing_failed",
                    "indexing_completed"
                  ],
                  "description": "Status of the file. If the status is `upload_pending`, the file content has not been uploaded yet. The status will be set to `upload_completed` once the file content has been uploaded successfully.\n\nIf the upload failed for any reason (e.g. exceeding the storage quota or the maximum file size limit) the status will be set to `upload_failed` and the reason for the failure will be available in the `failedStatusReason` field of the file.\n\nHowever, if the file has been uploaded and the `index` attribute was set to `true` on the file, the status will immediately transition to the `indexing_pending` status (the `upload_completed` status step will be skipped).\n\nOnce the indexing is completed and the file is ready to be used for searching its status will be set to `indexing_completed`. If the indexing failed the status will be set to `indexing_failed` and the reason for the failure will be available in the `failedStatusReason` field."
                },
                "failedStatusReason": {
                  "type": "string",
                  "description": "If the file status is `upload_failed` or `indexing_failed` this will contain the reason of the failure."
                },
                "expiresAt": {
                  "type": "string",
                  "description": "File expiry timestamp in ISO 8601 format"
                },
                "owner": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "bot",
                        "integration",
                        "user"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "This field is present if `type` is \"user\" or \"bot\". If `type` is \"user\", this is the user ID. If `type` is \"bot\", this is the bot ID."
                    },
                    "name": {
                      "type": "string",
                      "description": "This field is present if the `type` is \"integration\". If `type` is \"integration\", this is the integration name."
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                "indexingStack": {
                  "type": "string",
                  "enum": [
                    "v1",
                    "v2"
                  ],
                  "description": "Indicates the indexing stack used to index this file. Present only when file has been successfully indexed. A value of \"v2\" denotes the latest stack, \"v1\" denotes the legacy stack."
                },
                "uploadUrl": {
                  "type": "string",
                  "description": "URL to upload the file content. File content needs to be sent to this URL via a PUT request."
                }
              },
              "required": [
                "id",
                "botId",
                "key",
                "url",
                "size",
                "contentType",
                "tags",
                "metadata",
                "createdAt",
                "updatedAt",
                "accessPolicies",
                "index",
                "status",
                "owner",
                "uploadUrl"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "file"
          ],
          "title": "upsertFileResponse",
          "additionalProperties": false
        }
      },
      "parameters": {}
    },
    "deleteFile": {
      "name": "deleteFile",
      "path": "/v1/files/{id}",
      "description": "Deletes a file.",
      "method": "delete",
      "section": "files",
      "parameters": {
        "id": {
          "type": "string",
          "description": "File ID or Key",
          "in": "path"
        }
      },
      "response": {
        "description": "Empty response.",
        "schema": {
          "type": "object",
          "title": "deleteFileResponse",
          "additionalProperties": false
        }
      }
    },
    "listFiles": {
      "name": "listFiles",
      "path": "/v1/files",
      "description": "List files for bot",
      "method": "get",
      "section": "files",
      "parameters": {
        "nextToken": {
          "in": "query",
          "description": "Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results",
          "type": "string"
        },
        "sortField": {
          "in": "query",
          "description": "Sort results by this field",
          "type": "string",
          "enum": [
            "key",
            "size",
            "createdAt",
            "updatedAt",
            "status"
          ]
        },
        "sortDirection": {
          "in": "query",
          "description": "Sort results in this direction",
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ]
        },
        "tags": {
          "in": "query",
          "description": "Filter files by tags. Tags should be passed as a URL-encoded JSON object of key-value pairs that must be present in the tags of a file. An array of multiple string values for the same key are treated as an OR condition. To exclude a value, express it as an object with a nested `not` key with the string or string-array value(s) to exclude.",
          "type": "object",
          "schema": {}
        },
        "ids": {
          "in": "query",
          "description": "Filter files by IDs.",
          "type": "object",
          "schema": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50
          }
        }
      },
      "response": {
        "description": "Returns the list of files related to the bot.",
        "schema": {
          "type": "object",
          "properties": {
            "files": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "File ID"
                  },
                  "botId": {
                    "type": "string",
                    "description": "The ID of the bot the file belongs to"
                  },
                  "key": {
                    "type": "string",
                    "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
                  },
                  "url": {
                    "type": "string",
                    "description": "URL to retrieve the file content. This URL will be ready to use once the file is uploaded.\n\nIf the file has a `public_content` policy, this will contain the permanent public URL to retrieve the file, otherwise this will contain a temporary pre-signed URL to download the file which should be used shortly after retrieving and should not be stored long-term as the URL will expire after a short timeframe."
                  },
                  "size": {
                    "type": "number",
                    "description": "File size in bytes. Non-null if file upload status is \"COMPLETE\".",
                    "nullable": true
                  },
                  "contentType": {
                    "type": "string",
                    "description": "MIME type of the file's content"
                  },
                  "tags": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 1000
                    },
                    "description": "The tags of the file as an object of key/value pairs"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "nullable": true
                    },
                    "description": "Metadata of the file as an object of key/value pairs. The values can be of any type."
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "File creation timestamp in ISO 8601 format"
                  },
                  "updatedAt": {
                    "type": "string",
                    "description": "File last update timestamp in ISO 8601 format"
                  },
                  "accessPolicies": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "integrations",
                        "public_content"
                      ]
                    },
                    "description": "Access policies configured for the file."
                  },
                  "index": {
                    "type": "boolean",
                    "description": "Whether the file was requested to be indexed for search or not."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "upload_pending",
                      "upload_failed",
                      "upload_completed",
                      "indexing_pending",
                      "indexing_failed",
                      "indexing_completed"
                    ],
                    "description": "Status of the file. If the status is `upload_pending`, the file content has not been uploaded yet. The status will be set to `upload_completed` once the file content has been uploaded successfully.\n\nIf the upload failed for any reason (e.g. exceeding the storage quota or the maximum file size limit) the status will be set to `upload_failed` and the reason for the failure will be available in the `failedStatusReason` field of the file.\n\nHowever, if the file has been uploaded and the `index` attribute was set to `true` on the file, the status will immediately transition to the `indexing_pending` status (the `upload_completed` status step will be skipped).\n\nOnce the indexing is completed and the file is ready to be used for searching its status will be set to `indexing_completed`. If the indexing failed the status will be set to `indexing_failed` and the reason for the failure will be available in the `failedStatusReason` field."
                  },
                  "failedStatusReason": {
                    "type": "string",
                    "description": "If the file status is `upload_failed` or `indexing_failed` this will contain the reason of the failure."
                  },
                  "expiresAt": {
                    "type": "string",
                    "description": "File expiry timestamp in ISO 8601 format"
                  },
                  "owner": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "bot",
                          "integration",
                          "user"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "description": "This field is present if `type` is \"user\" or \"bot\". If `type` is \"user\", this is the user ID. If `type` is \"bot\", this is the bot ID."
                      },
                      "name": {
                        "type": "string",
                        "description": "This field is present if the `type` is \"integration\". If `type` is \"integration\", this is the integration name."
                      }
                    },
                    "required": [
                      "type"
                    ]
                  },
                  "indexingStack": {
                    "type": "string",
                    "enum": [
                      "v1",
                      "v2"
                    ],
                    "description": "Indicates the indexing stack used to index this file. Present only when file has been successfully indexed. A value of \"v2\" denotes the latest stack, \"v1\" denotes the legacy stack."
                  }
                },
                "required": [
                  "id",
                  "botId",
                  "key",
                  "url",
                  "size",
                  "contentType",
                  "tags",
                  "metadata",
                  "createdAt",
                  "updatedAt",
                  "accessPolicies",
                  "index",
                  "status",
                  "owner"
                ]
              }
            },
            "meta": {
              "type": "object",
              "properties": {
                "nextToken": {
                  "type": "string",
                  "description": "The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint."
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "files",
            "meta"
          ],
          "title": "listFilesResponse",
          "additionalProperties": false
        }
      }
    },
    "getFile": {
      "name": "getFile",
      "path": "/v1/files/{id}",
      "description": "Get file",
      "method": "get",
      "section": "files",
      "parameters": {
        "id": {
          "type": "string",
          "description": "File ID or Key",
          "in": "path"
        }
      },
      "response": {
        "description": "An object containing the file metadata and URL",
        "schema": {
          "type": "object",
          "properties": {
            "file": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "File ID"
                },
                "botId": {
                  "type": "string",
                  "description": "The ID of the bot the file belongs to"
                },
                "key": {
                  "type": "string",
                  "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
                },
                "url": {
                  "type": "string",
                  "description": "URL to retrieve the file content. This URL will be ready to use once the file is uploaded.\n\nIf the file has a `public_content` policy, this will contain the permanent public URL to retrieve the file, otherwise this will contain a temporary pre-signed URL to download the file which should be used shortly after retrieving and should not be stored long-term as the URL will expire after a short timeframe."
                },
                "size": {
                  "type": "number",
                  "description": "File size in bytes. Non-null if file upload status is \"COMPLETE\".",
                  "nullable": true
                },
                "contentType": {
                  "type": "string",
                  "description": "MIME type of the file's content"
                },
                "tags": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "description": "The tags of the file as an object of key/value pairs"
                },
                "metadata": {
                  "type": "object",
                  "additionalProperties": {
                    "nullable": true
                  },
                  "description": "Metadata of the file as an object of key/value pairs. The values can be of any type."
                },
                "createdAt": {
                  "type": "string",
                  "description": "File creation timestamp in ISO 8601 format"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "File last update timestamp in ISO 8601 format"
                },
                "accessPolicies": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "integrations",
                      "public_content"
                    ]
                  },
                  "description": "Access policies configured for the file."
                },
                "index": {
                  "type": "boolean",
                  "description": "Whether the file was requested to be indexed for search or not."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "upload_pending",
                    "upload_failed",
                    "upload_completed",
                    "indexing_pending",
                    "indexing_failed",
                    "indexing_completed"
                  ],
                  "description": "Status of the file. If the status is `upload_pending`, the file content has not been uploaded yet. The status will be set to `upload_completed` once the file content has been uploaded successfully.\n\nIf the upload failed for any reason (e.g. exceeding the storage quota or the maximum file size limit) the status will be set to `upload_failed` and the reason for the failure will be available in the `failedStatusReason` field of the file.\n\nHowever, if the file has been uploaded and the `index` attribute was set to `true` on the file, the status will immediately transition to the `indexing_pending` status (the `upload_completed` status step will be skipped).\n\nOnce the indexing is completed and the file is ready to be used for searching its status will be set to `indexing_completed`. If the indexing failed the status will be set to `indexing_failed` and the reason for the failure will be available in the `failedStatusReason` field."
                },
                "failedStatusReason": {
                  "type": "string",
                  "description": "If the file status is `upload_failed` or `indexing_failed` this will contain the reason of the failure."
                },
                "expiresAt": {
                  "type": "string",
                  "description": "File expiry timestamp in ISO 8601 format"
                },
                "owner": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "bot",
                        "integration",
                        "user"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "This field is present if `type` is \"user\" or \"bot\". If `type` is \"user\", this is the user ID. If `type` is \"bot\", this is the bot ID."
                    },
                    "name": {
                      "type": "string",
                      "description": "This field is present if the `type` is \"integration\". If `type` is \"integration\", this is the integration name."
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                "indexingStack": {
                  "type": "string",
                  "enum": [
                    "v1",
                    "v2"
                  ],
                  "description": "Indicates the indexing stack used to index this file. Present only when file has been successfully indexed. A value of \"v2\" denotes the latest stack, \"v1\" denotes the legacy stack."
                }
              },
              "required": [
                "id",
                "botId",
                "key",
                "url",
                "size",
                "contentType",
                "tags",
                "metadata",
                "createdAt",
                "updatedAt",
                "accessPolicies",
                "index",
                "status",
                "owner"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "file"
          ],
          "title": "getFileResponse",
          "additionalProperties": false
        }
      }
    },
    "updateFileMetadata": {
      "name": "updateFileMetadata",
      "path": "/v1/files/{id}",
      "description": "Update file metadata, without updating the file content.",
      "method": "put",
      "section": "files",
      "parameters": {
        "id": {
          "type": "string",
          "description": "File ID or Key",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "File metadata to update.",
        "schema": {
          "type": "object",
          "properties": {
            "metadata": {
              "description": "Custom metadata for the file expressed as an object of key-value pairs. Omit to keep existing metadata intact. Any existing metadata keys not included will be preserved. New keys will be added. To delete a metadata key, set its value to `null`."
            },
            "tags": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "maxLength": 1000,
                "nullable": true
              },
              "description": "The file tags to update as an object of key-value pairs with `string` (text) values. Omit to keep existing tags intact. Any existing tags not included will be preserved. New tags will be added. To delete a tag, set its value to `null`."
            },
            "accessPolicies": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "integrations",
                  "public_content"
                ]
              },
              "description": "New access policies to set for the file. Omit to keep existing policies intact."
            },
            "expiresAt": {
              "type": "string",
              "format": "date-time",
              "description": "Expiry timestamp in ISO 8601 format with UTC timezone. After expiry, the File will be deleted. Must be in the future. Cannot be more than 90 days from now. The value up to minutes is considered. Seconds and milliseconds are ignored. Omit to keep the existing expiry intact. Set to `null` to remove the expiry.",
              "nullable": true
            }
          },
          "title": "updateFileMetadataBody",
          "additionalProperties": false
        }
      },
      "response": {
        "description": "An object containing the updated file metadata.",
        "schema": {
          "type": "object",
          "properties": {
            "file": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "File ID"
                },
                "botId": {
                  "type": "string",
                  "description": "The ID of the bot the file belongs to"
                },
                "key": {
                  "type": "string",
                  "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
                },
                "url": {
                  "type": "string",
                  "description": "URL to retrieve the file content. This URL will be ready to use once the file is uploaded.\n\nIf the file has a `public_content` policy, this will contain the permanent public URL to retrieve the file, otherwise this will contain a temporary pre-signed URL to download the file which should be used shortly after retrieving and should not be stored long-term as the URL will expire after a short timeframe."
                },
                "size": {
                  "type": "number",
                  "description": "File size in bytes. Non-null if file upload status is \"COMPLETE\".",
                  "nullable": true
                },
                "contentType": {
                  "type": "string",
                  "description": "MIME type of the file's content"
                },
                "tags": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "description": "The tags of the file as an object of key/value pairs"
                },
                "metadata": {
                  "type": "object",
                  "additionalProperties": {
                    "nullable": true
                  },
                  "description": "Metadata of the file as an object of key/value pairs. The values can be of any type."
                },
                "createdAt": {
                  "type": "string",
                  "description": "File creation timestamp in ISO 8601 format"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "File last update timestamp in ISO 8601 format"
                },
                "accessPolicies": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "integrations",
                      "public_content"
                    ]
                  },
                  "description": "Access policies configured for the file."
                },
                "index": {
                  "type": "boolean",
                  "description": "Whether the file was requested to be indexed for search or not."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "upload_pending",
                    "upload_failed",
                    "upload_completed",
                    "indexing_pending",
                    "indexing_failed",
                    "indexing_completed"
                  ],
                  "description": "Status of the file. If the status is `upload_pending`, the file content has not been uploaded yet. The status will be set to `upload_completed` once the file content has been uploaded successfully.\n\nIf the upload failed for any reason (e.g. exceeding the storage quota or the maximum file size limit) the status will be set to `upload_failed` and the reason for the failure will be available in the `failedStatusReason` field of the file.\n\nHowever, if the file has been uploaded and the `index` attribute was set to `true` on the file, the status will immediately transition to the `indexing_pending` status (the `upload_completed` status step will be skipped).\n\nOnce the indexing is completed and the file is ready to be used for searching its status will be set to `indexing_completed`. If the indexing failed the status will be set to `indexing_failed` and the reason for the failure will be available in the `failedStatusReason` field."
                },
                "failedStatusReason": {
                  "type": "string",
                  "description": "If the file status is `upload_failed` or `indexing_failed` this will contain the reason of the failure."
                },
                "expiresAt": {
                  "type": "string",
                  "description": "File expiry timestamp in ISO 8601 format"
                },
                "owner": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "bot",
                        "integration",
                        "user"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "This field is present if `type` is \"user\" or \"bot\". If `type` is \"user\", this is the user ID. If `type` is \"bot\", this is the bot ID."
                    },
                    "name": {
                      "type": "string",
                      "description": "This field is present if the `type` is \"integration\". If `type` is \"integration\", this is the integration name."
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                "indexingStack": {
                  "type": "string",
                  "enum": [
                    "v1",
                    "v2"
                  ],
                  "description": "Indicates the indexing stack used to index this file. Present only when file has been successfully indexed. A value of \"v2\" denotes the latest stack, \"v1\" denotes the legacy stack."
                }
              },
              "required": [
                "id",
                "botId",
                "key",
                "url",
                "size",
                "contentType",
                "tags",
                "metadata",
                "createdAt",
                "updatedAt",
                "accessPolicies",
                "index",
                "status",
                "owner"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "file"
          ],
          "title": "updateFileMetadataResponse",
          "additionalProperties": false
        }
      }
    },
    "copyFile": {
      "name": "copyFile",
      "path": "/v1/files/{idOrKey}/{destinationKey}",
      "description": "Copy file",
      "method": "post",
      "section": "files",
      "parameters": {
        "idOrKey": {
          "type": "string",
          "description": "File ID or Key",
          "in": "path"
        },
        "destinationKey": {
          "in": "path",
          "type": "string",
          "description": "The new key of the file. The file key must not be in use already in the destination bot."
        },
        "x-destination-bot-id": {
          "in": "header",
          "type": "string",
          "description": "The bot ID to copy the file to. You must have permission to create files in the destination bot. If the destination bot ID is omitted, the file will be copied to the same bot the source file belongs to."
        }
      },
      "requestBody": {
        "description": "Additional options for file copying.",
        "schema": {
          "type": "object",
          "properties": {
            "overwrite": {
              "type": "boolean",
              "description": "Set to `true` to overwrite the file if it already exists, otherwise an error will be returned.\n\nWhen this endpoint is called using bot authentication, the existing file must have been originally created by the same bot making the file copy request in order to overwrite it."
            }
          },
          "title": "copyFileBody",
          "additionalProperties": false
        }
      },
      "response": {
        "description": "An object containing the file metadata and URL",
        "schema": {
          "type": "object",
          "properties": {
            "file": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "File ID"
                },
                "botId": {
                  "type": "string",
                  "description": "The ID of the bot the file belongs to"
                },
                "key": {
                  "type": "string",
                  "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
                },
                "url": {
                  "type": "string",
                  "description": "URL to retrieve the file content. This URL will be ready to use once the file is uploaded.\n\nIf the file has a `public_content` policy, this will contain the permanent public URL to retrieve the file, otherwise this will contain a temporary pre-signed URL to download the file which should be used shortly after retrieving and should not be stored long-term as the URL will expire after a short timeframe."
                },
                "size": {
                  "type": "number",
                  "description": "File size in bytes. Non-null if file upload status is \"COMPLETE\".",
                  "nullable": true
                },
                "contentType": {
                  "type": "string",
                  "description": "MIME type of the file's content"
                },
                "tags": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "description": "The tags of the file as an object of key/value pairs"
                },
                "metadata": {
                  "type": "object",
                  "additionalProperties": {
                    "nullable": true
                  },
                  "description": "Metadata of the file as an object of key/value pairs. The values can be of any type."
                },
                "createdAt": {
                  "type": "string",
                  "description": "File creation timestamp in ISO 8601 format"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "File last update timestamp in ISO 8601 format"
                },
                "accessPolicies": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "integrations",
                      "public_content"
                    ]
                  },
                  "description": "Access policies configured for the file."
                },
                "index": {
                  "type": "boolean",
                  "description": "Whether the file was requested to be indexed for search or not."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "upload_pending",
                    "upload_failed",
                    "upload_completed",
                    "indexing_pending",
                    "indexing_failed",
                    "indexing_completed"
                  ],
                  "description": "Status of the file. If the status is `upload_pending`, the file content has not been uploaded yet. The status will be set to `upload_completed` once the file content has been uploaded successfully.\n\nIf the upload failed for any reason (e.g. exceeding the storage quota or the maximum file size limit) the status will be set to `upload_failed` and the reason for the failure will be available in the `failedStatusReason` field of the file.\n\nHowever, if the file has been uploaded and the `index` attribute was set to `true` on the file, the status will immediately transition to the `indexing_pending` status (the `upload_completed` status step will be skipped).\n\nOnce the indexing is completed and the file is ready to be used for searching its status will be set to `indexing_completed`. If the indexing failed the status will be set to `indexing_failed` and the reason for the failure will be available in the `failedStatusReason` field."
                },
                "failedStatusReason": {
                  "type": "string",
                  "description": "If the file status is `upload_failed` or `indexing_failed` this will contain the reason of the failure."
                },
                "expiresAt": {
                  "type": "string",
                  "description": "File expiry timestamp in ISO 8601 format"
                },
                "owner": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "bot",
                        "integration",
                        "user"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "This field is present if `type` is \"user\" or \"bot\". If `type` is \"user\", this is the user ID. If `type` is \"bot\", this is the bot ID."
                    },
                    "name": {
                      "type": "string",
                      "description": "This field is present if the `type` is \"integration\". If `type` is \"integration\", this is the integration name."
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                "indexingStack": {
                  "type": "string",
                  "enum": [
                    "v1",
                    "v2"
                  ],
                  "description": "Indicates the indexing stack used to index this file. Present only when file has been successfully indexed. A value of \"v2\" denotes the latest stack, \"v1\" denotes the legacy stack."
                }
              },
              "required": [
                "id",
                "botId",
                "key",
                "url",
                "size",
                "contentType",
                "tags",
                "metadata",
                "createdAt",
                "updatedAt",
                "accessPolicies",
                "index",
                "status",
                "owner"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "file"
          ],
          "title": "copyFileResponse",
          "additionalProperties": false
        }
      }
    },
    "searchFiles": {
      "name": "searchFiles",
      "path": "/v1/files/search",
      "description": "Search files",
      "method": "get",
      "section": "files",
      "parameters": {
        "tags": {
          "in": "query",
          "description": "Filter files by tags. Tags should be passed as a URL-encoded JSON object of key-value pairs that must be present in the tags of a file. An array of multiple string values for the same key are treated as an OR condition. To exclude a value, express it as an object with a nested `not` key with the string or string-array value(s) to exclude.",
          "type": "object",
          "schema": {}
        },
        "query": {
          "in": "query",
          "type": "string",
          "description": "Query expressed in natural language to retrieve matching text passages within all indexed files in the bot using semantical search.",
          "required": true
        },
        "contextDepth": {
          "in": "query",
          "type": "integer",
          "description": "The number of neighbor passages to prepend and append as surrounding context to the content of each returned passage (default: 1, minimum: 0, maximum: 10)."
        },
        "limit": {
          "in": "query",
          "type": "integer",
          "description": "The maximum number of passages to return."
        },
        "consolidate": {
          "in": "query",
          "type": "boolean",
          "description": "Consolidate the results by merging matching passages from the same file into a single passage per file. The consolidated passage will include the matching passages ordered by their original position in the file (rather than by relevance score) and include hierarchical context such as the title/subtitle to which they belong."
        },
        "includeBreadcrumb": {
          "in": "query",
          "type": "boolean",
          "description": "Prepend a breadcrumb to each passage, containing the title and subtitle(s) the passage belongs to in the file. This option is ignored when the `consolidate` option is set to `true`."
        },
        "withContext": {
          "in": "query",
          "type": "boolean",
          "description": "Include the surrounding context with each passage in the `context` property of each passage. Not supported when `consolidate` is set to `true`."
        }
      },
      "response": {
        "description": "Returns the text passages within all indexed files that matched the query.",
        "schema": {
          "type": "object",
          "properties": {
            "passages": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "The content of the matching passage in the file including surrounding context, if any."
                  },
                  "score": {
                    "type": "number",
                    "description": "The score indicating the similarity of the passage to the query. A higher score indicates higher similarity."
                  },
                  "meta": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "chunk",
                          "summary",
                          "consolidated",
                          "image"
                        ],
                        "description": "The type of passage"
                      },
                      "subtype": {
                        "type": "string",
                        "enum": [
                          "title",
                          "subtitle",
                          "paragraph",
                          "blockquote",
                          "list",
                          "table",
                          "code",
                          "image",
                          "page"
                        ],
                        "description": "The subtype of passage, if available."
                      },
                      "pageNumber": {
                        "type": "integer",
                        "description": "Page number the passage is located on. Only applicable if the passage was extracted from a PDF file."
                      },
                      "position": {
                        "type": "integer",
                        "description": "Position number of the passage in the file relative to the other passages, if available. Can be used to know the order of passages within a file."
                      },
                      "sourceUrl": {
                        "type": "string",
                        "format": "uri",
                        "description": "The URL of the source file for the vector, if applicable (e.g. for image vectors)."
                      }
                    },
                    "description": "The passage metadata."
                  },
                  "file": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "File ID"
                      },
                      "key": {
                        "type": "string",
                        "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
                      },
                      "contentType": {
                        "type": "string",
                        "description": "MIME type of the file's content"
                      },
                      "tags": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "description": "The tags of the file as an object of key-value pairs."
                      },
                      "createdAt": {
                        "type": "string",
                        "description": "File creation timestamp in ISO 8601 format"
                      },
                      "updatedAt": {
                        "type": "string",
                        "description": "File last update timestamp in ISO 8601 format"
                      }
                    },
                    "required": [
                      "id",
                      "key",
                      "contentType",
                      "tags",
                      "createdAt",
                      "updatedAt"
                    ]
                  },
                  "context": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "The ID of the vector that the context passage belongs to. Omitted for breadcrumbs."
                        },
                        "text": {
                          "type": "string"
                        },
                        "offset": {
                          "type": "integer",
                          "description": "Position of the context passage relative to the current passage. Negative for preceding passages, positive for subsequent, ommited for breadcrumbs."
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "preceding",
                            "subsequent",
                            "current",
                            "breadcrumb"
                          ],
                          "description": "The type of context passage"
                        }
                      },
                      "required": [
                        "text",
                        "type"
                      ]
                    },
                    "description": "Surrounding passages including the current passage, based on the requested `contextDepth`. Only returned if the `withContext` parameter is set to `true`. Not supported when using the `consolidate` option."
                  }
                },
                "required": [
                  "content",
                  "score",
                  "meta",
                  "file"
                ]
              }
            }
          },
          "required": [
            "passages"
          ],
          "title": "searchFilesResponse",
          "additionalProperties": false
        }
      }
    },
    "listFilePassages": {
      "name": "listFilePassages",
      "path": "/v1/files/{id}/passages",
      "description": "List passages for a file",
      "method": "get",
      "section": "files",
      "parameters": {
        "nextToken": {
          "in": "query",
          "description": "Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results",
          "type": "string"
        },
        "id": {
          "type": "string",
          "description": "File ID or Key",
          "in": "path"
        },
        "limit": {
          "type": "number",
          "description": "The maximum number of passages to return per request (optional, default: 20, max: 200).",
          "in": "query"
        }
      },
      "response": {
        "description": "Returns the list of passages extracted from a file.",
        "schema": {
          "type": "object",
          "properties": {
            "passages": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Passage ID"
                  },
                  "content": {
                    "type": "string",
                    "description": "The content of the passage."
                  },
                  "meta": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "chunk",
                          "summary",
                          "consolidated",
                          "image"
                        ],
                        "description": "The type of passage"
                      },
                      "subtype": {
                        "type": "string",
                        "enum": [
                          "title",
                          "subtitle",
                          "paragraph",
                          "blockquote",
                          "list",
                          "table",
                          "code",
                          "image",
                          "page"
                        ],
                        "description": "The subtype of passage, if available."
                      },
                      "pageNumber": {
                        "type": "integer",
                        "description": "Page number the passage is located on. Only applicable if the passage was extracted from a PDF file."
                      },
                      "position": {
                        "type": "integer",
                        "description": "Position number of the passage in the file relative to the other passages, if available. Can be used to know the order of passages within a file."
                      },
                      "sourceUrl": {
                        "type": "string",
                        "format": "uri",
                        "description": "The URL of the source file for the vector, if applicable (e.g. for image vectors)."
                      }
                    },
                    "description": "The passage metadata."
                  }
                },
                "required": [
                  "id",
                  "content",
                  "meta"
                ]
              }
            },
            "meta": {
              "type": "object",
              "properties": {
                "nextToken": {
                  "type": "string",
                  "description": "The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint."
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "passages",
            "meta"
          ],
          "title": "listFilePassagesResponse",
          "additionalProperties": false
        }
      }
    },
    "setFilePassages": {
      "name": "setFilePassages",
      "path": "/v1/files/{id}/passages",
      "description": "Sets the indexed file passages asynchronously. All existing indexed passages will be deleted as soon as the indexing begins. This endpoint will return immediately and set the file status to \"indexing_pending\". Once the new passages are indexed the file status will be set to \"indexing_completed\", or \"indexing_failed\" if the passages failed to be indexed.",
      "method": "put",
      "section": "files",
      "parameters": {
        "id": {
          "type": "string",
          "description": "File ID or Key",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "List of passages to index for the file. These will replacing all the existing passages. Indexing of the new passages will be done asynchronously in the background. You can check the file status to see when the indexing is complete.",
        "schema": {
          "type": "object",
          "properties": {
            "passages": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "The content of the passage, supports Markdown formatting."
                  },
                  "type": {
                    "default": "paragraph",
                    "type": "string",
                    "enum": [
                      "title",
                      "subtitle",
                      "paragraph",
                      "blockquote",
                      "list",
                      "table",
                      "code",
                      "image"
                    ],
                    "description": "The type should match the Markdown format used for the passage content."
                  },
                  "pageNumber": {
                    "type": "integer"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "description": "Note: The passages should appear in the array in the same order as they appear in the original document."
            }
          },
          "required": [
            "passages"
          ],
          "title": "setFilePassagesBody",
          "additionalProperties": false
        }
      },
      "contentType": "application/json",
      "response": {
        "description": "Empty response.",
        "schema": {
          "type": "object",
          "title": "setFilePassagesResponse",
          "additionalProperties": false
        }
      }
    },
    "listFileTags": {
      "name": "listFileTags",
      "path": "/v1/files/tags",
      "description": "List available tags",
      "method": "get",
      "section": "files",
      "parameters": {
        "nextToken": {
          "in": "query",
          "description": "Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results",
          "type": "string"
        }
      },
      "response": {
        "description": "Returns the list of available tags used across all files of the bot.",
        "schema": {
          "type": "object",
          "properties": {
            "tags": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "meta": {
              "type": "object",
              "properties": {
                "nextToken": {
                  "type": "string",
                  "description": "The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint."
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "tags",
            "meta"
          ],
          "title": "listFileTagsResponse",
          "additionalProperties": false
        }
      }
    },
    "listFileTagValues": {
      "name": "listFileTagValues",
      "path": "/v1/files/tags/{tag}/values",
      "description": "List available tags",
      "method": "get",
      "section": "files",
      "parameters": {
        "nextToken": {
          "in": "query",
          "description": "Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results",
          "type": "string"
        },
        "tag": {
          "type": "string",
          "description": "Tag name",
          "in": "path"
        }
      },
      "response": {
        "description": "Returns the list of available values used for a given tag across all files of the bot.",
        "schema": {
          "type": "object",
          "properties": {
            "values": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "meta": {
              "type": "object",
              "properties": {
                "nextToken": {
                  "type": "string",
                  "description": "The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint."
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "values",
            "meta"
          ],
          "title": "listFileTagValuesResponse",
          "additionalProperties": false
        }
      }
    },
    "createKnowledgeBase": {
      "name": "createKnowledgeBase",
      "path": "/v1/files/knowledge-bases",
      "description": "Creates a knowledge base for grouping files.",
      "method": "post",
      "requestBody": {
        "description": "Properties of the knowledge base.",
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the knowledge base."
            },
            "tags": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "required": [
            "name"
          ],
          "title": "createKnowledgeBaseBody",
          "additionalProperties": false
        }
      },
      "contentType": "application/json",
      "section": "files",
      "response": {
        "description": "The created knowledge base",
        "schema": {
          "type": "object",
          "properties": {
            "knowledgeBase": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Knowledge base ID"
                },
                "name": {
                  "type": "string",
                  "description": "Name of the knowledge base."
                },
                "tags": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "name",
                "tags"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "knowledgeBase"
          ],
          "title": "createKnowledgeBaseResponse",
          "additionalProperties": false
        }
      },
      "parameters": {}
    },
    "deleteKnowledgeBase": {
      "name": "deleteKnowledgeBase",
      "path": "/v1/files/knowledge-bases/{id}",
      "description": "Deletes a knowledge base.",
      "method": "delete",
      "section": "files",
      "parameters": {
        "id": {
          "type": "string",
          "description": "Knowledge base ID",
          "in": "path"
        }
      },
      "response": {
        "description": "Empty response.",
        "schema": {
          "type": "object",
          "title": "deleteKnowledgeBaseResponse",
          "additionalProperties": false
        }
      }
    },
    "updateKnowledgeBase": {
      "name": "updateKnowledgeBase",
      "path": "/v1/files/knowledge-bases/{id}",
      "description": "Updates a knowledge base.",
      "method": "put",
      "section": "files",
      "parameters": {
        "id": {
          "type": "string",
          "description": "Knowledge base ID",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "Properties of the knowledge base to update.",
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "New name of the knowledge base."
            },
            "tags": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "maxLength": 1000,
                "nullable": true
              },
              "description": "The knowledge base tags to update as an object of key-value pairs with `string` (text) values. Omit to keep existing tags intact. Any existing tags not included will be preserved. New tags will be added. To delete a tag, set its value to `null`."
            }
          },
          "required": [
            "name"
          ],
          "title": "updateKnowledgeBaseBody",
          "additionalProperties": false
        }
      },
      "contentType": "application/json",
      "response": {
        "description": "The updated knowledge base",
        "schema": {
          "type": "object",
          "properties": {
            "knowledgeBase": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Knowledge base ID"
                },
                "name": {
                  "type": "string",
                  "description": "Name of the knowledge base."
                },
                "tags": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "name",
                "tags"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "knowledgeBase"
          ],
          "title": "updateKnowledgeBaseResponse",
          "additionalProperties": false
        }
      }
    },
    "listKnowledgeBases": {
      "name": "listKnowledgeBases",
      "path": "/v1/files/knowledge-bases",
      "description": "List knowledge bases for bot",
      "method": "get",
      "section": "files",
      "parameters": {
        "nextToken": {
          "in": "query",
          "description": "Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results",
          "type": "string"
        },
        "tags": {
          "in": "query",
          "description": "Filter files by tags. Tags should be passed as a URL-encoded JSON object of key-value pairs that must be present in the tags of a file. An array of multiple string values for the same key are treated as an OR condition. To exclude a value, express it as an object with a nested `not` key with the string or string-array value(s) to exclude.",
          "type": "object",
          "schema": {}
        }
      },
      "response": {
        "description": "Returns the list of knowledge bases for the bot.",
        "schema": {
          "type": "object",
          "properties": {
            "knowledgeBases": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Knowledge base ID"
                  },
                  "name": {
                    "type": "string",
                    "description": "Name of the knowledge base."
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "Knowledge base creation timestamp in ISO 8601 format"
                  },
                  "tags": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "createdAt",
                  "tags"
                ]
              }
            },
            "meta": {
              "type": "object",
              "properties": {
                "nextToken": {
                  "type": "string",
                  "description": "The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint."
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "knowledgeBases",
            "meta"
          ],
          "title": "listKnowledgeBasesResponse",
          "additionalProperties": false
        }
      }
    }
  },
  "metadata": {
    "title": "Botpress Files API",
    "description": "API for Botpress Files",
    "server": "https://api.botpress.cloud",
    "version": "1.48.2",
    "prefix": "v1"
  },
  "errors": [
    {
      "status": 500,
      "type": "Unknown",
      "description": "An unknown error occurred"
    },
    {
      "status": 500,
      "type": "Internal",
      "description": "An internal error occurred"
    },
    {
      "status": 401,
      "type": "Unauthorized",
      "description": "The request requires to be authenticated."
    },
    {
      "status": 403,
      "type": "Forbidden",
      "description": "The requested action can't be peform by this resource."
    },
    {
      "status": 413,
      "type": "PayloadTooLarge",
      "description": "The request payload is too large."
    },
    {
      "status": 400,
      "type": "InvalidPayload",
      "description": "The request payload is invalid."
    },
    {
      "status": 415,
      "type": "UnsupportedMediaType",
      "description": "The request is invalid because the content-type is not supported."
    },
    {
      "status": 405,
      "type": "MethodNotFound",
      "description": "The requested method does not exist."
    },
    {
      "status": 404,
      "type": "ResourceNotFound",
      "description": "The requested resource does not exist."
    },
    {
      "status": 400,
      "type": "InvalidJsonSchema",
      "description": "The provided JSON schema is invalid."
    },
    {
      "status": 400,
      "type": "InvalidDataFormat",
      "description": "The provided data doesn't respect the provided JSON schema."
    },
    {
      "status": 400,
      "type": "InvalidIdentifier",
      "description": "The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters."
    },
    {
      "status": 409,
      "type": "RelationConflict",
      "description": "The resource is related with a different resource that the one referenced in the request. This is usually caused when providing two resource identifiers that aren't linked together."
    },
    {
      "status": 409,
      "type": "ReferenceConstraint",
      "description": "The resource cannot be deleted because it's referenced by another resource"
    },
    {
      "status": 409,
      "type": "ResourceLockedConflict",
      "description": "The resource is current locked and cannot be operated on until the lock is released."
    },
    {
      "status": 410,
      "type": "ResourceGone",
      "description": "The requested resource is no longer available."
    },
    {
      "status": 400,
      "type": "ReferenceNotFound",
      "description": "The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request."
    },
    {
      "status": 400,
      "type": "InvalidQuery",
      "description": "The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource."
    },
    {
      "status": 400,
      "type": "Runtime",
      "description": "An error happened during the execution of a runtime (bot or integration)."
    },
    {
      "status": 409,
      "type": "AlreadyExists",
      "description": "The record attempted to be created already exists."
    },
    {
      "status": 429,
      "type": "RateLimited",
      "description": "The request has been rate limited."
    },
    {
      "status": 402,
      "type": "PaymentRequired",
      "description": "A payment is required to perform this request."
    },
    {
      "status": 403,
      "type": "QuotaExceeded",
      "description": "The request exceeds the allowed quota. Quotas are a soft limit that can be increased."
    },
    {
      "status": 413,
      "type": "LimitExceeded",
      "description": "The request exceeds the allowed limit. Limits are a hard limit that cannot be increased."
    },
    {
      "status": 400,
      "type": "BreakingChanges",
      "description": "Request payload contains breaking changes which is not allowed for this resource without a version increment."
    }
  ],
  "refs": {
    "parameters": {},
    "requestBodies": {
      "upsertFileBody": true,
      "updateFileMetadataBody": true,
      "copyFileBody": true,
      "setFilePassagesBody": true,
      "createKnowledgeBaseBody": true,
      "updateKnowledgeBaseBody": true
    },
    "responses": {
      "upsertFileResponse": true,
      "deleteFileResponse": true,
      "listFilesResponse": true,
      "getFileResponse": true,
      "updateFileMetadataResponse": true,
      "copyFileResponse": true,
      "searchFilesResponse": true,
      "listFilePassagesResponse": true,
      "setFilePassagesResponse": true,
      "listFileTagsResponse": true,
      "listFileTagValuesResponse": true,
      "createKnowledgeBaseResponse": true,
      "deleteKnowledgeBaseResponse": true,
      "updateKnowledgeBaseResponse": true,
      "listKnowledgeBasesResponse": true
    },
    "schemas": {
      "File": true
    }
  },
  "schemas": {
    "File": {
      "section": "files",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "File ID"
          },
          "botId": {
            "type": "string",
            "description": "The ID of the bot the file belongs to"
          },
          "key": {
            "type": "string",
            "description": "Unique key for the file. Must be unique across the bot (and the integration, when applicable)."
          },
          "url": {
            "type": "string",
            "description": "URL to retrieve the file content. This URL will be ready to use once the file is uploaded.\n\nIf the file has a `public_content` policy, this will contain the permanent public URL to retrieve the file, otherwise this will contain a temporary pre-signed URL to download the file which should be used shortly after retrieving and should not be stored long-term as the URL will expire after a short timeframe."
          },
          "size": {
            "type": "number",
            "description": "File size in bytes. Non-null if file upload status is \"COMPLETE\".",
            "nullable": true
          },
          "contentType": {
            "type": "string",
            "description": "MIME type of the file's content"
          },
          "tags": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 1000
            },
            "description": "The tags of the file as an object of key/value pairs"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "description": "Metadata of the file as an object of key/value pairs. The values can be of any type."
          },
          "createdAt": {
            "type": "string",
            "description": "File creation timestamp in ISO 8601 format"
          },
          "updatedAt": {
            "type": "string",
            "description": "File last update timestamp in ISO 8601 format"
          },
          "accessPolicies": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "integrations",
                "public_content"
              ]
            },
            "description": "Access policies configured for the file."
          },
          "index": {
            "type": "boolean",
            "description": "Whether the file was requested to be indexed for search or not."
          },
          "status": {
            "type": "string",
            "enum": [
              "upload_pending",
              "upload_failed",
              "upload_completed",
              "indexing_pending",
              "indexing_failed",
              "indexing_completed"
            ],
            "description": "Status of the file. If the status is `upload_pending`, the file content has not been uploaded yet. The status will be set to `upload_completed` once the file content has been uploaded successfully.\n\nIf the upload failed for any reason (e.g. exceeding the storage quota or the maximum file size limit) the status will be set to `upload_failed` and the reason for the failure will be available in the `failedStatusReason` field of the file.\n\nHowever, if the file has been uploaded and the `index` attribute was set to `true` on the file, the status will immediately transition to the `indexing_pending` status (the `upload_completed` status step will be skipped).\n\nOnce the indexing is completed and the file is ready to be used for searching its status will be set to `indexing_completed`. If the indexing failed the status will be set to `indexing_failed` and the reason for the failure will be available in the `failedStatusReason` field."
          },
          "failedStatusReason": {
            "type": "string",
            "description": "If the file status is `upload_failed` or `indexing_failed` this will contain the reason of the failure."
          },
          "expiresAt": {
            "type": "string",
            "description": "File expiry timestamp in ISO 8601 format"
          },
          "owner": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "bot",
                  "integration",
                  "user"
                ]
              },
              "id": {
                "type": "string",
                "description": "This field is present if `type` is \"user\" or \"bot\". If `type` is \"user\", this is the user ID. If `type` is \"bot\", this is the bot ID."
              },
              "name": {
                "type": "string",
                "description": "This field is present if the `type` is \"integration\". If `type` is \"integration\", this is the integration name."
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          "indexingStack": {
            "type": "string",
            "enum": [
              "v1",
              "v2"
            ],
            "description": "Indicates the indexing stack used to index this file. Present only when file has been successfully indexed. A value of \"v2\" denotes the latest stack, \"v1\" denotes the legacy stack."
          }
        },
        "required": [
          "id",
          "botId",
          "key",
          "url",
          "size",
          "contentType",
          "tags",
          "metadata",
          "createdAt",
          "updatedAt",
          "accessPolicies",
          "index",
          "status",
          "owner"
        ],
        "additionalProperties": false
      }
    }
  },
  "sections": [
    {
      "title": "Files",
      "description": "The Files API allows you to create, manage, and index files that can be used by your bots and integrations. Files can be in any text or binary format, and documents (such as PDF, Microsoft Word, HTML, Markdown, etc.) can be indexed to be used for semantic search in RAG (Retrieval Augmented Generation) implementations. Files are private by default but can be made publicly accessible through a permanent URL that's unique for each file.",
      "name": "files",
      "operations": [
        "upsertFile",
        "deleteFile",
        "listFiles",
        "getFile",
        "updateFileMetadata",
        "copyFile",
        "searchFiles",
        "listFilePassages",
        "setFilePassages",
        "listFileTags",
        "listFileTagValues",
        "createKnowledgeBase",
        "deleteKnowledgeBase",
        "updateKnowledgeBase",
        "listKnowledgeBases"
      ],
      "schema": "File"
    }
  ],
  "options": {
    "allowUnions": false
  }
} satisfies State