{
  "openapi": "3.0.0",
  "paths": {
    "/v1/integrations": {
      "get": {
        "description": "Retrieves a list of all integrations, optionally filtered by active status",
        "operationId": "IntegrationController_getAllIntegrations",
        "parameters": [
          {
            "name": "active",
            "required": false,
            "in": "query",
            "schema": {
              "default": true,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Integrations retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Get All Integrations",
        "tags": [
          "Integration"
        ]
      }
    },
    "/v1/integrations/{customerIntegrationId}/users/{userId}": {
      "get": {
        "description": "Retrieves a user for a specific customer integration",
        "operationId": "IntegrationController_getIntegrationUser",
        "parameters": [
          {
            "name": "customerIntegrationId",
            "required": true,
            "in": "path",
            "description": "Customer integration ID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "required": true,
            "in": "path",
            "description": "User ID associated with the integration",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Integration user retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationUserResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Get Integration User",
        "tags": [
          "Integration"
        ]
      }
    },
    "/v1/integrations/{customerIntegrationId}/users/{userId}/auth-url": {
      "post": {
        "description": "Generates an auth URL for a specific integration user. User will be created if it does not exist for the integration.",
        "operationId": "IntegrationController_generateIntegrationUserAuthUrl",
        "parameters": [
          {
            "name": "customerIntegrationId",
            "required": true,
            "in": "path",
            "description": "Customer integration ID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "required": true,
            "in": "path",
            "description": "User ID associated with the integration",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationUserAuthUrlRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Auth URL generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationUserAuthUrlResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Generate Integration User Auth URL",
        "tags": [
          "Integration"
        ]
      }
    },
    "/v1/runs": {
      "get": {
        "description": "Retrieves a paginated list of runs for the authenticated user",
        "operationId": "RunController_listRuns",
        "parameters": [
          {
            "name": "includeEvents",
            "required": false,
            "in": "query",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "userId",
            "required": false,
            "in": "query",
            "description": "Filter runs by user ID",
            "schema": {
              "example": "user_12345",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter runs by a single status value",
            "schema": {
              "example": "RUNNING",
              "enum": [
                "QUEUED",
                "RUNNING",
                "AUTH_REQUIRED",
                "PAUSED",
                "CANCELED",
                "NO_SUCCESS",
                "PARTIAL_SUCCESS",
                "SUCCESS",
                "FAILED"
              ],
              "type": "string"
            }
          },
          {
            "name": "customerIntegrationIds",
            "required": false,
            "in": "query",
            "description": "Filter runs by customer integration IDs. Use repeated query params, for example: ?customerIntegrationIds=salesforce_abcd1234&customerIntegrationIds=hubspot_efgh5678",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 1000,
              "default": 1,
              "type": "number"
            }
          },
          {
            "name": "pageSize",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 10,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Runs retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunsWithPaginationDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "List Runs",
        "tags": [
          "Run"
        ]
      },
      "post": {
        "description": "Creates a new run with the specified intent and selected integrations",
        "operationId": "RunController_createRun",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRunRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Run successfully created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateRunResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body or parameters"
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Create a new Run",
        "tags": [
          "Run"
        ]
      }
    },
    "/v1/runs/approval": {
      "get": {
        "description": "Approve or deny a run or its individual steps",
        "operationId": "RunController_runApproval",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Approval handled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body or parameters"
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Approve or deny a run or its individual steps",
        "tags": [
          "Run"
        ]
      }
    },
    "/v1/runs/{runId}": {
      "delete": {
        "description": "Aborts a running or queued run by its ID",
        "operationId": "RunController_abortRun",
        "parameters": [
          {
            "name": "runId",
            "required": true,
            "in": "path",
            "description": "Unique identifier of the run to abort",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Run successfully aborted"
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "404": {
            "description": "Run not found"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Abort a Run",
        "tags": [
          "Run"
        ]
      },
      "get": {
        "description": "Retrieves detailed information about a specific run",
        "operationId": "RunController_getRun",
        "parameters": [
          {
            "name": "runId",
            "required": true,
            "in": "path",
            "description": "Unique identifier of the run to retrieve",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "includeEvents",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Include run events in the response (e.g., \"true\" or \"false\")"
          }
        ],
        "responses": {
          "200": {
            "description": "Run details retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "404": {
            "description": "Run not found"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Get Run details",
        "tags": [
          "Run"
        ]
      }
    },
    "/v1/runs/{runId}/sse": {
      "get": {
        "description": "Establishes a Server-Sent Events connection to stream real-time updates for a run",
        "operationId": "RunController_sse",
        "parameters": [
          {
            "name": "runId",
            "required": true,
            "in": "path",
            "description": "Unique identifier of the run to stream events for",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "includeToolCalls",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Include tool call details in the stream (e.g., \"true\" or \"false\"). By default, tool calls are not included and for step events, only text (description of the step) is included."
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream established successfully",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events stream with run updates"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "404": {
            "description": "Run not found"
          },
          "500": {
            "description": "Internal server error or stream error"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Server-Sent Events stream for a Run",
        "tags": [
          "Run"
        ]
      }
    },
    "/v1/execution-plans/{executionPlanId}": {
      "get": {
        "description": "Retrieves detailed information about a specific execution plan",
        "operationId": "ExecutionPlanController_getExecutionPlan",
        "parameters": [
          {
            "name": "executionPlanId",
            "required": true,
            "in": "path",
            "description": "Unique identifier of the execution plan to retrieve",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Execution plan details retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecPlanResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "404": {
            "description": "Execution plan not found"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Get Execution Plan details",
        "tags": [
          "ExecutionPlan"
        ]
      }
    },
    "/v1/feedback/run/{runId}": {
      "put": {
        "description": "Create or update feedback for a specific run",
        "operationId": "FeedbackController_upsertFeedback",
        "parameters": [
          {
            "name": "runId",
            "required": true,
            "in": "path",
            "description": "UUID of the run to provide feedback for",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertFeedbackDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Feedback successfully created or updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body or parameters"
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "404": {
            "description": "Run not found"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Upsert Feedback",
        "tags": [
          "Feedback"
        ]
      },
      "get": {
        "description": "Retrieve feedback for a specific run. Returns null if no feedback exists.",
        "operationId": "FeedbackController_getFeedbackByRunId",
        "parameters": [
          {
            "name": "runId",
            "required": true,
            "in": "path",
            "description": "UUID of the run to get feedback for",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Feedback retrieved successfully or null if not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "404": {
            "description": "Run not found"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Get Feedback by Run ID",
        "tags": [
          "Feedback"
        ]
      }
    },
    "/v1/feedback/{feedbackId}": {
      "get": {
        "description": "Retrieve feedback by its ID",
        "operationId": "FeedbackController_getFeedback",
        "parameters": [
          {
            "name": "feedbackId",
            "required": true,
            "in": "path",
            "description": "UUID of the feedback to retrieve",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Feedback retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          },
          "404": {
            "description": "Feedback not found"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Get Feedback by ID",
        "tags": [
          "Feedback"
        ]
      }
    },
    "/v1/users/{userId}/revoke-all": {
      "post": {
        "description": "Revokes all tokens associated with the specified user ID",
        "operationId": "UserController_revokeAll",
        "parameters": [
          {
            "name": "userId",
            "required": true,
            "in": "path",
            "description": "The user ID whose tokens will be revoked",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Users tokens revoke triggered"
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Revoke all tokens for a user",
        "tags": [
          "User"
        ]
      }
    },
    "/v1/actions": {
      "get": {
        "description": "Retrieves actions for the authenticated owner",
        "operationId": "ActionsController_listActions",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Actions retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListActionsResponseDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "List actions",
        "tags": [
          "Actions"
        ]
      }
    },
    "/v1/actions/run": {
      "post": {
        "description": "Runs an action for the specified action key, customer integration ID and user ID",
        "operationId": "ActionsController_runAction",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Action run successfully. Returns runId and output in the shape of action's output schema",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunActionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid API key"
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ],
        "summary": "Run an action",
        "tags": [
          "Actions"
        ]
      }
    }
  },
  "info": {
    "title": "toolregistry.ai API",
    "description": "API documentation for toolregistry.ai",
    "version": "1.0",
    "contact": {}
  },
  "tags": [],
  "servers": [
    {
      "url": "https://api.toolregistry.ai"
    }
  ],
  "components": {
    "securitySchemes": {
      "x-api-key": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "IntegrationResponseDto": {
        "type": "object",
        "properties": {
          "integrationId": {
            "type": "string"
          },
          "customerIntegrationId": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "logoUrl": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "authType": {
            "type": "string",
            "enum": [
              "NONE",
              "API_TOKEN",
              "OAUTH2",
              "AWS_ASSUME_ROLE",
              "GOOGLE_SERVICE_ACCOUNT_OAUTH"
            ],
            "description": "Currently active authentication type for the integration."
          }
        },
        "required": [
          "integrationId",
          "customerIntegrationId",
          "active",
          "name",
          "host",
          "updatedAt",
          "createdAt"
        ]
      },
      "IntegrationUserResponseDto": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "userId",
          "active",
          "updatedAt",
          "createdAt"
        ]
      },
      "IntegrationUserAuthUrlRequestDto": {
        "type": "object",
        "properties": {
          "redirectUri": {
            "type": "string",
            "description": "The optional redirect URI to redirect the user to after authentication. Askel will append query param ?status=success/error. If not provided, a default success/failure page will be shown."
          }
        }
      },
      "IntegrationUserAuthUrlResponseDto": {
        "type": "object",
        "properties": {
          "authorizeUrl": {
            "type": "string"
          }
        },
        "required": [
          "authorizeUrl"
        ]
      },
      "RunDto": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "description": "Unique identifier for the run",
            "format": "uuid"
          },
          "repeatKey": {
            "type": "string",
            "description": "Key passed or generated during creation to repeat the run later",
            "format": "string"
          },
          "repeatRunId": {
            "type": "string",
            "description": "The UUID of the run that was repeated",
            "format": "uuid"
          },
          "userId": {
            "type": "string",
            "description": "The ID of the user who initiated the run",
            "example": "user-123"
          },
          "status": {
            "type": "string",
            "description": "Current status of the run",
            "enum": [
              "QUEUED",
              "RUNNING",
              "AUTH_REQUIRED",
              "PAUSED",
              "CANCELED",
              "NO_SUCCESS",
              "PARTIAL_SUCCESS",
              "SUCCESS",
              "FAILED"
            ],
            "example": "RUNNING"
          },
          "executionPlanId": {
            "type": "string",
            "description": "The UUID of the execution plan that was used for the run",
            "format": "uuid",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "events": {
            "type": "array",
            "description": "Array of events in the run",
            "items": {
              "type": "object"
            }
          },
          "result": {
            "type": "object",
            "description": "Result of the run execution"
          },
          "approvalStrategy": {
            "type": "string",
            "description": "Approval strategy for the run",
            "enum": [
              "NONE",
              "ON_TOOL_CALL",
              "ON_START"
            ],
            "example": "NONE"
          },
          "outputSchema": {
            "type": "object",
            "description": "JSON Schema draft 7 schema for the run output format",
            "format": "json-schema"
          },
          "inputSchema": {
            "type": "object",
            "description": "JSON Schema draft 7 schema for run input format",
            "format": "json-schema"
          },
          "input": {
            "type": "object",
            "description": "Input provided when the run was created"
          },
          "intent": {
            "type": "string",
            "description": "The intent or goal for the run",
            "example": "Create a summary of the latest sales data"
          },
          "context": {
            "type": "string",
            "description": "Additional context that was provided during run creation",
            "example": "Focus on Q4 2023 data with regional breakdown"
          },
          "createdAt": {
            "type": "string",
            "description": "Timestamp when the run was created",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "description": "Timestamp when the run was last updated",
            "format": "date-time"
          }
        },
        "required": [
          "runId",
          "repeatKey",
          "status",
          "executionPlanId",
          "events",
          "intent",
          "context",
          "createdAt",
          "updatedAt"
        ]
      },
      "PaginationDto": {
        "type": "object",
        "properties": {
          "page": {
            "type": "number",
            "description": "Current page number",
            "example": 1
          },
          "pageSize": {
            "type": "number",
            "description": "Number of runs requested per page",
            "example": 10
          },
          "total": {
            "type": "number",
            "description": "Total number of runs matching the query",
            "example": 42
          }
        },
        "required": [
          "page",
          "pageSize",
          "total"
        ]
      },
      "RunsWithPaginationDto": {
        "type": "object",
        "properties": {
          "runs": {
            "description": "Runs matching the query",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RunDto"
            }
          },
          "pagination": {
            "description": "Pagination metadata for the result set",
            "allOf": [
              {
                "$ref": "#/components/schemas/PaginationDto"
              }
            ]
          }
        },
        "required": [
          "runs",
          "pagination"
        ]
      },
      "CustomerProvidedAwsCredentials": {
        "type": "object",
        "properties": {
          "accessKeyId": {
            "type": "string",
            "description": "The AWS access key ID for authenticating requests.",
            "example": "AKIAIOSFODNN7EXAMPLE"
          },
          "secretAccessKey": {
            "type": "string",
            "description": "The AWS secret access key paired with the access key ID.",
            "example": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
          },
          "sessionToken": {
            "type": "string",
            "description": "The temporary session token for AWS STS credentials.",
            "example": "FwoGZXIvYXdzEBYaDHqa0AP1/EXAMPLE_TOKEN"
          }
        },
        "required": [
          "accessKeyId",
          "secretAccessKey",
          "sessionToken"
        ]
      },
      "CustomerProvidedAwsAssumeRole": {
        "type": "object",
        "properties": {
          "roleArn": {
            "type": "string",
            "description": "The ARN of the IAM role to assume for cross-account access.",
            "example": "arn:aws:iam::123456789012:role/ExampleCrossAccountRole"
          },
          "externalId": {
            "type": "string",
            "description": "An external ID used to prevent confused deputy attacks when assuming the role.",
            "example": "YXNrZWwtZXh0LWlkLTEyMzQ1Njc4OTAxMg=="
          }
        },
        "required": [
          "roleArn",
          "externalId"
        ]
      },
      "CustomerProvidedOktaCredentials": {
        "type": "object",
        "properties": {
          "clientId": {
            "type": "string",
            "description": "The Okta application client ID.",
            "example": "0oa1ab2cd3efGHIJK456"
          },
          "kid": {
            "type": "string",
            "description": "The key ID (kid) of the private key used to sign client assertions.",
            "example": "5024582369161ba2"
          },
          "privateKey": {
            "type": "string",
            "description": "The PEM-encoded RSA private key used to sign client assertions (private_key_jwt).",
            "example": "-----BEGIN PRIVATE KEY-----\nMIIEvQ...\n-----END PRIVATE KEY-----"
          },
          "oauthTokenUrl": {
            "type": "string",
            "description": "The Okta OAuth 2.0 token endpoint URL for your organisation.",
            "example": "https://your-org.okta.com/oauth2/v1/token"
          },
          "scope": {
            "type": "string",
            "description": "Space-separated list of Okta API scopes to request.",
            "example": "okta.users.read okta.groups.read okta.logs.read"
          },
          "host": {
            "type": "string",
            "description": "Base host URL of your Okta organisation. If omitted, derived from oauthTokenUrl.",
            "example": "https://your-org.okta.com"
          }
        },
        "required": [
          "clientId",
          "kid",
          "privateKey",
          "oauthTokenUrl",
          "scope"
        ]
      },
      "CustomerProvidedPassThrough": {
        "type": "object",
        "properties": {
          "customerIntegrationId": {
            "type": "string",
            "description": "The ID of the customer integration this pass-through data applies to.",
            "example": "integration-1"
          },
          "headers": {
            "type": "object",
            "description": "Custom headers to include in requests for this integration.",
            "example": {
              "Authorization": "Bearer 1234567890"
            }
          },
          "query": {
            "type": "object",
            "description": "Custom query parameters to include in requests for this integration.",
            "example": {
              "apiKey": "abc123"
            }
          },
          "values": {
            "description": "Provider-specific auth credentials. Use one of: AWS temporary credentials, AWS assume-role, or Okta service app (private_key_jwt). Only one type may be supplied per integration.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerProvidedAwsCredentials"
              },
              {
                "$ref": "#/components/schemas/CustomerProvidedAwsAssumeRole"
              },
              {
                "$ref": "#/components/schemas/CustomerProvidedOktaCredentials"
              }
            ]
          }
        },
        "required": [
          "customerIntegrationId"
        ]
      },
      "CreateRunRequest": {
        "type": "object",
        "properties": {
          "intent": {
            "type": "string",
            "description": "The intent or goal for the run",
            "example": "Create a summary of the latest sales data"
          },
          "selectedCustomerIntegrationIds": {
            "description": "Array of selected customer integration IDs to use for the run, or use [\"*\"] to include all active integrations",
            "example": [
              "integration-1",
              "integration-2"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "context": {
            "type": "string",
            "description": "Additional context for the run execution",
            "example": "Focus on Q4 2023 data with regional breakdown"
          },
          "userId": {
            "type": "string",
            "description": "The ID of the user who is initiating the run",
            "example": "user-123"
          },
          "approvalStrategy": {
            "type": "string",
            "description": "Approval strategy for the run",
            "enum": [
              "NONE",
              "ON_TOOL_CALL",
              "ON_START"
            ],
            "example": "NONE"
          },
          "repeatKey": {
            "type": "string",
            "description": "The key of the run to repeat",
            "format": "string"
          },
          "outputSchema": {
            "type": "object",
            "description": "JSON Schema draft 7 schema for the run output format",
            "format": "json-schema"
          },
          "passThrough": {
            "description": "Pass through data for the run, e.g. credentials for the integrations used in the run",
            "example": [
              {
                "customerIntegrationId": "integration-1",
                "headers": {
                  "Authorization": "Bearer 1234567890"
                }
              }
            ],
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerProvidedPassThrough"
            }
          }
        },
        "required": [
          "intent",
          "selectedCustomerIntegrationIds",
          "context",
          "userId"
        ]
      },
      "ExecPlanStepDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the step",
            "example": "step-1"
          },
          "description": {
            "type": "string",
            "description": "Step description",
            "example": "Fetch all invoices from the last 30 days"
          },
          "dependsOnSteps": {
            "description": "List of step IDs that must be completed first",
            "example": [
              "step-0"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "description",
          "dependsOnSteps"
        ]
      },
      "ExecPlanDto": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Optional human-readable title for the execution plan",
            "example": "Monthly Revenue Report Plan"
          },
          "description": {
            "type": "string",
            "description": "High-level description of the execution plan",
            "example": "Gather information needed for a financial report"
          },
          "steps": {
            "description": "Ordered list of steps to execute the plan",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecPlanStepDto"
            }
          }
        },
        "required": [
          "description",
          "steps"
        ]
      },
      "ExecPlanResponseDto": {
        "type": "object",
        "properties": {
          "planType": {
            "type": "string",
            "description": "Plan serialization type",
            "enum": [
              "json",
              "text"
            ],
            "example": "json"
          },
          "plan": {
            "description": "Execution plan details",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExecPlanDto"
              },
              {
                "type": "string"
              }
            ]
          }
        },
        "required": [
          "planType",
          "plan"
        ]
      },
      "CreateRunResponse": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "description": "Unique identifier for the created run",
            "format": "uuid"
          },
          "repeatKey": {
            "type": "string",
            "description": "Key passed or generated during creation to repeat the run later",
            "format": "string"
          },
          "status": {
            "type": "string",
            "description": "Current status of the run",
            "enum": [
              "QUEUED",
              "RUNNING",
              "AUTH_REQUIRED",
              "PAUSED",
              "CANCELED",
              "NO_SUCCESS",
              "PARTIAL_SUCCESS",
              "SUCCESS",
              "FAILED"
            ],
            "example": "QUEUED"
          },
          "events": {
            "type": "array",
            "description": "Array of events in the run",
            "items": {
              "type": "object"
            }
          },
          "executionPlanId": {
            "type": "string",
            "description": "The UUID of the execution plan that was used for the run",
            "format": "uuid",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "plan": {
            "description": "Execution plan for the run",
            "allOf": [
              {
                "$ref": "#/components/schemas/ExecPlanResponseDto"
              }
            ]
          },
          "repeatRunId": {
            "type": "string",
            "description": "The UUID of the run that is going to be repeated.",
            "format": "uuid"
          }
        },
        "required": [
          "runId",
          "repeatKey",
          "status",
          "events",
          "executionPlanId",
          "plan"
        ]
      },
      "FeedbackSourceMetadataDto": {
        "type": "object",
        "properties": {
          "device": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "userAgent": {
            "type": "string"
          }
        }
      },
      "FeedbackSourceDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "user",
              "evaluator",
              "api"
            ]
          },
          "userId": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/FeedbackSourceMetadataDto"
          }
        }
      },
      "FeedbackMetadataDto": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "experimentId": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "clientVersion": {
            "type": "string"
          }
        }
      },
      "UpsertFeedbackDto": {
        "type": "object",
        "properties": {
          "rating": {
            "type": "string",
            "enum": [
              "positive",
              "negative"
            ],
            "description": "Required when creating new feedback"
          },
          "comment": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/FeedbackSourceDto"
          },
          "metadata": {
            "$ref": "#/components/schemas/FeedbackMetadataDto"
          }
        }
      },
      "FeedbackResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "rating": {
            "type": "string",
            "enum": [
              "positive",
              "negative"
            ]
          },
          "comment": {
            "type": "string"
          },
          "feedbackSource": {
            "$ref": "#/components/schemas/FeedbackSourceDto"
          },
          "metadata": {
            "$ref": "#/components/schemas/FeedbackMetadataDto"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "runId",
          "rating",
          "createdAt",
          "updatedAt"
        ]
      },
      "ListActionsResponseDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The key of the action",
            "example": "action-1"
          },
          "intent": {
            "type": "string",
            "description": "The intent associated with the action",
            "example": "Summarize latest sales report"
          },
          "outputSchema": {
            "type": "object",
            "description": "JSON Schema draft 7 schema for action output format",
            "format": "json-schema"
          },
          "inputSchema": {
            "type": "object",
            "description": "JSON Schema draft 7 schema for action input format",
            "format": "json-schema"
          },
          "useDefaultMapping": {
            "type": "boolean",
            "description": "Whether default input/output mapping is used",
            "example": true
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string",
            "description": "Action last update timestamp",
            "example": "2026-04-09T10:15:30.000Z"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string",
            "description": "Action creation timestamp",
            "example": "2026-04-01T08:00:00.000Z"
          }
        },
        "required": [
          "key",
          "intent",
          "useDefaultMapping",
          "updatedAt",
          "createdAt"
        ]
      },
      "RunActionRequest": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The key of the action to run",
            "example": "action-1"
          },
          "userId": {
            "type": "string",
            "description": "The ID of the user who is running the action",
            "example": "user-123"
          },
          "input": {
            "type": "object",
            "description": "Input parameters for the action. Required if action has input schema defined.",
            "example": {
              "name": "John Doe"
            }
          },
          "passThrough": {
            "description": "Pass through data for the action run, e.g. credentials for the integrations used in the run",
            "example": [
              {
                "customerIntegrationId": "integration-1",
                "headers": {
                  "Authorization": "Bearer 1234567890"
                }
              }
            ],
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "key",
          "userId"
        ]
      },
      "RunActionResponse": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "description": "The ID of the run that was created",
            "format": "uuid"
          },
          "output": {
            "type": "object",
            "description": "The output of the action"
          }
        },
        "required": [
          "runId",
          "output"
        ]
      }
    }
  }
}