{
  "openapi": "3.1.0",
  "info": {
    "title": "MindCloud Public API",
    "version": "2.0.0",
    "description": "REST surface under /v2. Authenticate with a MindCloud API key sent as a bearer token."
  },
  "servers": [
    {
      "url": "https://connect.mindcloud.co"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v2/workflows": {
      "get": {
        "operationId": "v2-list-workflows",
        "summary": "List workflows for the company with filtering, sorting, and pagination",
        "description": "List workflows for the company with filtering, sorting, and pagination. The workflow definition is only available on the detail endpoint.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, name, type, isActive, isTemplate, size, tags, createdOn, createdBy, updatedOn, updatedBy. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "name": {},
                          "type": {},
                          "isActive": {},
                          "isTemplate": {},
                          "size": {},
                          "tags": {},
                          "createdOn": {},
                          "createdBy": {},
                          "updatedOn": {},
                          "updatedBy": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "v2-create-workflow",
        "summary": "Create an empty workflow (metadata only)",
        "description": "Create an empty workflow (metadata only). New workflows start disabled; add steps in the app, then enable via PUT /v2/workflows/:workflowId.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "tags": {
                    "default": [],
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Workflow"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is invalid (INVALID_QUERY).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The insert returned no row (WORKFLOW_CREATE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/workflows/{workflowId}": {
      "get": {
        "operationId": "v2-get-workflow",
        "summary": "Get one workflow, including its full definition and summary",
        "description": "Get one workflow, including its full definition and summary.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "v2-update-workflow",
        "summary": "Update workflow metadata: rename, enable or disable through isActive, or replace the assigned tags",
        "description": "Update workflow metadata: rename, enable or disable through isActive, or replace the assigned tags.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "tags": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Workflow"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid, or none of \"name\", \"isActive\", or \"tags\" was provided (INVALID_QUERY, NO_FIELDS_TO_UPDATE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No workflow with this id belongs to the company (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "v2-delete-workflow",
        "summary": "Soft-delete a workflow",
        "description": "Soft-delete a workflow. The workflow is disabled and disappears from the API, along with its recorded runs.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/DeletedResource"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid (INVALID_QUERY).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No workflow with this id belongs to the company (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/workflows/{workflowId}/duplicate": {
      "post": {
        "operationId": "v2-duplicate-workflow",
        "summary": "Duplicate a workflow within the company, including its steps and schedules",
        "description": "Duplicate a workflow within the company, including its steps and schedules. The copy starts disabled and is named \"<source> (copy)\" unless a name is provided.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Workflow"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid (INVALID_QUERY).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No workflow with this id is in the company (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The workflow step graph is invalid (WORKFLOW_GRAPH_INVALID).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The duplicated workflow could not be loaded (WORKFLOW_DUPLICATE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/workflows/{workflowId}/run": {
      "post": {
        "operationId": "v2-run-workflow",
        "summary": "Start a workflow run",
        "description": "Start a workflow run. Execution is asynchronous: this returns the run id immediately; poll GET /v2/runs/:runId for the outcome. Runs the published version by default.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "default": "published",
                    "type": "string",
                    "enum": [
                      "published",
                      "draft"
                    ]
                  },
                  "environmentId": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The workflow log id. Poll GET /v2/runs/:runId with this id for the outcome."
                        },
                        "workflowId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "waiting"
                        },
                        "version": {
                          "type": "string",
                          "enum": [
                            "published",
                            "draft"
                          ]
                        },
                        "environmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "workflowId",
                        "status",
                        "version",
                        "environmentId"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid, or the environment id is unknown to the company (INVALID_QUERY, UNKNOWN_ENVIRONMENT).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No workflow with this id belongs to the company (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The workflow is disabled (WORKFLOW_DISABLED), or has no published version to run (WORKFLOW_NOT_PUBLISHED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The run could not be enqueued (RUN_ENQUEUE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/workflows/{workflowId}/versions": {
      "get": {
        "operationId": "v2-list-workflow-versions",
        "summary": "List versions of a workflow: the mutable draft (version \"draft\") plus published and unpublished snapshots, newest first",
        "description": "List versions of a workflow: the mutable draft (version \"draft\") plus published and unpublished snapshots, newest first.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/workflows/{workflowId}/runs": {
      "get": {
        "operationId": "v2-list-runs",
        "summary": "List runs of one workflow with filtering, sorting, and pagination",
        "description": "List runs of one workflow with filtering, sorting, and pagination. Filter by status, version, environmentId, startedOn range, endUserId, or installationId.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "workflows"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, workflowId, status, version, environmentId, environmentName, startedOn, finishedOn, durationMs, operations, errorCount, warningCount, infoCount, endUserId, installationId, triggerAppSlug. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "workflowId": {},
                          "status": {},
                          "version": {},
                          "environmentId": {},
                          "environmentName": {},
                          "startedOn": {},
                          "finishedOn": {},
                          "durationMs": {},
                          "operations": {},
                          "errorCount": {},
                          "warningCount": {},
                          "infoCount": {},
                          "endUserId": {},
                          "installationId": {},
                          "triggerAppSlug": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/runs/{runId}": {
      "get": {
        "operationId": "v2-get-run",
        "summary": "Get one workflow run, including its summary and, while running, the active step and message",
        "description": "Get one workflow run, including its summary and, while running, the active step and message.",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/runs/{runId}/cancel": {
      "post": {
        "operationId": "v2-cancel-run",
        "summary": "Request cancellation of a run",
        "description": "Request cancellation of a run. Cancellation is asynchronous: the runner stops at the next checkpoint and the run then reports status \"cancelled\". Runs that already finished are unaffected.",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/runs/{runId}/operations": {
      "get": {
        "operationId": "v2-list-run-operations",
        "summary": "List record-level operations (creates, updates, errors, warnings) for one run",
        "description": "List record-level operations (creates, updates, errors, warnings) for one run. Filter by actionStatus or operation.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, workflowLogId, stepId, stepInstanceId, actionId, appId, model, operation, actionStatus, primaryKey, message, createdOn. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "workflowLogId": {},
                          "stepId": {},
                          "stepInstanceId": {},
                          "actionId": {},
                          "appId": {},
                          "model": {},
                          "operation": {},
                          "actionStatus": {},
                          "primaryKey": {},
                          "message": {},
                          "createdOn": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/runs/{runId}/steps": {
      "get": {
        "operationId": "v2-list-run-steps",
        "summary": "List the executed steps of one run as a flat index (no payloads)",
        "description": "List the executed steps of one run as a flat index (no payloads). Fetch a single step for its full request and response.",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/runs/{runId}/steps/{stepInstanceId}": {
      "get": {
        "operationId": "v2-get-run-step",
        "summary": "Get one executed step of a run, including its full request and response payloads",
        "description": "Get one executed step of a run, including its full request and response payloads.",
        "tags": [
          "runs"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "stepInstanceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/connections": {
      "get": {
        "operationId": "v2-list-connections",
        "summary": "List connections (credentials) for the company",
        "description": "List connections (credentials) for the company. Secrets are never included. Filter by appId, status, valid, or expiresOn for expiry monitoring.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "connections"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, appId, status, isCompany, endUserId, installationId, userId, testedOn, expiresOn, authenticatedOn, createdOn, createdBy, updatedOn. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "appId": {},
                          "status": {},
                          "isCompany": {},
                          "endUserId": {},
                          "installationId": {},
                          "userId": {},
                          "testedOn": {},
                          "expiresOn": {},
                          "authenticatedOn": {},
                          "createdOn": {},
                          "createdBy": {},
                          "updatedOn": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/connections/{connectionId}": {
      "get": {
        "operationId": "v2-get-connection",
        "summary": "Get one connection (credential)",
        "description": "Get one connection (credential). Secrets are never included.",
        "tags": [
          "connections"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "v2-delete-connection",
        "summary": "Delete a connection, revoking it on the provider side first when the app declares a revoke action",
        "description": "Delete a connection, revoking it on the provider side first when the app declares a revoke action. Active workflows using the connection block the delete with 409 CONNECTION_IN_USE, and the error body names them so the caller can act. Inactive workflows do not block, matching the product.",
        "tags": [
          "connections"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/DeletedResource"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid (INVALID_QUERY, CREDENTIAL_DELETE_INVALID_REQUEST), or the delete was refused (CONNECTION_DELETE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No connection with this id belongs to the company (NOT_FOUND), or its app definition is gone (CREDENTIAL_DELETE_APP_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Active workflows still use the connection (CONNECTION_IN_USE). The error body names them.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionInUseErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "The credential or secret delete failed (CREDENTIAL_DELETE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The provider-side revoke declared by the app failed, so nothing was deleted (CREDENTIAL_DELETE_ACTION_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/connections/{connectionId}/test": {
      "post": {
        "operationId": "v2-test-connection",
        "summary": "Test a connection against its provider and report the verdict",
        "description": "Test a connection against its provider and report the verdict. Takes no body: the app and its version come from the connection itself. An app that declares no connection test answers 200 with supported false and status unsupported, which is a verdict rather than an error. The test has side effects, the same ones the product has: it updates the stored connection status and can rename the connection from the test result.",
        "tags": [
          "connections"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/ConnectionTestResult"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid (INVALID_QUERY).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No connection with this id belongs to the company (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The connection's app definition could not be loaded, so no test could run (CONNECTION_APP_UNAVAILABLE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/members": {
      "get": {
        "operationId": "v2-list-members",
        "summary": "List members of the company",
        "description": "List members of the company.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "members"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: userId, name, email, isPending, roleId, roleName, createdOn. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "userId": {},
                          "name": {},
                          "email": {},
                          "isPending": {},
                          "roleId": {},
                          "roleName": {},
                          "createdOn": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "v2-invite-member",
        "summary": "Invite one or more people to the company by email",
        "description": "Invite one or more people to the company by email. Omit roleId to place the invitee on the built-in Member role, matching the product invite flow. Emails already in the company keep their existing membership and have their role set to the one given here.",
        "tags": [
          "members"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invites": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string",
                          "format": "email",
                          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        },
                        "roleId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "email"
                      ]
                    }
                  }
                },
                "required": [
                  "invites"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Member"
                      },
                      "description": "One member per invite, in the order they were sent."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is invalid (INVALID_QUERY), the company id or emails did not reach the invite service (MEMBER_COMPANY_ID_REQUIRED, MEMBER_EMAILS_REQUIRED), or the invites were refused (MEMBER_INVITE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The key has no resolvable acting user (MEMBER_ACTOR_NOT_RESOLVED), the actor cannot assign the Owner role (MEMBER_ROLE_OWNER_ASSIGNMENT_FORBIDDEN), or the company is a personal workspace and takes no invites (MEMBER_PERSONAL_COMPANY_INVITES_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/members/{userId}": {
      "put": {
        "operationId": "v2-update-member",
        "summary": "Set a company member's role",
        "description": "Set a company member's role. The key acts as the user who created it: it cannot change that user's own role, and it can only touch an Owner when its creator is an Owner. The last Owner cannot be demoted.",
        "tags": [
          "members"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "roleId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "roleId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Member"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid (INVALID_QUERY, MEMBER_ROLE_UPDATE_INVALID_REQUEST), the role cannot be assigned (MEMBER_ROLE_ASSIGNMENT_INVALID), or the target is the last Owner (MEMBER_ROLE_LAST_OWNER_DEMOTION_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The key has no resolvable acting user (MEMBER_ACTOR_NOT_RESOLVED), the target is the acting user (MEMBER_ROLE_SELF_UPDATE_FORBIDDEN), or the target is an Owner and the acting user is not (MEMBER_ROLE_OWNER_MODIFICATION_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No member with this user id is in the company (MEMBER_ROLE_UPDATE_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "The role update transaction failed (MEMBER_ROLE_UPDATE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "v2-delete-member",
        "summary": "Remove someone from the company",
        "description": "Remove someone from the company. One route covers both cases: an active member loses access, and a person who was invited but never signed up has the pending invite cancelled. The key acts as the user who created it: it cannot remove that user, and only an Owner creator can remove an Owner. The last Owner cannot be removed.",
        "tags": [
          "members"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Member"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid (INVALID_QUERY, MEMBER_DELETE_INVALID_REQUEST), the target is the last Owner (MEMBER_DELETE_LAST_OWNER_FORBIDDEN), or the removal was refused (MEMBER_DELETE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The key has no resolvable acting user (MEMBER_ACTOR_NOT_RESOLVED), the target is the acting user (MEMBER_DELETE_SELF_FORBIDDEN), or the target is an Owner and the acting user is not (MEMBER_DELETE_OWNER_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No member with this user id is in the company (MEMBER_DELETE_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/roles": {
      "get": {
        "operationId": "v2-list-roles",
        "summary": "List roles available to the company, including global platform roles (isGlobal)",
        "description": "List roles available to the company, including global platform roles (isGlobal). Fetch a single role for its permissions.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "roles"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, name, description, isAdmin, isGlobal, createdOn. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "name": {},
                          "description": {},
                          "isAdmin": {},
                          "isGlobal": {},
                          "createdOn": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "v2-create-role",
        "summary": "Create a role in the company",
        "description": "Create a role in the company. Names are unique per company, case insensitively. Permissions are given as keys such as \"workflow:run\".",
        "tags": [
          "roles"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "permissions": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    }
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Role"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is invalid (INVALID_QUERY, ROLE_CREATE_INVALID_REQUEST, ROLE_PERMISSIONS_INVALID_REQUEST), names permission keys that do not exist (ROLE_PERMISSIONS_UNKNOWN_KEYS), or the write was refused (ROLE_CREATE_FAILED, ROLE_PERMISSIONS_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The key has no resolvable acting user (MEMBER_ACTOR_NOT_RESOLVED), or the acting user cannot grant admin permissions (ROLE_PERMISSIONS_ADMIN_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The role was created but could not be found when its permissions were applied (ROLE_PERMISSIONS_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "A role with this name already exists in the company (ROLE_CREATE_DUPLICATE_NAME).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "A role or permission write failed (ROLE_CREATE_QUERY_FAILED, ROLE_PERMISSIONS_QUERY_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The role was written but could not be read back (ROLE_RELOAD_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/roles/{roleId}": {
      "get": {
        "operationId": "v2-get-role",
        "summary": "Get one role with its permissions",
        "description": "Get one role with its permissions.",
        "tags": [
          "roles"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "v2-update-role",
        "summary": "Update a role the company owns",
        "description": "Update a role the company owns. Global platform roles answer 404 and cannot be changed here. A \"permissions\" array replaces the role's whole permission set; leave it out to keep the current set.",
        "tags": [
          "roles"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "permissions": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Role"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is invalid (INVALID_QUERY, ROLE_UPDATE_INVALID_REQUEST, ROLE_PERMISSIONS_INVALID_REQUEST), carries none of name, description or permissions (NO_FIELDS_TO_UPDATE, ROLE_UPDATE_NO_FIELDS), names permission keys that do not exist (ROLE_PERMISSIONS_UNKNOWN_KEYS), or the write was refused (ROLE_UPDATE_FAILED, ROLE_PERMISSIONS_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The key has no resolvable acting user (MEMBER_ACTOR_NOT_RESOLVED), or the acting user cannot grant admin permissions (ROLE_PERMISSIONS_ADMIN_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No role with this id belongs to the company; global roles answer here too (ROLE_UPDATE_NOT_FOUND, ROLE_PERMISSIONS_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Another role in the company already has this name (ROLE_UPDATE_DUPLICATE_NAME).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "A role or permission write failed (ROLE_UPDATE_QUERY_FAILED, ROLE_PERMISSIONS_QUERY_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The role was written but could not be read back (ROLE_RELOAD_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "v2-delete-role",
        "summary": "Delete a role the company owns",
        "description": "Delete a role the company owns. A role that still has members answers 400; move those members to another role first. Global platform roles answer 404 because they are not the company's to delete.",
        "tags": [
          "roles"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/DeletedResource"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid (INVALID_QUERY, ROLE_DELETE_INVALID_REQUEST), the role still has members (ROLE_DELETE_ASSIGNED_USERS_FORBIDDEN), or the delete was refused (ROLE_DELETE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The key has no resolvable acting user (MEMBER_ACTOR_NOT_RESOLVED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No role with this id belongs to the company; global roles answer here too (ROLE_DELETE_NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "The delete query failed (ROLE_DELETE_QUERY_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/companies": {
      "get": {
        "operationId": "v2-list-companies",
        "summary": "List companies with subscription info (plan, Stripe product id, legacy flag, member count)",
        "description": "List companies with subscription info (plan, Stripe product id, legacy flag, member count).\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "companies"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, name, description, isPersonal, timezone, settings, isDeleted, createdOn, updatedOn, plan, stripeSubscriptionProductId, subscriptionIsLegacy, subscriptionUpdatedOn, memberCount. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "name": {},
                          "description": {},
                          "isPersonal": {},
                          "timezone": {},
                          "settings": {},
                          "isDeleted": {},
                          "createdOn": {},
                          "updatedOn": {},
                          "plan": {},
                          "stripeSubscriptionProductId": {},
                          "subscriptionIsLegacy": {},
                          "subscriptionUpdatedOn": {},
                          "memberCount": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/companies/{companyId}": {
      "patch": {
        "operationId": "v2-update-company",
        "summary": "Update your company name, description, or timezone",
        "description": "Update your company name, description, or timezone. The path company id must be the company the API key belongs to.",
        "tags": [
          "companies"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "timezone": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/CompanyProfile"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is invalid (INVALID_QUERY), carries none of name, description or timezone (NO_FIELDS_TO_UPDATE), or names an unsupported timezone key (INVALID_TIMEZONE).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The path company id is not the company the key belongs to (COMPANY_SCOPE_MISMATCH).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The company was not found, or is deleted (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Another company already has this name (DUPLICATE_COMPANY_NAME).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/environments": {
      "get": {
        "operationId": "v2-list-environments",
        "summary": "List company environments with the number of scheduled workflows targeting each",
        "description": "List company environments with the number of scheduled workflows targeting each. Use environment ids to filter runs.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "environments"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, name, isDefault, workflowCount, createdOn. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "name": {},
                          "isDefault": {},
                          "workflowCount": {},
                          "createdOn": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/api-keys": {
      "get": {
        "operationId": "v2-list-api-keys",
        "summary": "List API keys for the company: name, last use, and revocation state",
        "description": "List API keys for the company: name, last use, and revocation state. Key material is never included.\n\nEach listed field can also be used directly as a filter query parameter, with optional bracket operators (eq, ne, gt, gte, lt, lte, contains, starts, ends, in, nin), e.g. `status=active` or `createdOn[gte]=2026-01-01`.",
        "tags": [
          "api-keys"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, name, accessLevel, usedOn, revokedOn, createdOn, createdBy, updatedOn. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "name": {},
                          "accessLevel": {},
                          "usedOn": {},
                          "revokedOn": {},
                          "createdOn": {},
                          "createdBy": {},
                          "updatedOn": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "v2-create-api-key",
        "summary": "Create an API key for the company",
        "description": "Create an API key for the company. The key material is returned once, in this response, and can never be retrieved again.",
        "tags": [
          "api-keys"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "accessLevel": {
                    "default": "full_access",
                    "type": "string",
                    "enum": [
                      "read_only",
                      "run_workflows",
                      "full_access"
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/ApiKey"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is invalid (INVALID_QUERY).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "The insert returned no row (API_KEY_CREATE_FAILED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/api-keys/{apiKeyId}": {
      "delete": {
        "operationId": "v2-revoke-api-key",
        "summary": "Revoke an API key",
        "description": "Revoke an API key. The key stops working immediately. Revoking an already revoked key changes nothing and succeeds.",
        "tags": [
          "api-keys"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "apiKeyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/me": {
      "get": {
        "operationId": "v2-get-me",
        "summary": "Describe the calling API key and its effective company scope",
        "description": "Describe the calling API key and its effective company scope. Useful to verify credentials.",
        "tags": [
          "me"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/usage": {
      "get": {
        "operationId": "v2-get-usage",
        "summary": "Get the company task usage summary for the current accounting period (trailing 30 days): used tasks, task limit, and soft-limit flag",
        "description": "Get the company task usage summary for the current accounting period (trailing 30 days): used tasks, task limit, and soft-limit flag.",
        "tags": [
          "usage"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/usage/daily": {
      "get": {
        "operationId": "v2-get-usage-daily",
        "summary": "Get the daily task usage series",
        "description": "Get the daily task usage series. Defaults to the trailing 30 days; pass from/to (YYYY-MM-DD) to re-window. The window is capped at 45 days.",
        "tags": [
          "usage"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/usage/workflows": {
      "get": {
        "operationId": "v2-get-usage-workflows",
        "summary": "Get task usage broken down by workflow, highest first",
        "description": "Get task usage broken down by workflow, highest first. Defaults to the trailing 30 days; pass from/to (YYYY-MM-DD) to re-window. The window is capped at 45 days.",
        "tags": [
          "usage"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "Endpoint-specific payload. See the endpoint description."
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/universal/apps": {
      "get": {
        "operationId": "v2-list-universal-apps",
        "summary": "List published Universal API apps that have executable actions",
        "description": "List published Universal API apps that have executable actions.",
        "tags": [
          "universal"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Optional app search text matched against name, slug, category, type, and aliases.",
              "type": "string"
            }
          },
          {
            "name": "actionQ",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Optional action intent search text. When there is one clear deterministic match, returns suggestedAction without using AI.",
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Comma-separated fields to select from each app.",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Maximum number of apps to return (1-100, default 20).",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Number of apps to skip before returning results.",
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "icon": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "type": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "aliases": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "publishedVersion": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "actionsTotal": {
                            "type": "integer"
                          },
                          "actionSlugsPreview": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/universal/apps/{appSlug}/actions": {
      "get": {
        "operationId": "v2-list-universal-actions",
        "summary": "List published Universal API actions with the appSlug, appVersion, and actionSlug needed to run them",
        "description": "List published Universal API actions with the appSlug, appVersion, and actionSlug needed to run them.",
        "tags": [
          "universal"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "appSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The app slug, for example \"slack\"."
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "default": "latest",
              "description": "App version to search. Defaults to latest.",
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Optional action search text matched against app, action, description, operation, and model.",
              "type": "string"
            }
          },
          {
            "name": "verbosity",
            "in": "query",
            "required": false,
            "schema": {
              "default": "compact",
              "description": "How much action metadata to return. compact is optimized for agent search; full includes descriptions, model, and response schema when available.",
              "type": "string",
              "enum": [
                "compact",
                "full"
              ]
            }
          },
          {
            "name": "includeArguments",
            "in": "query",
            "required": false,
            "schema": {
              "default": "required",
              "description": "How many action argument hints to include. required is the default to support simple one-call execution.",
              "type": "string",
              "enum": [
                "none",
                "required",
                "all"
              ]
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Comma-separated fields to select from each action. appSlug, appVersion, and actionSlug are always included.",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Maximum number of actions to return (1-100, default 20).",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Number of actions to skip before returning results.",
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Action discovery metadata. The exact fields depend on the published action definition and the verbosity, includeArguments, and fields controls."
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Universal app not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/universal/apps/{appSlug}/actions/{actionSlug}": {
      "get": {
        "operationId": "v2-get-universal-action",
        "summary": "Get detailed argument and response schema metadata for one Universal API action",
        "description": "Get detailed argument and response schema metadata for one Universal API action.",
        "tags": [
          "universal"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "appSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The app slug, for example \"slack\"."
            }
          },
          {
            "name": "actionSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The docs-style action slug, for example \"send-message\"."
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "default": "latest",
              "description": "The app version to inspect. Defaults to latest.",
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Comma-separated fields to select from the action schema response.",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Universal action not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Universal action slug conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/universal/apps/{appSlug}/actions/{actionSlug}/lookups/{argumentKey}": {
      "get": {
        "operationId": "v2-resolve-universal-lookup",
        "summary": "Resolve a Universal API lookup/list argument to the canonical API value without using AI",
        "description": "Resolve a Universal API lookup/list argument to the canonical API value without using AI.",
        "tags": [
          "universal"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "appSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The app slug, for example \"slack\"."
            }
          },
          {
            "name": "actionSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The docs-style action slug, for example \"send-message\"."
            }
          },
          {
            "name": "argumentKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The lookup-backed argument key to resolve."
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "default": "latest",
              "description": "The app version to inspect. Defaults to latest.",
              "type": "string"
            }
          },
          {
            "name": "connectionId",
            "in": "query",
            "required": false,
            "schema": {
              "description": "The public MindCloud connection ID to use when the lookup source requires authentication.",
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Search text to resolve, for example a channel, user, customer, or project name.",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "description": "Maximum lookup rows to request from the source action.",
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Lookup row offset when supported by the source action.",
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "resolved",
                            "ambiguous",
                            "not_found"
                          ]
                        },
                        "reasonCode": {
                          "type": "string"
                        },
                        "selected": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "label": {
                              "type": "string"
                            }
                          }
                        },
                        "candidates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "fixed_options",
                            "lookup_action"
                          ]
                        },
                        "lookup": {
                          "type": "object",
                          "properties": {
                            "labelKey": {
                              "type": "string"
                            },
                            "valueKey": {
                              "type": "string"
                            },
                            "actionId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        },
                        "paging": {
                          "type": "object",
                          "properties": {
                            "limit": {
                              "type": "integer"
                            },
                            "offset": {
                              "type": "integer"
                            },
                            "fetchedCandidatesCount": {
                              "type": "integer"
                            }
                          }
                        },
                        "hints": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string"
                              },
                              "message": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or connection selection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Action, lookup, or connection not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Universal lookup action failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/universal/apps/{appSlug}/actions/{actionSlug}/run": {
      "post": {
        "operationId": "v2-run-universal-action",
        "summary": "Run one Universal API action using a connection owned by the authenticated company",
        "description": "Run one Universal API action using a connection owned by the authenticated company.",
        "tags": [
          "universal"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "appSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "actionSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "default": "latest",
                    "type": "string"
                  },
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "arguments": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "options": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "fields": {
                    "type": "string"
                  },
                  "limit": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "offset": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "sort": {
                    "type": "string"
                  },
                  "where": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "description": "The provider response for the executed action, shaped by the published action definition and any fields/limit/offset/sort/where response controls."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or connection selection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Universal action or connection not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Universal action slug conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Universal action failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/openapi.json": {
      "get": {
        "operationId": "v2-get-openapi-document",
        "summary": "Get this OpenAPI document",
        "description": "The OpenAPI 3.1 document describing the v2 surface, generated from the endpoint registry. No authentication required.",
        "tags": [
          "meta"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "MindCloud API key, sent as a bearer token."
      }
    },
    "parameters": {
      "fields": {
        "name": "fields",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Comma-separated list of fields to return (e.g. \"id,name,status\")."
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "default": 100
        },
        "description": "Maximum number of results to return (1-1000, default 100)."
      },
      "offset": {
        "name": "offset",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "description": "Number of results to skip for pagination (default 0)."
      },
      "sort": {
        "name": "sort",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Comma-separated sort fields. Prefix with - for descending (e.g. \"-createdOn,name\")."
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "ListMeta": {
        "type": "object",
        "properties": {
          "pagination": {
            "type": "object",
            "properties": {
              "totalCount": {
                "type": "integer"
              },
              "hasNextPage": {
                "type": "boolean"
              },
              "hasPreviousPage": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "accessLevel": {
            "type": "string",
            "enum": [
              "read_only",
              "run_workflows",
              "full_access"
            ]
          },
          "key": {
            "type": "string",
            "description": "The plaintext API key. Shown only in this response and cannot be retrieved again."
          },
          "createdOn": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "accessLevel",
          "key",
          "createdOn"
        ]
      },
      "ConnectionInUseErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "const": "CONNECTION_IN_USE"
              },
              "message": {
                "type": "string"
              },
              "workflows": {
                "type": "array",
                "description": "The active workflows using the connection. Move them off it before deleting.",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "usageCount": {
                      "type": "integer",
                      "description": "How many steps in that workflow use the connection."
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "usageCount"
                  ]
                }
              }
            },
            "required": [
              "code",
              "message",
              "workflows"
            ]
          }
        }
      },
      "ConnectionTestResult": {
        "type": "object",
        "properties": {
          "supported": {
            "type": "boolean",
            "description": "False when the app declares no usable connection test, in which case no call is made to the provider."
          },
          "status": {
            "type": "string",
            "description": "The verdict: \"unsupported\" when supported is false, otherwise the stored connection status such as \"valid\"."
          },
          "testedOn": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the test failed, or why the app cannot be tested. Null on a clean pass."
          }
        },
        "required": [
          "supported",
          "status",
          "testedOn",
          "message"
        ]
      },
      "CompanyProfile": {
        "type": "object",
        "description": "The company profile columns a write can return. plan, memberCount and the subscription columns live on another table and only List Companies carries them.",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "isPersonal": {
            "type": "boolean",
            "description": "True for personal workspaces rather than team companies."
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Timezone key, an abbreviation such as EDT or PST rather than an IANA zone name."
          },
          "settings": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Company settings. Read-only on this surface."
          },
          "isDeleted": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "createdOn": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updatedOn": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "isPersonal",
          "timezone",
          "settings",
          "isDeleted",
          "createdOn",
          "updatedOn"
        ]
      },
      "DeletedResource": {
        "type": "object",
        "description": "The id of the resource that was deleted.",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "Member": {
        "type": "object",
        "properties": {
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "isPending": {
            "type": "boolean",
            "description": "True while the invite is waiting to be accepted."
          },
          "roleId": {
            "type": [
              "string",
              "null"
            ]
          },
          "roleName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdOn": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "userId",
          "name",
          "email",
          "isPending",
          "roleId",
          "roleName",
          "createdOn"
        ]
      },
      "Role": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "isAdmin": {
            "type": "boolean",
            "description": "True if the role grants admin rights."
          },
          "isGlobal": {
            "type": "boolean",
            "description": "True for roles MindCloud provides to every company. Global roles cannot be written."
          },
          "createdOn": {
            "type": "string",
            "format": "date-time"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "isAdmin",
          "isGlobal",
          "createdOn",
          "permissions"
        ]
      },
      "Workflow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "isTemplate": {
            "type": "boolean"
          },
          "size": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tag ids assigned to the workflow."
          },
          "createdOn": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedOn": {
            "type": "string",
            "format": "date-time"
          },
          "updatedBy": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "isActive",
          "isTemplate",
          "size",
          "tags",
          "createdOn",
          "createdBy",
          "updatedOn",
          "updatedBy"
        ]
      }
    }
  }
}