{
  "openapi": "3.1.0",
  "info": {
    "title": "Klaris Agent API",
    "description": "Ask the Klaris Agent questions and have it get things done for your people, from your own app. Shaped like OpenAI's Responses API. Guide: https://developers.klarislabs.com/agent/",
    "version": "1"
  },
  "paths": {
    "/api/agent/v1/responses": {
      "post": {
        "tags": [
          "Responses"
        ],
        "summary": "Create Response",
        "description": "Ask the agent something for one person. Leave out `conversation` to start a new one. With `stream:\ntrue` you get server-sent events; otherwise the finished response. To answer approval requests, send\n`approval_response` items as the input, on their own. Each key may start up to 60 responses a\nminute; past that you get 429 `rate_limited`.",
        "operationId": "create_response_api_agent_v1_responses_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponseCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "responses"
      }
    },
    "/api/agent/v1/responses/{response_id}": {
      "get": {
        "tags": [
          "Responses"
        ],
        "summary": "Get Response",
        "description": "A response as it stands now: its status, output and cost. `user` is the person it was for.",
        "operationId": "get_response_api_agent_v1_responses__response_id__get",
        "parameters": [
          {
            "name": "response_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Response Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "responses"
      }
    },
    "/api/agent/v1/responses/{response_id}/cancel": {
      "post": {
        "tags": [
          "Responses"
        ],
        "summary": "Cancel Response",
        "description": "Stop a response that is still running. It stops within a few seconds; fetch it again to see\n`cancelled`. A finished one is returned as it is. `user` is the person it was for.",
        "operationId": "cancel_response_api_agent_v1_responses__response_id__cancel_post",
        "parameters": [
          {
            "name": "response_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Response Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "responses"
      }
    },
    "/api/agent/v1/conversations": {
      "post": {
        "tags": [
          "Conversations"
        ],
        "summary": "Create Conversation",
        "description": "Start an empty conversation for a person. Optional: `POST /responses` starts one for you.",
        "operationId": "create_conversation_api_agent_v1_conversations_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConversationCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "conversations"
      },
      "get": {
        "tags": [
          "Conversations"
        ],
        "summary": "List Conversations",
        "description": "One person's conversations, newest first.",
        "operationId": "list_conversations_api_agent_v1_conversations_get",
        "parameters": [
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "conversations"
      }
    },
    "/api/agent/v1/conversations/{conversation_id}": {
      "get": {
        "tags": [
          "Conversations"
        ],
        "summary": "Get Conversation",
        "description": "One conversation, if it belongs to this person.",
        "operationId": "get_conversation_api_agent_v1_conversations__conversation_id__get",
        "parameters": [
          {
            "name": "conversation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Conversation Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "conversations"
      },
      "delete": {
        "tags": [
          "Conversations"
        ],
        "summary": "Delete Conversation",
        "description": "Delete a conversation and the memories the agent saved in it.",
        "operationId": "delete_conversation_api_agent_v1_conversations__conversation_id__delete",
        "parameters": [
          {
            "name": "conversation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Conversation Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "conversations"
      }
    },
    "/api/agent/v1/tables/{table_id}/rows": {
      "get": {
        "tags": [
          "Files and tables"
        ],
        "summary": "Table Rows",
        "description": "More rows of a table the agent saved (a display's `table_id`), past the preview the display carries.\nAnswers 410 once the full result has been cleared (90 days without use).",
        "operationId": "table_rows_api_agent_v1_tables__table_id__rows_get",
        "parameters": [
          {
            "name": "table_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Table Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "conversations"
      }
    },
    "/api/agent/v1/files/{file_id}/content": {
      "get": {
        "tags": [
          "Files and tables"
        ],
        "summary": "Download File",
        "description": "A file the agent made in one of this person's conversations (from a `file` display), as a download.",
        "operationId": "download_file_api_agent_v1_files__file_id__content_get",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "File Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "conversations"
      }
    },
    "/api/agent/v1/conversations/{conversation_id}/items": {
      "get": {
        "tags": [
          "Conversations"
        ],
        "summary": "List Items",
        "description": "Everything said and done in a conversation, oldest first: messages, tool calls and their results,\nand approval requests.",
        "operationId": "list_items_api_agent_v1_conversations__conversation_id__items_get",
        "parameters": [
          {
            "name": "conversation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Conversation Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "conversations"
      }
    },
    "/api/agent/v1/memories": {
      "get": {
        "tags": [
          "Memories"
        ],
        "summary": "List Memories",
        "description": "What the agent remembers about one person, oldest first.",
        "operationId": "list_memories_api_agent_v1_memories_get",
        "parameters": [
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "memories"
      },
      "post": {
        "tags": [
          "Memories"
        ],
        "summary": "Create Memory",
        "description": "Add something for the agent to remember about a person. The same text twice is kept once. Health\ndetails, passwords, keys and account numbers are refused.",
        "operationId": "create_memory_api_agent_v1_memories_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemoryCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "memories"
      }
    },
    "/api/agent/v1/memories/{memory_id}": {
      "patch": {
        "tags": [
          "Memories"
        ],
        "summary": "Change Memory",
        "description": "Change what a memory says.",
        "operationId": "change_memory_api_agent_v1_memories__memory_id__patch",
        "parameters": [
          {
            "name": "memory_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Memory Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemoryChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "memories"
      },
      "delete": {
        "tags": [
          "Memories"
        ],
        "summary": "Delete Memory",
        "description": "Forget a memory.",
        "operationId": "delete_memory_api_agent_v1_memories__memory_id__delete",
        "parameters": [
          {
            "name": "memory_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Memory Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "memories"
      }
    },
    "/api/agent/v1/usage": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Get Usage",
        "description": "The workspace's AI cost for a period. `feature=klaris_agent` keeps it to the agent API.",
        "operationId": "get_usage_api_agent_v1_usage_get",
        "parameters": [
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "feature",
                "use_case",
                "person",
                "key",
                "day",
                "model",
                "conversation"
              ],
              "type": "string",
              "default": "use_case",
              "title": "Group By"
            }
          },
          {
            "name": "feature",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Feature"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "usage"
      }
    },
    "/api/agent/v1/connections/types": {
      "get": {
        "tags": [
          "Connections"
        ],
        "summary": "Connection Types",
        "description": "The kinds of connection you can add, the fields each needs, and what the agent can do with it.",
        "operationId": "connection_types_api_agent_v1_connections_types_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-scope": "connections"
      }
    },
    "/api/agent/v1/connections": {
      "get": {
        "tags": [
          "Connections"
        ],
        "summary": "List Connections",
        "description": "The workspace's company connections, and with `user`, that person's own ones too. Logins are never\nsent back.",
        "operationId": "list_connections_api_agent_v1_connections_get",
        "parameters": [
          {
            "name": "user",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 255
                },
                {
                  "type": "null"
                }
              ],
              "description": "Also list this person's own connections.",
              "title": "User"
            },
            "description": "Also list this person's own connections."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "connections"
      },
      "post": {
        "tags": [
          "Connections"
        ],
        "summary": "Create Connection",
        "description": "Add a company connection, such as a Cloud SQL database. Secrets are stored encrypted. Check it\nafterwards: the agent only uses working connections.",
        "operationId": "create_connection_api_agent_v1_connections_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectionCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "connections"
      }
    },
    "/api/agent/v1/connections/connect_link": {
      "post": {
        "tags": [
          "Connections"
        ],
        "summary": "Connect Link",
        "description": "A one-time Google sign-in address (10 minutes) for a person to connect their own account.\nOpen it in the person's browser. After signing in they go to return_url (or a Klaris page) with\nconnected=<type>&ok=1, or ok=0&reason=cancelled|google_error|not_working.",
        "operationId": "connect_link_api_agent_v1_connections_connect_link_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectLink"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "connections"
      }
    },
    "/api/agent/v1/connections/{connection_id}": {
      "patch": {
        "tags": [
          "Connections"
        ],
        "summary": "Update Connection",
        "description": "Rename a connection or change its fields. Send only what changes. A personal connection needs\nits owner's `user`.",
        "operationId": "update_connection_api_agent_v1_connections__connection_id__patch",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Connection Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 255
                },
                {
                  "type": "null"
                }
              ],
              "description": "For a personal connection: its owner.",
              "title": "User"
            },
            "description": "For a personal connection: its owner."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectionUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "connections"
      },
      "delete": {
        "tags": [
          "Connections"
        ],
        "summary": "Delete Connection",
        "description": "Remove a connection. A person's own connection needs that person's `user`.",
        "operationId": "delete_connection_api_agent_v1_connections__connection_id__delete",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Connection Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 255
                },
                {
                  "type": "null"
                }
              ],
              "title": "User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "connections"
      }
    },
    "/api/agent/v1/connections/{connection_id}/check": {
      "post": {
        "tags": [
          "Connections"
        ],
        "summary": "Check Connection",
        "description": "Try the connection now and save the result. The agent only uses connections that passed. A\npersonal connection needs its owner's `user`.",
        "operationId": "check_connection_api_agent_v1_connections__connection_id__check_post",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Connection Id"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 255
                },
                {
                  "type": "null"
                }
              ],
              "description": "For a personal connection: its owner.",
              "title": "User"
            },
            "description": "For a personal connection: its owner."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-scope": "connections"
      }
    }
  },
  "components": {
    "schemas": {
      "ApprovalAnswer": {
        "properties": {
          "type": {
            "type": "string",
            "const": "approval_response",
            "title": "Type"
          },
          "approval_request_id": {
            "type": "string",
            "title": "Approval Request Id"
          },
          "approve": {
            "type": "boolean",
            "title": "Approve"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "type": "object",
        "required": [
          "type",
          "approval_request_id",
          "approve"
        ],
        "title": "ApprovalAnswer",
        "description": "The person's answer to an approval request (apr_…), sent as the next input."
      },
      "ConnectLink": {
        "properties": {
          "user": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "User",
            "description": "Your id for the person this is for. Conversations are kept per person."
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          },
          "type": {
            "type": "string",
            "maxLength": 40,
            "title": "Type",
            "description": "A personal type, such as gmail."
          },
          "return_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Return Url",
            "description": "Where to send the person after signing in, with connected=<type>&ok=1 (or ok=0&reason=…) added. Must be one of the workspace's allowed return addresses (Settings → API Keys). Leave out to land on a Klaris page saying it worked."
          }
        },
        "type": "object",
        "required": [
          "user",
          "type"
        ],
        "title": "ConnectLink"
      },
      "ConnectionCreate": {
        "properties": {
          "type": {
            "type": "string",
            "maxLength": 40,
            "title": "Type",
            "description": "See GET /connections/types."
          },
          "name": {
            "type": "string",
            "maxLength": 120,
            "minLength": 1,
            "title": "Name"
          },
          "values": {
            "additionalProperties": true,
            "type": "object",
            "title": "Values",
            "description": "The type's fields, secrets included."
          }
        },
        "type": "object",
        "required": [
          "type",
          "name"
        ],
        "title": "ConnectionCreate"
      },
      "ConnectionUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "values": {
            "additionalProperties": true,
            "type": "object",
            "title": "Values",
            "description": "Only what changes. An empty secret removes it."
          }
        },
        "type": "object",
        "title": "ConnectionUpdate"
      },
      "ConversationCreate": {
        "properties": {
          "user": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "User",
            "description": "Your id for the person this is for. Conversations are kept per person."
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          },
          "metadata": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Metadata"
          }
        },
        "type": "object",
        "required": [
          "user"
        ],
        "title": "ConversationCreate"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "InputMessage": {
        "properties": {
          "role": {
            "type": "string",
            "const": "user",
            "title": "Role"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "$ref": "#/components/schemas/InputText"
                },
                "type": "array"
              }
            ],
            "title": "Content"
          }
        },
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "title": "InputMessage"
      },
      "InputText": {
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "input_text",
              "text"
            ],
            "title": "Type",
            "default": "input_text"
          },
          "text": {
            "type": "string",
            "title": "Text"
          }
        },
        "type": "object",
        "required": [
          "text"
        ],
        "title": "InputText"
      },
      "MemoryChange": {
        "properties": {
          "user": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "User"
          },
          "text": {
            "type": "string",
            "maxLength": 300,
            "minLength": 1,
            "title": "Text"
          }
        },
        "type": "object",
        "required": [
          "user",
          "text"
        ],
        "title": "MemoryChange"
      },
      "MemoryCreate": {
        "properties": {
          "user": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "User",
            "description": "Your id for the person this is for. Conversations are kept per person."
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          },
          "text": {
            "type": "string",
            "maxLength": 300,
            "minLength": 1,
            "title": "Text",
            "description": "One short fact or preference, such as \"Prefers short summaries\"."
          }
        },
        "type": "object",
        "required": [
          "user",
          "text"
        ],
        "title": "MemoryCreate"
      },
      "ResponseCreate": {
        "properties": {
          "user": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "User",
            "description": "Your id for the person this is for. Conversations are kept per person."
          },
          "user_email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "User Email"
          },
          "user_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "User Name"
          },
          "input": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ApprovalAnswer"
                    },
                    {
                      "$ref": "#/components/schemas/InputMessage"
                    }
                  ]
                },
                "type": "array"
              }
            ],
            "title": "Input"
          },
          "conversation": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conversation",
            "description": "conv_… to continue; leave out to start a new one."
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          },
          "use_case": {
            "type": "string",
            "title": "Use Case",
            "description": "Your label for what this is for, used to group cost.",
            "default": "chat"
          },
          "metadata": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Metadata"
          }
        },
        "type": "object",
        "required": [
          "user",
          "input"
        ],
        "title": "ResponseCreate"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A workspace key from Settings → API Keys."
      }
    }
  },
  "security": [
    {
      "apiKey": []
    }
  ]
}
