{
  "openapi": "3.1.0",
  "info": {
    "title": "Quickly API",
    "version": "1.0.0",
    "description": "Workspace-scoped REST API for Quickly's AI operations command center. Use API keys to manage agents, playbooks, logs, tools, knowledge, conversations, workspace data, and custom integrations."
  },
  "servers": [
    {
      "url": "https://app.askquickly.ai",
      "description": "Production app and API origin"
    }
  ],
  "security": [
    {
      "ApiKeyBearer": []
    }
  ],
  "tags": [
    { "name": "Workspace" },
    { "name": "Agents" },
    { "name": "Playbooks" },
    { "name": "Logs" },
    { "name": "Tools" },
    { "name": "Integrations" },
    { "name": "Knowledge" },
    { "name": "Conversations" },
    { "name": "Billing" },
    { "name": "MCP" }
  ],
  "paths": {
    "/api/v1/workspace": {
      "get": {
        "tags": ["Workspace"],
        "summary": "Get current workspace",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "401": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/api/v1/workspace/stats": {
      "get": {
        "tags": ["Workspace"],
        "summary": "Get workspace statistics",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "401": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/api/v1/agents": {
      "get": {
        "tags": ["Agents"],
        "summary": "List agents",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "post": {
        "tags": ["Agents"],
        "summary": "Create an agent",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "201": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/agents/{id}": {
      "get": {
        "tags": ["Agents"],
        "summary": "Get an agent",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "404": { "$ref": "#/components/responses/Error" } }
      },
      "delete": {
        "tags": ["Agents"],
        "summary": "Delete an agent",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "204": { "description": "Deleted" } }
      }
    },
    "/api/v1/agents/{id}/playbooks": {
      "get": {
        "tags": ["Agents", "Playbooks"],
        "summary": "List playbooks assigned to an agent",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "post": {
        "tags": ["Agents", "Playbooks"],
        "summary": "Assign a playbook to an agent",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/agents/{id}/triggers": {
      "get": {
        "tags": ["Agents"],
        "summary": "List agent triggers",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "post": {
        "tags": ["Agents"],
        "summary": "Create an agent trigger",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "201": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/playbooks": {
      "get": {
        "tags": ["Playbooks"],
        "summary": "List playbooks",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "post": {
        "tags": ["Playbooks"],
        "summary": "Create a playbook",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "201": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/playbooks/{id}": {
      "get": {
        "tags": ["Playbooks"],
        "summary": "Get a playbook",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "404": { "$ref": "#/components/responses/Error" } }
      },
      "put": {
        "tags": ["Playbooks"],
        "summary": "Update a playbook",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "delete": {
        "tags": ["Playbooks"],
        "summary": "Delete a playbook",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "204": { "description": "Deleted" } }
      }
    },
    "/api/v1/playbooks/{id}/trigger": {
      "post": {
        "tags": ["Playbooks"],
        "summary": "Trigger a playbook run",
        "description": "Starts a governed playbook execution. Set async=true in the request body for non-blocking execution.",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "202": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/playbooks/{id}/runs": {
      "get": {
        "tags": ["Playbooks", "Logs"],
        "summary": "List playbook runs",
        "parameters": [{ "$ref": "#/components/parameters/id" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/playbooks/{id}/runs/{runId}": {
      "get": {
        "tags": ["Playbooks", "Logs"],
        "summary": "Get a playbook run",
        "parameters": [{ "$ref": "#/components/parameters/id" }, { "$ref": "#/components/parameters/runId" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "404": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/api/v1/logs": {
      "get": {
        "tags": ["Logs"],
        "summary": "List task and execution logs",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/logs/{taskId}": {
      "get": {
        "tags": ["Logs"],
        "summary": "Get one task log",
        "parameters": [{ "$ref": "#/components/parameters/taskId" }],
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "404": { "$ref": "#/components/responses/Error" } }
      }
    },
    "/api/v1/tools": {
      "get": {
        "tags": ["Tools"],
        "summary": "List available tools",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/integrations": {
      "get": {
        "tags": ["Integrations"],
        "summary": "List workspace integrations",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/custom-integrations": {
      "get": {
        "tags": ["Integrations"],
        "summary": "List custom integrations",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "post": {
        "tags": ["Integrations"],
        "summary": "Create a custom integration",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "201": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/knowledge/search": {
      "post": {
        "tags": ["Knowledge"],
        "summary": "Search workspace knowledge",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/knowledge/bases": {
      "get": {
        "tags": ["Knowledge"],
        "summary": "List knowledge bases",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "post": {
        "tags": ["Knowledge"],
        "summary": "Create a knowledge base",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "201": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/knowledge/entities": {
      "get": {
        "tags": ["Knowledge"],
        "summary": "List/search workspace entities",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      },
      "post": {
        "tags": ["Knowledge"],
        "summary": "Create a workspace entity",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "201": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/conversations": {
      "get": {
        "tags": ["Conversations"],
        "summary": "List conversations",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/chat": {
      "post": {
        "tags": ["Conversations"],
        "summary": "Send a chat message",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/messages": {
      "post": {
        "tags": ["Conversations"],
        "summary": "Create/send a message",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/v1/billing": {
      "get": {
        "tags": ["Billing"],
        "summary": "Get billing state",
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" } }
      }
    },
    "/api/mcp/v1": {
      "post": {
        "tags": ["MCP"],
        "summary": "MCP JSON-RPC endpoint",
        "description": "Streamable HTTP MCP endpoint. Production branded URL is https://mcp.askquickly.ai/api/mcp/v1.",
        "requestBody": { "$ref": "#/components/requestBodies/JsonObject" },
        "responses": { "200": { "$ref": "#/components/responses/JsonSuccess" }, "401": { "$ref": "#/components/responses/Error" } }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Workspace API key. Create in the Quickly dashboard. Keys start with qk_."
      }
    },
    "parameters": {
      "id": { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } },
      "runId": { "name": "runId", "in": "path", "required": true, "schema": { "type": "string" } },
      "taskId": { "name": "taskId", "in": "path", "required": true, "schema": { "type": "string" } }
    },
    "requestBodies": {
      "JsonObject": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      }
    },
    "responses": {
      "JsonSuccess": {
        "description": "Successful JSON response",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "Error": {
        "description": "Error response",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": { "type": "string" },
                "code": { "type": "string" },
                "requestId": { "type": "string" }
              },
              "additionalProperties": true
            }
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "Quickly API reference",
    "url": "https://askquickly.ai/api-reference"
  }
}
