{
  "openapi": "3.1.0",
  "info": {
    "title": "Jetstack AI — Workflow Audit API",
    "version": "1.0.0",
    "description": "Start a configuration audit of a connected HubSpot portal's workflows, poll it, and read the results: the workflow inventory, findings, direct dependencies, enrollment paths, referenced assets, health scores and indexed evidence. You can also record notes, finding dispositions and workflow decisions.\n\nThe audit reads HubSpot only. No endpoint enables, disables, edits or deletes a workflow, and findings describe configuration, not execution history (`runtimeExecutionAssessed: false`).\n\n## Authentication\n\nSend an API key as a bearer token. Create keys in the app under **Settings → Access Tokens**.\n\n```\nAuthorization: Bearer jsai_your_api_key\n```\n\nReading needs `audit:read`. Starting an audit and saving a review need `audit:write`. Results belong to the key's organization.\n\nIf your organization runs on a dedicated Jetstack instance, also send `X-Instance-Id` with the value shown under **Settings → Access Tokens → Connection Details**. Everyone else can leave it out.\n\n## Rate limits\n\nEach API key can make 5 requests per second and 100 per minute. Responses carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`; a `429` adds `Retry-After`. Poll a running audit every few seconds, not in a tight loop.\n\n## Responses and errors\n\nSuccessful responses wrap the payload in `{ \"data\": ... }`. Errors are RFC 7807 problem documents (`application/problem+json`) with a stable `code` and a `requestId`. Match on `code`, never on `detail`.\n\nUse paths exactly as documented: a trailing slash or an unknown sub-path returns `404 REST_API_NOT_FOUND`.\n",
    "contact": {
      "name": "Jetstack AI",
      "url": "https://jetstack.ai/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.jetstack.ai",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Workflow audits",
      "description": "Start, list and poll workflow audit runs."
    },
    {
      "name": "Results",
      "description": "The summary, findings and the full result of a completed audit."
    },
    {
      "name": "Investigation",
      "description": "Paginated reads of the workflow inventory, dependencies, enrollment paths and referenced assets."
    },
    {
      "name": "Reviews",
      "description": "Notes, finding dispositions and workflow decisions. Reviews never change evidence, scores or the portal."
    },
    {
      "name": "Evidence",
      "description": "Bounded, indexed pages of stored audit evidence."
    }
  ],
  "paths": {
    "/v1/workflow-audits": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        }
      ],
      "post": {
        "operationId": "createWorkflowAudit",
        "summary": "Start a workflow audit",
        "description": "Starts a configuration audit of the workflows in a connected HubSpot portal and returns immediately with HTTP `202` and a run in `PROCESSING`. Poll `GET /v1/workflow-audits/{runId}` until the status is `COMPLETED` or `FAILED`.\n\n`portalId` accepts the HubSpot portal ID or the Jetstack portal ID returned by `GET /v1/portals`. The server resolves the portal's name and checks that it belongs to your organization; organization or portal ownership in the body is ignored. The portal's HubSpot connection must grant the `automation` scope.\n\nOmit `scope` to audit every supported object type. The audit only reads HubSpot: no route in this API enables, disables, edits or deletes a workflow. Creating an audit may use AI to generate naming checks and insights.\n\n**Idempotency.** Send an `Idempotency-Key` to make retries safe. The key is reserved atomically for 24 hours and bound to the request body. The first response, success or error, is saved and replayed with `Idempotent-Replayed: true` without starting another scan. Reusing a key with a different body, or while the first request is still running or its outcome is unknown, returns `409`. Replays still require `audit:write`.\n\n**Scope:** `audit:write`.",
        "tags": [
          "Workflow audits"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:write"
            ]
          }
        ],
        "x-required-scope": "audit:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkflowAuditInput"
              },
              "examples": {
                "contactsAndCompanies": {
                  "summary": "Contacts and companies only",
                  "value": {
                    "name": "Inherited portal review",
                    "portalId": "244840437",
                    "scope": {
                      "objectTypes": [
                        "0-1",
                        "0-2"
                      ]
                    }
                  }
                },
                "everything": {
                  "summary": "Every supported object type",
                  "value": {
                    "name": "Quarterly workflow review",
                    "portalId": "244840437"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Audit accepted and queued. The run starts in `PROCESSING`.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WorkflowAuditRun"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "Xk3p9QwZr2mB7nT1aLc4",
                    "name": "Inherited portal review",
                    "portalId": "244840437",
                    "portalName": "Acme Corp",
                    "status": "PROCESSING",
                    "progress": {
                      "stage": "fetching",
                      "percent": 0
                    },
                    "createdAt": "2026-10-14T09:12:44.118Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or the portal's HubSpot connection is missing a scope the audit needs.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "nameRequired": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "name is required",
                      "instance": "/v1/workflow-audits",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "portalIdRequired": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "portalId is required",
                      "instance": "/v1/workflow-audits",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "invalidScope": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "scope.objectTypes must contain up to 50 object type IDs",
                      "instance": "/v1/workflow-audits",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "missingHubSpotScope": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-hubspot-fetch-failed",
                      "title": "Workflow Audit Fetch Failed",
                      "status": 400,
                      "detail": "Workflow audit requires the following HubSpot scope: automation. Reconnect the portal after granting that scope.",
                      "instance": "/v1/workflow-audits",
                      "code": "WORKFLOW_AUDIT_HUBSPOT_FETCH_FAILED",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:write`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:write",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The portal is not connected to your organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/portal-not-found",
                  "title": "Portal Not Found",
                  "status": 404,
                  "detail": "Portal not found: 244840437.",
                  "instance": "/v1/workflow-audits",
                  "code": "PORTAL_NOT_FOUND",
                  "requestId": "req_7f3a9c2e",
                  "hint": "\"244840437\" looks like a HubSpot portal ID but no matching portal was found. Use GET /v1/portals to list your connected portals."
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used with a different body, or the original request is still running or has an unknown outcome.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "bodyMismatch": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 409,
                      "detail": "This Idempotency-Key was used with a different request body.",
                      "instance": "/v1/workflow-audits",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "pending": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 409,
                      "detail": "This request is still running or its outcome is uncertain. Check audit history before starting another run; retry this key to retrieve a saved response.",
                      "instance": "/v1/workflow-audits",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "operationId": "listWorkflowAudits",
        "summary": "List workflow audits",
        "description": "Lists your organization's workflow audit runs, newest first. Page with `startAfter`: pass the `lastId` of the previous page while `hasMore` is `true`.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Workflow audits"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "name": "portalId",
            "in": "query",
            "required": false,
            "description": "Only runs for this HubSpot portal ID. Runs store the HubSpot portal ID, so filter by that rather than the Jetstack portal ID.",
            "schema": {
              "type": "string",
              "maxLength": 2000
            },
            "example": "244840437"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only runs in this status.",
            "schema": {
              "$ref": "#/components/schemas/WorkflowAuditStatus"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "startAfter",
            "in": "query",
            "required": false,
            "description": "The `lastId` from the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of runs.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WorkflowAuditRunList"
                    }
                  }
                },
                "example": {
                  "data": {
                    "items": [
                      {
                        "id": "Xk3p9QwZr2mB7nT1aLc4",
                        "name": "Inherited portal review",
                        "portalId": "244840437",
                        "portalName": "Acme Corp",
                        "status": "COMPLETED",
                        "progress": {
                          "stage": "generating_insights",
                          "percent": 100,
                          "workflowsFetched": 142,
                          "workflowsParsed": 142
                        },
                        "summary": {
                          "workflowCount": 142,
                          "healthScore": 71,
                          "conflictCount": 23,
                          "healthBreakdown": {
                            "healthy": 88,
                            "warning": 41,
                            "critical": 13
                          },
                          "previousAuditId": "Qm8vT2nY6pLr0sKd3HcW",
                          "previousHealthScore": 66,
                          "scoreDelta": 5
                        },
                        "createdAt": "2026-10-14T09:12:44.118Z",
                        "completedAt": "2026-10-14T09:19:02.540Z"
                      }
                    ],
                    "total": 6,
                    "hasMore": true,
                    "lastId": "Xk3p9QwZr2mB7nT1aLc4"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid `status`, `limit` or other query parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "invalidStatus": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "Invalid audit status.",
                      "instance": "/v1/workflow-audits",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "invalidLimit": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "limit must be at least 1.",
                      "instance": "/v1/workflow-audits",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "getWorkflowAudit",
        "summary": "Get a workflow audit",
        "description": "Status, progress and headline numbers for one run. Works in every status, so use it to poll a new audit. `summary` appears once the run has completed.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Workflow audits"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "responses": {
          "200": {
            "description": "The run.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WorkflowAuditRun"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "Xk3p9QwZr2mB7nT1aLc4",
                    "name": "Inherited portal review",
                    "portalId": "244840437",
                    "portalName": "Acme Corp",
                    "status": "COMPLETED",
                    "progress": {
                      "stage": "generating_insights",
                      "percent": 100,
                      "workflowsFetched": 142,
                      "workflowsParsed": 142
                    },
                    "summary": {
                      "workflowCount": 142,
                      "healthScore": 71,
                      "conflictCount": 23,
                      "healthBreakdown": {
                        "healthy": 88,
                        "warning": 41,
                        "critical": 13
                      },
                      "previousAuditId": "Qm8vT2nY6pLr0sKd3HcW",
                      "previousHealthScore": 66,
                      "scoreDelta": 5
                    },
                    "createdAt": "2026-10-14T09:12:44.118Z",
                    "completedAt": "2026-10-14T09:19:02.540Z"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`, or the run belongs to another organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "insufficientScope": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                      "title": "Insufficient Permissions",
                      "status": 403,
                      "detail": "Missing required scope: audit:read",
                      "instance": "/v1/workflow-audits",
                      "code": "API_KEY_INSUFFICIENT_SCOPE",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "otherOrganization": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-access-denied",
                      "title": "Workflow Audit Access Denied",
                      "status": 403,
                      "detail": "You do not have access to this workflow audit run",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4",
                      "code": "WORKFLOW_AUDIT_RUN_ACCESS_DENIED",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No run with this ID, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit run not found: Xk3p9QwZr2mB7nT1aLc4",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/summary": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "getWorkflowAuditSummary",
        "summary": "Get the audit summary",
        "description": "Totals, the portfolio score as calculated when the audit ran, and coverage: how complete the captured inventory, analysis and AI steps were.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Results"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "responses": {
          "200": {
            "description": "The summary.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AuditSummaryView"
                    }
                  }
                },
                "example": {
                  "data": {
                    "auditRunId": "Xk3p9QwZr2mB7nT1aLc4",
                    "schemaVersion": 2,
                    "capturedAt": "2026-10-14T09:12:44.118Z",
                    "basis": "configuration",
                    "runtimeExecutionAssessed": false,
                    "workflowCount": 142,
                    "findingCount": 23,
                    "portfolioScore": {
                      "scoringVersion": 3,
                      "total": 71,
                      "avgWorkflowScore": 74,
                      "conflictScore": 62,
                      "governanceScore": 68,
                      "capacityScore": 90,
                      "capacityUsed": 0.47,
                      "assessedWorkflows": 140,
                      "unassessedWorkflows": 2,
                      "capacityAvailable": true,
                      "planLimit": 300
                    },
                    "inventoryCoverage": {
                      "legacyAvailable": true,
                      "detailFailures": 0,
                      "knownWorkflows": 142,
                      "warnings": []
                    },
                    "analysisCoverage": {
                      "duplicates": "complete",
                      "assets": "complete",
                      "deadBranches": "limited",
                      "notes": []
                    },
                    "aiCoverage": {
                      "naming": "complete",
                      "insights": "complete"
                    },
                    "referenceCoverageComplete": true
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/workflows": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "listAuditedWorkflows",
        "summary": "List audited workflows",
        "description": "The captured workflow inventory, paginated and searchable. Rows omit the full definition (`snapshot`) and per-reference evidence (`references`) to stay compact; read `GET .../workflows/{workflowId}` for both.\n\nDisabled workflows are included. Follow `nextOffset` until it is `null`. A page is capped at 512 KiB, so it may hold fewer rows than `limit`.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Investigation"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of workflow summaries.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WorkflowPage"
                    }
                  }
                },
                "example": {
                  "data": {
                    "auditRunId": "Xk3p9QwZr2mB7nT1aLc4",
                    "schemaVersion": 2,
                    "capturedAt": "2026-10-14T09:12:44.118Z",
                    "basis": "configuration",
                    "runtimeExecutionAssessed": false,
                    "rows": [
                      {
                        "id": "4924872395",
                        "name": "Lead nurture | MQL handoff",
                        "objectTypeId": "0-1",
                        "objectType": "contact",
                        "isEnabled": true,
                        "createdAt": "2023-02-01T15:20:11.000Z",
                        "updatedAt": "2026-08-19T10:02:40.000Z",
                        "actionCount": 14,
                        "branchCount": 3,
                        "hasGoal": false,
                        "hasDescription": false,
                        "hasSuppression": true,
                        "enrollmentType": "LIST_BASED",
                        "complexity": 38,
                        "analysisVersion": 2,
                        "dependencies": {
                          "lists": [
                            "812"
                          ],
                          "forms": [],
                          "emails": [
                            "176551203"
                          ],
                          "workflows": [
                            "4924872401"
                          ],
                          "properties": [
                            {
                              "objectTypeId": "0-1",
                              "name": "lifecyclestage"
                            }
                          ],
                          "owners": [],
                          "pipelines": []
                        }
                      }
                    ],
                    "total": 142,
                    "offset": 0,
                    "nextOffset": 25
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is malformed: not a single string, not a non-negative integer, out of range, or `search` longer than 200 characters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 400,
                  "detail": "limit must be an integer no greater than 100.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "413": {
            "description": "A single item exceeds the 512 KiB page budget. Read the workflow detail or the full result instead; the item was not dropped.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 413,
                  "detail": "This evidence item exceeds the query page budget. Read the individual workflow or full result instead.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/workflows/{workflowId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        },
        {
          "$ref": "#/components/parameters/WorkflowId"
        }
      ],
      "get": {
        "operationId": "getAuditedWorkflow",
        "summary": "Get one audited workflow",
        "description": "The full captured workflow, including its definition snapshot and references, plus a plain-language brief and its health score.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Investigation"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "responses": {
          "200": {
            "description": "The workflow.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WorkflowDetailView"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "workflowNotInAudit": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 404,
                      "detail": "Workflow is not present in this audit",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows/123",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/workflows/{workflowId}/dependencies": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        },
        {
          "$ref": "#/components/parameters/WorkflowId"
        }
      ],
      "get": {
        "operationId": "listWorkflowDependencies",
        "summary": "List a workflow's direct dependencies",
        "description": "Direct relationships between this workflow and others, each with the configuration evidence behind it.\n\n- `explicit-enrollment`: an action enrolls records into another workflow. It does not prove execution or eligibility.\n- `potential-handoff`: one workflow writes a same-object property another reads. Record overlap, conditions and timing are not verified.\n- `shared-writer`: both write the same property. This is not a conflict by itself.\n- `shared-usage`: both use the same asset, with no directed dependency.\n\n`coverage` reports missing or unknown workflows and whether the analysis is complete.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Investigation"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "name": "relationship",
            "in": "query",
            "required": false,
            "description": "Only connections of this kind.",
            "schema": {
              "$ref": "#/components/schemas/DependencyRelationship"
            }
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of connections.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DependencyPage"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is malformed: not a single string, not a non-negative integer, out of range, or `search` longer than 200 characters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 400,
                  "detail": "limit must be an integer no greater than 100.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "workflowNotInAudit": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 404,
                      "detail": "Workflow is not present in this audit",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows/123/dependencies",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "413": {
            "description": "A single item exceeds the 512 KiB page budget. Read the workflow detail or the full result instead; the item was not dropped.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 413,
                  "detail": "This evidence item exceeds the query page budget. Read the individual workflow or full result instead.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/workflows/{workflowId}/paths": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        },
        {
          "$ref": "#/components/parameters/WorkflowId"
        }
      ],
      "get": {
        "operationId": "listWorkflowEnrollmentPaths",
        "summary": "List upstream and downstream enrollment paths",
        "description": "Chains of explicit enrollment links into (`upstream`) and out of (`downstream`) this workflow. Only `explicit-enrollment` links are followed. Each reachable workflow gets one shortest example path per direction, up to 20 steps; `coverage.pathsTruncated` says whether the limit was hit. A `cycle: true` path is one example that returns to this workflow, not every cycle in the portal.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Investigation"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "description": "Only paths in this direction.",
            "schema": {
              "type": "string",
              "enum": [
                "upstream",
                "downstream"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of paths.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PathPage"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is malformed: not a single string, not a non-negative integer, out of range, or `search` longer than 200 characters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 400,
                  "detail": "limit must be an integer no greater than 100.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "workflowNotInAudit": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 404,
                      "detail": "Workflow is not present in this audit",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows/123/paths",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "413": {
            "description": "A single item exceeds the 512 KiB page budget. Read the workflow detail or the full result instead; the item was not dropped.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 413,
                  "detail": "This evidence item exceeds the query page budget. Read the individual workflow or full result instead.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/assets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "listReferencedAssets",
        "summary": "List referenced assets",
        "description": "Every asset the audited workflows reference (properties, lists, forms, emails, workflows, owners, teams, pipelines), with a resolved `label` and the number of distinct workflows that use, read and write it. Use an asset's `key` with `GET .../asset?assetKey=` to see the references.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Investigation"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of assets.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssetPage"
                    }
                  }
                },
                "example": {
                  "data": {
                    "auditRunId": "Xk3p9QwZr2mB7nT1aLc4",
                    "schemaVersion": 2,
                    "capturedAt": "2026-10-14T09:12:44.118Z",
                    "basis": "configuration",
                    "runtimeExecutionAssessed": false,
                    "rows": [
                      {
                        "key": "[\"property\",\"0-1\",\"\",\"lifecyclestage\"]",
                        "kind": "property",
                        "id": "lifecyclestage",
                        "objectTypeId": "0-1",
                        "workflowCount": 31,
                        "label": "Lifecycle stage",
                        "readerCount": 24,
                        "writerCount": 12
                      }
                    ],
                    "total": 418,
                    "offset": 0,
                    "nextOffset": 25
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is malformed: not a single string, not a non-negative integer, out of range, or `search` longer than 200 characters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 400,
                  "detail": "limit must be an integer no greater than 100.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "413": {
            "description": "A single item exceeds the 512 KiB page budget. Read the workflow detail or the full result instead; the item was not dropped.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 413,
                  "detail": "This evidence item exceeds the query page budget. Read the individual workflow or full result instead.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/asset": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "getReferencedAsset",
        "summary": "Get one asset's workflow references",
        "description": "The workflow references for one asset, paginated, with the asset's metadata and resolved `label`. `assetKey` is the opaque `key` from `GET .../assets`; URL-encode it exactly. Keys include the object type and identity namespace, so same-named properties on different objects stay separate.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Investigation"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "name": "assetKey",
            "in": "query",
            "required": true,
            "description": "The asset's `key` from the assets list.",
            "schema": {
              "type": "string",
              "maxLength": 2000
            },
            "example": "[\"property\",\"0-1\",\"\",\"lifecyclestage\"]"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of references.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssetReferencePage"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`assetKey` is missing, or a query parameter is malformed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "assetKeyRequired": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "assetKey is required; select a key from the assets response.",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/asset",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "invalidQuery": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "limit must be an integer no greater than 100.",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "assetNotInAudit": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 404,
                      "detail": "Asset is not referenced in this audit",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/asset",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "413": {
            "description": "A single item exceeds the 512 KiB page budget. Read the workflow detail or the full result instead; the item was not dropped.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 413,
                  "detail": "This evidence item exceeds the query page budget. Read the individual workflow or full result instead.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/findings": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "listAuditFindings",
        "summary": "List configuration findings",
        "description": "Findings from the audit (conflicts, missing goals or descriptions, naming, re-enrollment risk, dead branches and more), each with severity, the workflows involved, evidence and a recommendation. Filter to one workflow with `workflowId`.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Results"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "name": "workflowId",
            "in": "query",
            "required": false,
            "description": "Only findings that involve this workflow.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of findings.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FindingPage"
                    }
                  }
                },
                "example": {
                  "data": {
                    "auditRunId": "Xk3p9QwZr2mB7nT1aLc4",
                    "schemaVersion": 2,
                    "capturedAt": "2026-10-14T09:12:44.118Z",
                    "basis": "configuration",
                    "runtimeExecutionAssessed": false,
                    "rows": [
                      {
                        "id": "c-0192",
                        "type": "PROP_COLLISION",
                        "severity": "warning",
                        "title": "Two workflows set Lifecycle stage to different values",
                        "description": "Lead nurture | MQL handoff sets Lifecycle stage to MQL; Inbound | Demo request sets it to SQL.",
                        "involvedWorkflows": [
                          {
                            "workflowId": "4924872395",
                            "workflowName": "Lead nurture | MQL handoff",
                            "role": "writer"
                          },
                          {
                            "workflowId": "4924872401",
                            "workflowName": "Inbound | Demo request",
                            "role": "writer"
                          }
                        ],
                        "affectedProperty": "lifecyclestage",
                        "affectedObjectType": "0-1",
                        "recommendation": "Decide which workflow owns lifecycle stage changes and remove the other write.",
                        "fingerprint": "f3b1c9e07a52d4e8",
                        "ruleVersion": 3,
                        "collisionAssessment": {
                          "status": "potential",
                          "valueComparison": "different-static-values",
                          "applicability": "unassessed"
                        }
                      }
                    ],
                    "total": 23,
                    "offset": 0,
                    "nextOffset": null
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is malformed: not a single string, not a non-negative integer, out of range, or `search` longer than 200 characters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 400,
                  "detail": "limit must be an integer no greater than 100.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "413": {
            "description": "A single item exceeds the 512 KiB page budget. Read the workflow detail or the full result instead; the item was not dropped.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 413,
                  "detail": "This evidence item exceeds the query page budget. Read the individual workflow or full result instead.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/reviews": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "listAuditReviews",
        "summary": "List review notes, finding dispositions and decisions",
        "description": "The current human review state for the portal: workflow notes, finding dispositions (open, resolved, ignored) and workflow decisions. Reviews belong to the portal and carry across audit runs; they are not part of the historical snapshot (`currentPortalState: true`). Rows are sorted by kind, then entity ID.\n\nA finding marked resolved on an earlier run is shown reopened (`reopened: true`, `effectiveStatus: open`) when it appears again. A decision carries `needsRevalidation: true` when the workflow definition in this run differs from the one that was reviewed, or cannot be compared.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Reviews"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "name": "workflowId",
            "in": "query",
            "required": false,
            "description": "Only reviews about this workflow, including dispositions of findings that involve it.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of review entries.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ReviewPage"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is malformed: not a single string, not a non-negative integer, out of range, or `search` longer than 200 characters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 400,
                  "detail": "limit must be an integer no greater than 100.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Audit results are not yet published",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "413": {
            "description": "A single item exceeds the 512 KiB page budget. Read the workflow detail or the full result instead; the item was not dropped.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 413,
                  "detail": "This evidence item exceeds the query page budget. Read the individual workflow or full result instead.",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/workflows",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "put": {
        "operationId": "saveAuditReview",
        "summary": "Save a note, finding disposition or decision",
        "description": "Saves one version-checked review entry. Reviews never change the audit's evidence, scores or the HubSpot portal, and a decision never approves deletion.\n\n- `note`: `entityId` is a workflow `id`. `text` is required for a new note.\n- `finding`: `entityId` is the finding's `fingerprint`. Set `status` to `open`, `resolved` or `ignored`.\n- `decision`: `entityId` is a workflow `id`. Requires `decision`, `decisionStatus`, `owner` (send an empty string for none) and a rationale in `text`.\n\nSend `expectedVersion: 0` for a new entry and the last returned `version` afterwards. If someone else saved in between, the request is refused with `409` and nothing is overwritten. Only completed audits can be annotated, and only workflows and findings analysed by the current audit engine are valid targets.\n\n**Scope:** `audit:write`.",
        "tags": [
          "Reviews"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:write"
            ]
          }
        ],
        "x-required-scope": "audit:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveReviewInput"
              },
              "examples": {
                "decision": {
                  "summary": "Record a decision on a workflow",
                  "value": {
                    "kind": "decision",
                    "entityId": "4924872395",
                    "decision": "investigate",
                    "owner": "Sales operations",
                    "decisionStatus": "proposed",
                    "text": "Check seasonal use and downstream dependencies with the owner.",
                    "expectedVersion": 0
                  }
                },
                "finding": {
                  "summary": "Resolve a finding",
                  "value": {
                    "kind": "finding",
                    "entityId": "f3b1c9e07a52d4e8",
                    "status": "resolved",
                    "text": "Removed the duplicate lifecycle write from the demo workflow.",
                    "expectedVersion": 0
                  }
                },
                "note": {
                  "summary": "Update an existing note",
                  "value": {
                    "kind": "note",
                    "entityId": "4924872395",
                    "text": "Owned by the SDR team. Do not retire before Q1.",
                    "expectedVersion": 2
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved entry, with its new `version`.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ReviewEntry"
                    }
                  }
                },
                "example": {
                  "data": {
                    "kind": "decision",
                    "entityId": "4924872395",
                    "text": "Check seasonal use and downstream dependencies with the owner.",
                    "status": "open",
                    "version": 1,
                    "updatedAt": "2026-10-14T10:02:13.480Z",
                    "updatedBy": "user_2abcDEF",
                    "reviewedRunId": "Xk3p9QwZr2mB7nT1aLc4",
                    "reviewedRunCreatedAt": "2026-10-14T09:12:44.118Z",
                    "decision": "investigate",
                    "owner": "Sales operations",
                    "decisionStatus": "proposed",
                    "reviewedFingerprint": "9d2c41f0b7e3a6c5"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body is invalid, or the target is not a workflow or finding in this audit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "invalidBody": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "A valid run, review target, text (maximum 8000 characters), status and expectedVersion are required.",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/reviews",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "invalidTarget": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 400,
                      "detail": "The review target is not a versioned workflow or finding in this audit.",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/reviews",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:write`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:write",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed, or `expectedVersion` is stale because the entry changed since you read it.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "notCompleted": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                      "title": "Invalid Workflow Audit Status",
                      "status": 409,
                      "detail": "Only completed audits can be annotated.",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/reviews",
                      "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "versionConflict": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-invalid-input",
                      "title": "Invalid Input",
                      "status": 409,
                      "detail": "Annotation changed; reload before saving.",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/reviews",
                      "code": "API_INVALID_INPUT",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/evidence": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "getAuditEvidencePage",
        "summary": "Read indexed evidence",
        "description": "Bounded pages of the stored evidence, one kind at a time: workflows, findings, graph nodes, graph edges, clusters, health scores or insights. Use it to export a large audit without the full result. Each item is limited to 64 KiB; a larger item is returned as a `requires-detail` marker rather than dropped. `snapshotId` identifies the stored snapshot the page came from.\n\nOlder audits saved before indexed evidence existed return `409` with `WORKFLOW_AUDIT_RESULT_NOT_FOUND`; read `GET .../result` for those.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Evidence"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "description": "Which evidence to read.",
            "schema": {
              "$ref": "#/components/schemas/EvidenceKind"
            }
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of evidence.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EvidencePage"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`kind` is missing or unknown, or `offset`/`limit` is out of range.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-invalid-input",
                  "title": "Invalid Input",
                  "status": 400,
                  "detail": "A run, evidence kind, nonnegative offset and limit of 1–20 are required",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/evidence",
                  "code": "API_INVALID_INPUT",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                  "title": "Insufficient Permissions",
                  "status": 403,
                  "detail": "Missing required scope: audit:read",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_INSUFFICIENT_SCOPE",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "404": {
            "description": "The run does not exist in your organization, a referenced item is not in this audit, or the path is not a workflow audit route.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit not found",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "unknownRoute": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/rest-api-not-found",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "Unknown workflow audit route or method",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/export",
                      "code": "REST_API_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed (`PROCESSING` or `FAILED`), so results are not available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "notCompleted": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                      "title": "Invalid Workflow Audit Status",
                      "status": 409,
                      "detail": "Audit results are not yet published",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/summary",
                      "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "legacyAudit": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-result-not-found",
                      "title": "Workflow Audit Result Not Found",
                      "status": 409,
                      "detail": "This historical audit uses the legacy report reader; segmented evidence is unavailable",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/evidence",
                      "code": "WORKFLOW_AUDIT_RESULT_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/workflow-audits/{runId}/result": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InstanceId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "getWorkflowAuditResult",
        "summary": "Get the full result",
        "description": "The complete report in one response: every workflow with its definition, the dependency graph, findings, health scores, the portfolio score and insights. Results from the current audit engine also include the portal's current reviews and an organization benchmark. For large portals, prefer the paginated routes or `/evidence`.\n\n**Scope:** `audit:read`.",
        "tags": [
          "Results"
        ],
        "security": [
          {
            "bearerAuth": [
              "audit:read"
            ]
          }
        ],
        "x-required-scope": "audit:read",
        "responses": {
          "200": {
            "description": "The full result.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WorkflowAuditResult"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key does not carry `audit:read`, or the run belongs to another organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "insufficientScope": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/api-key-insufficient-scope",
                      "title": "Insufficient Permissions",
                      "status": 403,
                      "detail": "Missing required scope: audit:read",
                      "instance": "/v1/workflow-audits",
                      "code": "API_KEY_INSUFFICIENT_SCOPE",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "otherOrganization": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-access-denied",
                      "title": "Workflow Audit Access Denied",
                      "status": 403,
                      "detail": "You do not have access to this workflow audit run",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/result",
                      "code": "WORKFLOW_AUDIT_RUN_ACCESS_DENIED",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No run with this ID, or no stored result for it.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "runNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-run-not-found",
                      "title": "Workflow Audit Not Found",
                      "status": 404,
                      "detail": "Workflow audit run not found: Xk3p9QwZr2mB7nT1aLc4",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/result",
                      "code": "WORKFLOW_AUDIT_RUN_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  },
                  "resultNotFound": {
                    "value": {
                      "type": "https://api.jetstack.ai/errors/workflow-audit-result-not-found",
                      "title": "Workflow Audit Result Not Found",
                      "status": 404,
                      "detail": "Result not found for workflow audit run: Xk3p9QwZr2mB7nT1aLc4",
                      "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/result",
                      "code": "WORKFLOW_AUDIT_RESULT_NOT_FOUND",
                      "requestId": "req_7f3a9c2e"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The run has not completed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://api.jetstack.ai/errors/workflow-audit-run-invalid-status",
                  "title": "Invalid Workflow Audit Status",
                  "status": 409,
                  "detail": "Results are not available. Run status: PROCESSING",
                  "instance": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4/result",
                  "code": "WORKFLOW_AUDIT_RUN_INVALID_STATUS",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key from **Settings → Access Tokens**, prefixed `jsai_`. Workflow audit endpoints need `audit:read` or `audit:write`; each operation lists its scope."
      }
    },
    "parameters": {
      "InstanceId": {
        "name": "X-Instance-Id",
        "in": "header",
        "required": false,
        "description": "Only for organizations on a dedicated Jetstack instance: the Instance ID shown in **Settings → Access Tokens → Connection Details**. Leave it out (or send `default`) otherwise.",
        "schema": {
          "type": "string",
          "example": "default"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Client-generated unique key (a UUID is recommended, up to 256 characters). Reserved for 24 hours and bound to the request body. A retry with the same key and body replays the first response with `Idempotent-Replayed: true` instead of starting another audit.",
        "schema": {
          "type": "string",
          "maxLength": 256
        },
        "example": "6f1c2b0e-5d7a-4c1e-9a43-2f8e1b7c9d10"
      },
      "RunId": {
        "name": "runId",
        "in": "path",
        "required": true,
        "description": "The audit run's `id`.",
        "schema": {
          "type": "string",
          "maxLength": 200
        },
        "example": "Xk3p9QwZr2mB7nT1aLc4"
      },
      "WorkflowId": {
        "name": "workflowId",
        "in": "path",
        "required": true,
        "description": "A workflow `id` from `GET .../workflows`.",
        "schema": {
          "type": "string",
          "maxLength": 200
        },
        "example": "4924872395"
      },
      "Offset": {
        "name": "offset",
        "in": "query",
        "required": false,
        "description": "Zero-based index of the first item.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Items per page. A page is also capped at 512 KiB, so it can hold fewer items.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "Search": {
        "name": "search",
        "in": "query",
        "required": false,
        "description": "Case-insensitive text match across each item, applied before pagination.",
        "schema": {
          "type": "string",
          "maxLength": 200
        }
      }
    },
    "headers": {
      "X-Request-Id": {
        "description": "Request identifier. Quote it when contacting support.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Limit": {
        "description": "Requests allowed in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      },
      "Idempotent-Replayed": {
        "description": "`true` when this response is a replay of an earlier request with the same `Idempotency-Key`.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing, malformed, unknown, revoked or expired API key.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            },
            "examples": {
              "missing": {
                "value": {
                  "type": "https://api.jetstack.ai/errors/auth-token-missing",
                  "title": "Authentication Required",
                  "status": 401,
                  "detail": "Authorization header is required",
                  "instance": "/v1/workflow-audits",
                  "code": "AUTH_TOKEN_MISSING",
                  "requestId": "req_7f3a9c2e"
                }
              },
              "notFound": {
                "value": {
                  "type": "https://api.jetstack.ai/errors/api-key-not-found",
                  "title": "Invalid API Key",
                  "status": 401,
                  "detail": "Invalid API key",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_NOT_FOUND",
                  "requestId": "req_7f3a9c2e"
                }
              },
              "revoked": {
                "value": {
                  "type": "https://api.jetstack.ai/errors/api-key-revoked",
                  "title": "API Key Revoked",
                  "status": 401,
                  "detail": "API key has been revoked",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_REVOKED",
                  "requestId": "req_7f3a9c2e"
                }
              },
              "expired": {
                "value": {
                  "type": "https://api.jetstack.ai/errors/api-key-expired",
                  "title": "API Key Expired",
                  "status": 401,
                  "detail": "API key has expired",
                  "instance": "/v1/workflow-audits",
                  "code": "API_KEY_EXPIRED",
                  "requestId": "req_7f3a9c2e"
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded.",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying.",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            },
            "example": {
              "type": "https://api.jetstack.ai/errors/api-key-rate-limited",
              "title": "Rate Limit Exceeded",
              "status": 429,
              "detail": "Rate limit of 100 requests per minute exceeded. Retry after 12 seconds.",
              "instance": "/v1/workflow-audits",
              "code": "API_KEY_RATE_LIMITED",
              "requestId": "req_7f3a9c2e"
            }
          }
        }
      },
      "InternalError": {
        "description": "Unexpected server error. Retry later, and contact support with the `requestId` if it persists.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            },
            "example": {
              "type": "https://api.jetstack.ai/errors/api-internal-error",
              "title": "Internal Server Error",
              "status": 500,
              "detail": "An unexpected error occurred while handling this request.",
              "instance": "/v1/workflow-audits",
              "code": "API_INTERNAL_ERROR",
              "requestId": "req_7f3a9c2e",
              "hint": "If this error persists, contact support with the requestId."
            }
          }
        }
      }
    },
    "schemas": {
      "AiCoverage": {
        "type": "object",
        "properties": {
          "naming": {
            "type": "string",
            "enum": [
              "complete",
              "partial",
              "unavailable",
              "disabled"
            ]
          },
          "insights": {
            "type": "string",
            "enum": [
              "complete",
              "partial",
              "unavailable",
              "disabled"
            ]
          }
        },
        "required": [
          "naming",
          "insights"
        ]
      },
      "AnalysisCoverage": {
        "type": "object",
        "properties": {
          "duplicates": {
            "type": "string",
            "enum": [
              "complete",
              "partial"
            ]
          },
          "assets": {
            "type": "string",
            "enum": [
              "complete",
              "partial"
            ]
          },
          "deadBranches": {
            "type": "string",
            "enum": [
              "limited"
            ]
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "duplicates",
          "assets",
          "deadBranches",
          "notes"
        ]
      },
      "AssetPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "$ref": "#/components/schemas/PageFields"
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ReferencedAsset"
                }
              }
            },
            "required": [
              "rows"
            ]
          }
        ]
      },
      "AssetReferencePage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "$ref": "#/components/schemas/PageFields"
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DependencyEvidence"
                }
              },
              "asset": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "Opaque asset key. Pass it as `assetKey`, URL-encoded."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "property",
                      "list",
                      "form",
                      "email",
                      "workflow",
                      "owner",
                      "team",
                      "pipeline"
                    ]
                  },
                  "id": {
                    "type": "string"
                  },
                  "objectTypeId": {
                    "type": "string"
                  },
                  "identityType": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "user",
                      "team"
                    ]
                  },
                  "workflowCount": {
                    "type": "integer",
                    "description": "Distinct workflows that reference the asset."
                  },
                  "label": {
                    "type": "string",
                    "description": "Resolved display name."
                  }
                },
                "required": [
                  "key",
                  "kind",
                  "id",
                  "workflowCount",
                  "label"
                ]
              }
            },
            "required": [
              "rows",
              "asset"
            ]
          }
        ]
      },
      "AuditSummaryView": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "workflowCount": {
                "type": "integer"
              },
              "findingCount": {
                "type": "integer"
              },
              "portfolioScore": {
                "$ref": "#/components/schemas/PortfolioHealthScore"
              },
              "inventoryCoverage": {
                "$ref": "#/components/schemas/InventoryCoverage"
              },
              "analysisCoverage": {
                "$ref": "#/components/schemas/AnalysisCoverage"
              },
              "aiCoverage": {
                "$ref": "#/components/schemas/AiCoverage"
              },
              "referenceCoverageComplete": {
                "type": "boolean"
              }
            },
            "required": [
              "workflowCount",
              "findingCount",
              "portfolioScore",
              "referenceCoverageComplete"
            ]
          }
        ]
      },
      "AuditedWorkflow": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WorkflowSummary"
          },
          {
            "type": "object",
            "properties": {
              "references": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WorkflowReference"
                }
              },
              "snapshot": {
                "$ref": "#/components/schemas/WorkflowDefinitionSnapshot"
              }
            }
          }
        ],
        "description": "A workflow with its full captured definition and references."
      },
      "CreateWorkflowAuditInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "A name for the audit."
          },
          "portalId": {
            "type": "string",
            "maxLength": 200,
            "description": "HubSpot portal ID, or the Jetstack portal ID from `GET /v1/portals`. The portal must be connected to your organization."
          },
          "scope": {
            "type": "object",
            "properties": {
              "objectTypes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^\\d+-\\d+$"
                },
                "description": "HubSpot object type IDs to include, such as `0-1` (contacts) and `0-2` (companies). Up to 50.",
                "maxItems": 50
              }
            },
            "description": "Limits the audit to some object types. Omit to include every supported object type.",
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "portalId"
        ]
      },
      "DependencyConnection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "Source workflow ID."
          },
          "target": {
            "type": "string",
            "description": "Target workflow ID."
          },
          "relationship": {
            "$ref": "#/components/schemas/DependencyRelationship"
          },
          "explanation": {
            "type": "string"
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DependencyEvidence"
            }
          },
          "basis": {
            "type": "string",
            "const": "configuration"
          }
        },
        "required": [
          "id",
          "source",
          "target",
          "relationship",
          "explanation",
          "evidence",
          "basis"
        ]
      },
      "DependencyCoverage": {
        "type": "object",
        "properties": {
          "complete": {
            "type": "boolean"
          },
          "unknownWorkflowIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "missingWorkflowIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Referenced workflows that are not in the captured inventory."
          },
          "pathDepthLimit": {
            "type": "integer",
            "example": 20
          },
          "pathsTruncated": {
            "type": "boolean"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "complete",
          "unknownWorkflowIds",
          "missingWorkflowIds",
          "pathDepthLimit",
          "pathsTruncated",
          "notes"
        ]
      },
      "DependencyEvidence": {
        "type": "object",
        "properties": {
          "workflowId": {
            "type": "string"
          },
          "reference": {
            "$ref": "#/components/schemas/WorkflowReference"
          }
        },
        "required": [
          "workflowId",
          "reference"
        ]
      },
      "DependencyGraph": {
        "type": "object",
        "properties": {
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GraphNode"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GraphEdge"
            }
          },
          "clusters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GraphCluster"
            }
          }
        },
        "required": [
          "nodes",
          "edges",
          "clusters"
        ]
      },
      "DependencyPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "$ref": "#/components/schemas/PageFields"
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DependencyConnection"
                }
              },
              "workflowId": {
                "type": "string"
              },
              "coverage": {
                "$ref": "#/components/schemas/DependencyCoverage"
              }
            },
            "required": [
              "rows",
              "workflowId",
              "coverage"
            ]
          }
        ]
      },
      "DependencyPath": {
        "type": "object",
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "upstream",
              "downstream"
            ]
          },
          "workflowIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Workflow IDs along the path, in order."
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DependencyEvidence"
            }
          },
          "cycle": {
            "type": "boolean",
            "description": "`true` when the path returns to the selected workflow."
          }
        },
        "required": [
          "direction",
          "workflowIds",
          "evidence",
          "cycle"
        ]
      },
      "DependencyRelationship": {
        "type": "string",
        "enum": [
          "explicit-enrollment",
          "potential-handoff",
          "shared-writer",
          "shared-usage"
        ]
      },
      "EvidenceKind": {
        "type": "string",
        "enum": [
          "workflow",
          "finding",
          "node",
          "edge",
          "cluster",
          "score",
          "insight"
        ]
      },
      "EvidencePage": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/EvidenceKind"
          },
          "offset": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "nextOffset": {
            "type": [
              "integer",
              "null"
            ]
          },
          "snapshotId": {
            "type": "string"
          },
          "rows": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/AuditedWorkflow"
                },
                {
                  "$ref": "#/components/schemas/Finding"
                },
                {
                  "$ref": "#/components/schemas/GraphNode"
                },
                {
                  "$ref": "#/components/schemas/GraphEdge"
                },
                {
                  "$ref": "#/components/schemas/GraphCluster"
                },
                {
                  "$ref": "#/components/schemas/WorkflowHealthScore"
                },
                {
                  "$ref": "#/components/schemas/Insight"
                },
                {
                  "$ref": "#/components/schemas/EvidenceRequiresDetail"
                }
              ]
            },
            "description": "Items of the requested kind: `AuditedWorkflow` for `workflow`, `Finding` for `finding`, `GraphNode` for `node`, `GraphEdge` for `edge`, `GraphCluster` for `cluster`, `WorkflowHealthScore` for `score`, `Insight` for `insight`. An item over 64 KiB is replaced by an `EvidenceRequiresDetail` marker."
          }
        },
        "required": [
          "kind",
          "offset",
          "total",
          "nextOffset",
          "snapshotId",
          "rows"
        ]
      },
      "EvidenceRequiresDetail": {
        "type": "object",
        "properties": {
          "evidenceStatus": {
            "type": "string",
            "const": "requires-detail"
          },
          "kind": {
            "$ref": "#/components/schemas/EvidenceKind"
          },
          "ordinal": {
            "type": "integer"
          },
          "bytes": {
            "type": "integer"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "evidenceStatus",
          "kind",
          "ordinal",
          "bytes",
          "reason"
        ],
        "description": "Stands in for an item larger than 64 KiB. The item is retained; read it through the workflow detail or the full result."
      },
      "Finding": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "PROP_COLLISION",
              "ENROLLMENT_OVERLAP",
              "CIRCULAR_CHAIN",
              "ORPHANED_DEP",
              "STALE",
              "NO_GOAL",
              "NO_DESCRIPTION",
              "NAMING_VIOLATION",
              "CONSOLIDATION",
              "REENROLLMENT_RISK",
              "DEAD_BRANCH",
              "BRANCH_MISMATCH",
              "EMAIL_FREQUENCY",
              "HIGH_COMPLEXITY"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "warning",
              "info",
              "suggestion"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "involvedWorkflows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "workflowId": {
                  "type": "string"
                },
                "workflowName": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                }
              },
              "required": [
                "workflowId",
                "workflowName",
                "role"
              ]
            }
          },
          "affectedProperty": {
            "type": "string"
          },
          "affectedObjectType": {
            "type": "string"
          },
          "affectedAsset": {
            "type": "string"
          },
          "recommendation": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string",
            "description": "Stable ID across runs. Use it as the `entityId` of a `finding` review."
          },
          "ruleVersion": {
            "type": "integer"
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "workflowId": {
                  "type": "string"
                },
                "locator": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "workflowId",
                "locator",
                "description"
              ]
            }
          },
          "priority": {
            "type": "object",
            "properties": {
              "score": {
                "type": "number"
              },
              "activeEnrollments": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Sum of active enrollments across the workflows involved, not unique records."
              },
              "volumeCoverage": {
                "type": "string",
                "enum": [
                  "complete",
                  "partial",
                  "unavailable"
                ]
              },
              "enabledWorkflows": {
                "type": "integer"
              },
              "horizon": {
                "type": "string",
                "enum": [
                  "week",
                  "month",
                  "optional"
                ]
              },
              "effort": {
                "type": "string",
                "enum": [
                  "small",
                  "medium",
                  "large"
                ]
              },
              "explanation": {
                "type": "string"
              }
            },
            "required": [
              "score",
              "activeEnrollments",
              "volumeCoverage",
              "enabledWorkflows",
              "horizon",
              "effort",
              "explanation"
            ]
          },
          "collisionAssessment": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "potential"
              },
              "valueComparison": {
                "type": "string",
                "enum": [
                  "different-static-values",
                  "dynamic-or-unavailable"
                ]
              },
              "applicability": {
                "type": "string",
                "const": "unassessed"
              }
            },
            "required": [
              "status",
              "valueComparison",
              "applicability"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "severity",
          "title",
          "description",
          "involvedWorkflows",
          "recommendation"
        ]
      },
      "FindingPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "$ref": "#/components/schemas/PageFields"
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Finding"
                }
              }
            },
            "required": [
              "rows"
            ]
          }
        ]
      },
      "GraphCluster": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "objectTypeId": {
            "type": "string"
          },
          "objectType": {
            "type": "string"
          },
          "nodeIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "workflowCount": {
            "type": "integer"
          },
          "healthSummary": {
            "type": "object",
            "properties": {
              "healthy": {
                "type": "integer"
              },
              "warning": {
                "type": "integer"
              },
              "critical": {
                "type": "integer"
              }
            },
            "required": [
              "healthy",
              "warning",
              "critical"
            ]
          }
        },
        "required": [
          "id",
          "objectTypeId",
          "objectType",
          "nodeIds",
          "workflowCount",
          "healthSummary"
        ]
      },
      "GraphEdge": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "triggers",
              "shares",
              "conflicts",
              "references"
            ]
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "source",
          "target",
          "type"
        ]
      },
      "GraphNode": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "workflow",
              "list",
              "form",
              "email",
              "pipeline",
              "property"
            ]
          },
          "name": {
            "type": "string"
          },
          "objectTypeId": {
            "type": "string"
          },
          "healthScore": {
            "type": "number"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "id",
          "type",
          "name",
          "metadata"
        ]
      },
      "Insight": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "warning",
              "suggestion"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "relatedWorkflowIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "relatedConflictIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "actionLabel": {
            "type": "string"
          },
          "actionTarget": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "rule",
              "ai"
            ]
          }
        },
        "required": [
          "id",
          "severity",
          "title",
          "description",
          "relatedWorkflowIds",
          "actionLabel",
          "actionTarget"
        ]
      },
      "InventoryCoverage": {
        "type": "object",
        "properties": {
          "legacyAvailable": {
            "type": "boolean"
          },
          "detailFailures": {
            "type": "integer",
            "description": "Workflows whose full definition could not be read."
          },
          "knownWorkflows": {
            "type": "integer"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "legacyAvailable",
          "detailFailures",
          "knownWorkflows",
          "warnings"
        ]
      },
      "InvestigationEnvelope": {
        "type": "object",
        "properties": {
          "auditRunId": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "description": "Result schema version. `2` for audits from the current engine."
          },
          "capturedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the audit captured the portal."
          },
          "basis": {
            "type": "string",
            "const": "configuration",
            "description": "Findings are based on workflow configuration."
          },
          "runtimeExecutionAssessed": {
            "type": "boolean",
            "const": false,
            "description": "Always `false`: the audit does not assess execution history."
          }
        },
        "required": [
          "auditRunId",
          "schemaVersion",
          "capturedAt",
          "basis",
          "runtimeExecutionAssessed"
        ],
        "description": "Fields on every investigation response."
      },
      "PageFields": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Matching items, after `search` is applied."
          },
          "offset": {
            "type": "integer"
          },
          "nextOffset": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Offset of the next page, or `null` on the last page."
          }
        },
        "required": [
          "total",
          "offset",
          "nextOffset"
        ]
      },
      "PathPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "$ref": "#/components/schemas/PageFields"
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DependencyPath"
                }
              },
              "workflowId": {
                "type": "string"
              },
              "coverage": {
                "$ref": "#/components/schemas/DependencyCoverage"
              }
            },
            "required": [
              "rows",
              "workflowId",
              "coverage"
            ]
          }
        ]
      },
      "PortfolioHealthScore": {
        "type": "object",
        "properties": {
          "scoringVersion": {
            "type": "integer",
            "enum": [
              2,
              3
            ],
            "description": "Do not compare scores across scoring versions."
          },
          "total": {
            "type": "number",
            "description": "0–100."
          },
          "avgWorkflowScore": {
            "type": "number"
          },
          "conflictScore": {
            "type": "number"
          },
          "governanceScore": {
            "type": "number"
          },
          "capacityScore": {
            "type": "number"
          },
          "capacityUsed": {
            "type": "number",
            "description": "Workflow count divided by the plan's workflow limit."
          },
          "assessedWorkflows": {
            "type": "integer"
          },
          "unassessedWorkflows": {
            "type": "integer"
          },
          "capacityAvailable": {
            "type": "boolean"
          },
          "planLimit": {
            "type": "integer"
          }
        },
        "required": [
          "total",
          "avgWorkflowScore",
          "conflictScore",
          "governanceScore",
          "capacityScore",
          "capacityUsed"
        ]
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "example": "https://api.jetstack.ai/errors/workflow-audit-run-not-found"
          },
          "title": {
            "type": "string",
            "example": "Workflow Audit Not Found"
          },
          "status": {
            "type": "integer",
            "example": 404
          },
          "detail": {
            "type": "string",
            "example": "Workflow audit not found"
          },
          "instance": {
            "type": "string",
            "description": "Request path.",
            "example": "/v1/workflow-audits/Xk3p9QwZr2mB7nT1aLc4"
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error code. Match on this, not on `detail`.",
            "example": "WORKFLOW_AUDIT_RUN_NOT_FOUND"
          },
          "requestId": {
            "type": "string",
            "description": "Quote this when contacting support.",
            "example": "req_7f3a9c2e"
          },
          "hint": {
            "type": "string",
            "description": "A suggested next step, when there is one."
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code"
        ],
        "description": "RFC 7807 problem document, sent as `application/problem+json`."
      },
      "ReferencedAsset": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Opaque asset key. Pass it as `assetKey`, URL-encoded."
          },
          "kind": {
            "type": "string",
            "enum": [
              "property",
              "list",
              "form",
              "email",
              "workflow",
              "owner",
              "team",
              "pipeline"
            ]
          },
          "id": {
            "type": "string"
          },
          "objectTypeId": {
            "type": "string"
          },
          "identityType": {
            "type": "string",
            "enum": [
              "owner",
              "user",
              "team"
            ]
          },
          "workflowCount": {
            "type": "integer",
            "description": "Distinct workflows that reference the asset."
          },
          "label": {
            "type": "string",
            "description": "Resolved display name."
          },
          "readerCount": {
            "type": "integer",
            "description": "Distinct workflows that read it."
          },
          "writerCount": {
            "type": "integer",
            "description": "Distinct workflows that write it."
          }
        },
        "required": [
          "key",
          "kind",
          "id",
          "workflowCount",
          "label",
          "readerCount",
          "writerCount"
        ]
      },
      "ReviewEntry": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "note",
              "finding",
              "decision"
            ]
          },
          "entityId": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved",
              "ignored"
            ],
            "description": "Finding disposition. Notes and decisions are `open`."
          },
          "version": {
            "type": "integer",
            "description": "Send this as `expectedVersion` on the next save."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedBy": {
            "type": "string",
            "description": "User ID of the person who saved it (for an API key, the key's creator)."
          },
          "reviewedRunId": {
            "type": "string"
          },
          "reviewedRunCreatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "effectiveStatus": {
            "type": "string",
            "enum": [
              "open",
              "resolved",
              "ignored"
            ],
            "description": "The disposition for this run, after reopening."
          },
          "reopened": {
            "type": "boolean",
            "description": "A resolved finding that appeared again in a later run."
          },
          "decision": {
            "type": "string",
            "enum": [
              "keep",
              "improve",
              "investigate",
              "retirement-candidate"
            ]
          },
          "owner": {
            "type": "string",
            "description": "A label for who owns the follow-up. Not a HubSpot assignment or permission."
          },
          "decisionStatus": {
            "type": "string",
            "enum": [
              "proposed",
              "agreed"
            ],
            "description": "Human review state, not execution approval."
          },
          "reviewedFingerprint": {
            "type": "string"
          },
          "needsRevalidation": {
            "type": "boolean",
            "description": "The workflow definition has changed since the decision, or cannot be compared."
          }
        },
        "required": [
          "kind",
          "entityId",
          "text",
          "status",
          "version",
          "updatedAt",
          "updatedBy",
          "reviewedRunId",
          "reviewedRunCreatedAt"
        ]
      },
      "ReviewPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "$ref": "#/components/schemas/PageFields"
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ReviewEntry"
                }
              },
              "currentPortalState": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "rows",
              "currentPortalState"
            ]
          }
        ]
      },
      "SaveReviewInput": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "note",
              "finding",
              "decision"
            ]
          },
          "entityId": {
            "type": "string",
            "maxLength": 200,
            "description": "A workflow `id` for notes and decisions, a finding `fingerprint` for findings."
          },
          "text": {
            "type": "string",
            "maxLength": 8000,
            "description": "Note text or rationale. Required for decisions and for new notes."
          },
          "expectedVersion": {
            "type": "integer",
            "minimum": 0,
            "description": "`0` for a new entry, otherwise the last returned `version`."
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved",
              "ignored"
            ],
            "description": "Findings only. Defaults to `open`."
          },
          "decision": {
            "type": "string",
            "enum": [
              "keep",
              "improve",
              "investigate",
              "retirement-candidate"
            ],
            "description": "Required for decisions."
          },
          "owner": {
            "type": "string",
            "maxLength": 200,
            "description": "Required for decisions. Send an empty string for no owner."
          },
          "decisionStatus": {
            "type": "string",
            "enum": [
              "proposed",
              "agreed"
            ],
            "description": "Required for decisions."
          }
        },
        "required": [
          "kind",
          "entityId",
          "text",
          "expectedVersion"
        ]
      },
      "WorkflowActionCategory": {
        "type": "string",
        "enum": [
          "property",
          "email",
          "notification",
          "delay",
          "branch",
          "webhook",
          "code",
          "record",
          "task",
          "owner",
          "workflow",
          "list",
          "sequence",
          "ai",
          "unknown"
        ]
      },
      "WorkflowActionSummary": {
        "type": "object",
        "properties": {
          "actionId": {
            "type": "string"
          },
          "actionTypeId": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "category": {
            "$ref": "#/components/schemas/WorkflowActionCategory"
          },
          "label": {
            "type": "string"
          },
          "fields": {
            "type": "object",
            "additionalProperties": true
          },
          "structure": {
            "type": "object",
            "additionalProperties": true,
            "description": "Branch and connection structure, with secrets redacted."
          }
        },
        "required": [
          "actionId",
          "actionTypeId",
          "type",
          "category",
          "label",
          "fields",
          "structure"
        ]
      },
      "WorkflowAuditProgress": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "fetching",
              "parsing",
              "building_graph",
              "detecting_conflicts",
              "scoring",
              "generating_insights"
            ]
          },
          "percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "workflowsFetched": {
            "type": "integer"
          },
          "workflowsParsed": {
            "type": "integer"
          }
        },
        "required": [
          "stage",
          "percent"
        ]
      },
      "WorkflowAuditResult": {
        "type": "object",
        "properties": {
          "auditRunId": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "const": 2
          },
          "scoringVersion": {
            "type": "integer",
            "enum": [
              2,
              3
            ]
          },
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditedWorkflow"
            }
          },
          "graph": {
            "$ref": "#/components/schemas/DependencyGraph"
          },
          "conflicts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Finding"
            },
            "description": "Configuration findings."
          },
          "healthScores": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/WorkflowHealthScore"
            },
            "description": "Keyed by workflow ID."
          },
          "portfolioScore": {
            "$ref": "#/components/schemas/PortfolioHealthScore"
          },
          "insights": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Insight"
            }
          },
          "inventoryCoverage": {
            "$ref": "#/components/schemas/InventoryCoverage"
          },
          "analysisCoverage": {
            "$ref": "#/components/schemas/AnalysisCoverage"
          },
          "aiCoverage": {
            "$ref": "#/components/schemas/AiCoverage"
          },
          "referenceCoverageComplete": {
            "type": "boolean"
          },
          "propertyInventory": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "objectTypeId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "workflowIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "objectTypeId",
                "name",
                "label",
                "workflowIds"
              ]
            }
          },
          "propertyCoverage": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "complete",
                "unavailable"
              ]
            }
          },
          "emailExposure": {
            "type": "object",
            "description": "Estimated configured email sends per workflow and per shared enrollment group over a rolling week."
          },
          "changelog": {
            "type": "object",
            "description": "Changes since the previous audit of the same portal."
          },
          "review": {
            "$ref": "#/components/schemas/WorkflowAuditReview"
          },
          "benchmark": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "available",
                  "unavailable"
                ]
              },
              "scope": {
                "type": "string",
                "const": "organization"
              },
              "minimumPortals": {
                "type": "integer"
              },
              "cohort": {
                "type": "string"
              },
              "eligibleOtherPortals": {
                "type": "integer"
              },
              "averageHealth": {
                "type": "number"
              },
              "averageNamingCompliance": {
                "type": "number"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "scope",
              "minimumPortals",
              "cohort",
              "eligibleOtherPortals"
            ],
            "description": "How this portal compares with the other portals your organization has audited."
          }
        },
        "required": [
          "auditRunId",
          "workflows",
          "graph",
          "conflicts",
          "healthScores",
          "portfolioScore",
          "insights"
        ]
      },
      "WorkflowAuditReview": {
        "type": "object",
        "properties": {
          "notes": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/ReviewEntry"
            }
          },
          "findings": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/ReviewEntry"
            }
          },
          "decisions": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/ReviewEntry"
            }
          }
        },
        "required": [
          "notes",
          "findings"
        ],
        "description": "Current portal review state, loaded when you read the result."
      },
      "WorkflowAuditRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Run ID. Use it as `{runId}`."
          },
          "name": {
            "type": "string"
          },
          "portalId": {
            "type": "string",
            "description": "HubSpot portal ID."
          },
          "portalName": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/WorkflowAuditStatus"
          },
          "progress": {
            "$ref": "#/components/schemas/WorkflowAuditProgress"
          },
          "summary": {
            "$ref": "#/components/schemas/WorkflowAuditRunSummary",
            "description": "Present once the run has completed."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "portalId",
          "portalName",
          "status",
          "progress",
          "createdAt"
        ]
      },
      "WorkflowAuditRunList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowAuditRun"
            }
          },
          "total": {
            "type": "integer",
            "description": "Runs matching the filters."
          },
          "hasMore": {
            "type": "boolean"
          },
          "lastId": {
            "type": "string",
            "description": "Pass as `startAfter` to read the next page."
          }
        },
        "required": [
          "items",
          "total",
          "hasMore"
        ]
      },
      "WorkflowAuditRunSummary": {
        "type": "object",
        "properties": {
          "workflowCount": {
            "type": "integer"
          },
          "healthScore": {
            "type": "number",
            "description": "Portfolio health score, 0–100."
          },
          "conflictCount": {
            "type": "integer"
          },
          "healthBreakdown": {
            "type": "object",
            "properties": {
              "healthy": {
                "type": "integer"
              },
              "warning": {
                "type": "integer"
              },
              "critical": {
                "type": "integer"
              }
            },
            "required": [
              "healthy",
              "warning",
              "critical"
            ]
          },
          "previousAuditId": {
            "type": "string",
            "description": "The previous audit of the same portal, when there is one."
          },
          "previousHealthScore": {
            "type": "number"
          },
          "scoreDelta": {
            "type": "number"
          }
        },
        "required": [
          "workflowCount",
          "healthScore",
          "conflictCount",
          "healthBreakdown"
        ]
      },
      "WorkflowAuditStatus": {
        "type": "string",
        "enum": [
          "PROCESSING",
          "COMPLETED",
          "FAILED"
        ],
        "description": "A failed run never becomes an empty successful report."
      },
      "WorkflowBrief": {
        "type": "object",
        "properties": {
          "workflowId": {
            "type": "string"
          },
          "mechanics": {
            "type": "string",
            "description": "What the workflow does, in plain language."
          },
          "declaredPurpose": {
            "type": "string"
          },
          "purposeStatus": {
            "type": "string",
            "enum": [
              "provided",
              "unknown"
            ]
          },
          "activity": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "observed",
                  "none-observed",
                  "unavailable"
                ]
              },
              "windowDays": {
                "type": "integer",
                "const": 30
              },
              "enrolled": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "completed": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "observedAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "status",
              "windowDays",
              "enrolled",
              "completed"
            ]
          },
          "runtimeErrors": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "unassessed"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "reason"
            ]
          },
          "suggestedBucket": {
            "type": "string",
            "enum": [
              "repair",
              "consolidate",
              "retirement-review",
              "retain-review",
              "needs-context"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "nextStep": {
            "type": "string"
          },
          "findingIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "directCallers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "directDependencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unresolvedDependencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "processId": {
            "type": "string"
          },
          "retirementBlockers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Review suggestions, never approval to change the portal."
          }
        },
        "required": [
          "workflowId",
          "mechanics",
          "purposeStatus",
          "activity",
          "runtimeErrors",
          "suggestedBucket",
          "reasons",
          "nextStep",
          "findingIds",
          "directCallers",
          "directDependencies",
          "unresolvedDependencies",
          "processId",
          "retirementBlockers"
        ]
      },
      "WorkflowComplexityDetails": {
        "type": "object",
        "properties": {
          "actions": {
            "type": "integer"
          },
          "branches": {
            "type": "integer"
          },
          "conditions": {
            "type": "integer"
          },
          "maxConditionDepth": {
            "type": "integer"
          },
          "score": {
            "type": "number"
          }
        },
        "required": [
          "actions",
          "branches",
          "conditions",
          "maxConditionDepth",
          "score"
        ]
      },
      "WorkflowCoverage": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "partial",
              "unavailable"
            ]
          },
          "reason": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "v4",
              "v3"
            ],
            "description": "HubSpot API version the definition came from."
          },
          "fetchedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "status",
          "source",
          "fetchedAt"
        ]
      },
      "WorkflowDefinitionSnapshot": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "const": 2
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "isEnabled": {
            "type": "boolean"
          },
          "objectTypeId": {
            "type": "string"
          },
          "startActionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "enrollment": {
            "description": "Enrollment criteria as captured."
          },
          "goal": {
            "description": "Goal criteria as captured."
          },
          "suppression": {
            "description": "Suppression settings as captured."
          },
          "actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowActionSummary"
            }
          },
          "settings": {
            "type": "object",
            "additionalProperties": true
          },
          "fingerprint": {
            "type": "string",
            "description": "Hash of the definition. Decisions compare against it to flag `needsRevalidation`."
          }
        },
        "required": [
          "version",
          "name",
          "description",
          "isEnabled",
          "objectTypeId",
          "startActionId",
          "enrollment",
          "goal",
          "suppression",
          "actions",
          "settings",
          "fingerprint"
        ],
        "description": "The workflow definition as captured, with secrets redacted."
      },
      "WorkflowDependencies": {
        "type": "object",
        "properties": {
          "lists": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "forms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "workflows": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "properties": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "objectTypeId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "objectTypeId",
                "name"
              ]
            }
          },
          "owners": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pipelines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "objectTypeId": {
                  "type": "string"
                },
                "pipelineId": {
                  "type": "string"
                }
              },
              "required": [
                "objectTypeId",
                "pipelineId"
              ]
            }
          }
        },
        "required": [
          "lists",
          "forms",
          "emails",
          "workflows",
          "properties",
          "owners",
          "pipelines"
        ]
      },
      "WorkflowDetailView": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "workflow": {
                "$ref": "#/components/schemas/AuditedWorkflow"
              },
              "brief": {
                "$ref": "#/components/schemas/WorkflowBrief"
              },
              "health": {
                "$ref": "#/components/schemas/WorkflowHealthScore"
              }
            },
            "required": [
              "workflow"
            ]
          }
        ]
      },
      "WorkflowEnrollmentMetrics": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "unavailable"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "v3-statistics",
              "internal-analytics"
            ]
          },
          "fetchedAt": {
            "type": "string",
            "format": "date-time"
          },
          "enrolled": {
            "type": [
              "integer",
              "null"
            ]
          },
          "active": {
            "type": [
              "integer",
              "null"
            ]
          },
          "completed": {
            "type": [
              "integer",
              "null"
            ]
          },
          "enrolled30d": {
            "type": [
              "integer",
              "null"
            ]
          },
          "completed30d": {
            "type": [
              "integer",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "source",
          "fetchedAt",
          "enrolled",
          "active",
          "completed",
          "enrolled30d",
          "completed30d"
        ]
      },
      "WorkflowHealthFactors": {
        "type": "object",
        "properties": {
          "configuration": {
            "type": "number",
            "description": "0–30."
          },
          "conflicts": {
            "type": "number",
            "description": "0–30."
          },
          "complexity": {
            "type": "number",
            "description": "0–20."
          },
          "activity": {
            "type": "number",
            "description": "0–20."
          }
        },
        "required": [
          "configuration",
          "conflicts",
          "complexity",
          "activity"
        ]
      },
      "WorkflowHealthScore": {
        "type": "object",
        "properties": {
          "workflowId": {
            "type": "string"
          },
          "total": {
            "type": "number",
            "description": "0–100."
          },
          "category": {
            "type": "string",
            "enum": [
              "healthy",
              "warning",
              "critical"
            ]
          },
          "factors": {
            "$ref": "#/components/schemas/WorkflowHealthFactors"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "available": {
            "type": "boolean"
          },
          "scoringVersion": {
            "type": "integer",
            "enum": [
              2,
              3
            ]
          },
          "factorMaximums": {
            "$ref": "#/components/schemas/WorkflowHealthFactors"
          }
        },
        "required": [
          "workflowId",
          "total",
          "category",
          "factors",
          "issues"
        ]
      },
      "WorkflowNativeValidation": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "partial",
              "unavailable"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "v3-validation"
            ]
          },
          "fetchedAt": {
            "type": "string",
            "format": "date-time"
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "error",
                    "warning",
                    "info"
                  ]
                },
                "evidence": {
                  "description": "Redacted HubSpot payload for this section."
                }
              },
              "required": [
                "category",
                "severity",
                "evidence"
              ]
            },
            "description": "Non-empty sections from HubSpot's validation response. These are not counts of execution errors."
          },
          "evidence": {
            "description": "The redacted HubSpot validation payload."
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "source",
          "fetchedAt",
          "sections"
        ],
        "description": "HubSpot's own validation of the workflow, where available."
      },
      "WorkflowPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InvestigationEnvelope"
          },
          {
            "$ref": "#/components/schemas/PageFields"
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WorkflowSummary"
                }
              }
            },
            "required": [
              "rows"
            ]
          }
        ]
      },
      "WorkflowReference": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "property",
              "list",
              "form",
              "email",
              "workflow",
              "owner",
              "team",
              "pipeline"
            ]
          },
          "id": {
            "type": "string"
          },
          "objectTypeId": {
            "type": "string"
          },
          "relation": {
            "type": "string",
            "enum": [
              "reads",
              "writes",
              "creates",
              "enrolls-from",
              "suppresses-with",
              "sends",
              "triggers",
              "assigns-to",
              "references"
            ]
          },
          "surface": {
            "type": "string",
            "enum": [
              "enrollment",
              "suppression",
              "goal",
              "action",
              "branch",
              "configuration"
            ]
          },
          "locator": {
            "type": "string",
            "description": "Where in the workflow definition the reference was found."
          },
          "actionId": {
            "type": "string"
          },
          "identityType": {
            "type": "string",
            "enum": [
              "owner",
              "user",
              "team"
            ],
            "description": "Owner, user and team IDs are separate namespaces."
          }
        },
        "required": [
          "kind",
          "id",
          "relation",
          "surface",
          "locator"
        ]
      },
      "WorkflowSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Workflow ID. Use it as `{workflowId}` and as a review `entityId`."
          },
          "name": {
            "type": "string"
          },
          "objectTypeId": {
            "type": "string"
          },
          "objectType": {
            "type": "string"
          },
          "isEnabled": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "actionCount": {
            "type": "integer"
          },
          "branchCount": {
            "type": "integer"
          },
          "hasGoal": {
            "type": "boolean"
          },
          "hasDescription": {
            "type": "boolean"
          },
          "hasSuppression": {
            "type": "boolean"
          },
          "enrollmentType": {
            "type": "string"
          },
          "dependencies": {
            "$ref": "#/components/schemas/WorkflowDependencies"
          },
          "complexity": {
            "type": "number"
          },
          "analysisVersion": {
            "type": "integer",
            "const": 2,
            "description": "Present for workflows analysed by the current engine. Only these can be reviewed."
          },
          "description": {
            "type": "string"
          },
          "flowId": {
            "type": "string"
          },
          "legacyId": {
            "type": "string"
          },
          "coverage": {
            "$ref": "#/components/schemas/WorkflowCoverage"
          },
          "metrics": {
            "$ref": "#/components/schemas/WorkflowEnrollmentMetrics"
          },
          "nativeValidation": {
            "$ref": "#/components/schemas/WorkflowNativeValidation"
          },
          "shouldReEnroll": {
            "type": "boolean"
          },
          "actionMix": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Action count by category."
          },
          "complexityDetails": {
            "$ref": "#/components/schemas/WorkflowComplexityDetails"
          },
          "userReferences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowUserReference"
            }
          }
        },
        "required": [
          "id",
          "name",
          "objectTypeId",
          "objectType",
          "isEnabled",
          "createdAt",
          "updatedAt",
          "actionCount",
          "branchCount",
          "hasGoal",
          "hasDescription",
          "hasSuppression",
          "enrollmentType",
          "dependencies",
          "complexity"
        ],
        "description": "A workflow in the inventory list, without `snapshot` and `references`."
      },
      "WorkflowUserReference": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "identityType": {
            "type": "string",
            "enum": [
              "owner",
              "user",
              "team"
            ]
          },
          "name": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "identityType"
        ]
      }
    }
  }
}
