{
  "openapi": "3.0.0",
  "info": {
    "title": "DataAgents Workflow Logs API",
    "version": "1",
    "description": "Read the execution log of a DataAgents workflow run in your organization."
  },
  "servers": [
    {
      "url": "https://backend.snapaddy.com/workflow"
    }
  ],
  "paths": {
    "/v1/logs": {
      "get": {
        "operationId": "WorkflowLogController_getWorkflowLogs",
        "summary": "Read execution log entries",
        "description": "Supply the job ID from the trigger response. Entries are ordered by creation time and can describe individual nodes or the whole run. Requires DataAgents access in the organization that owns the job.",
        "parameters": [
          {
            "name": "jobId",
            "required": true,
            "in": "query",
            "description": "Workflow job ID returned when the run was queued.",
            "schema": {
              "type": "string",
              "example": "33333333-3333-4333-8333-333333333333"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of log entries to return.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 100,
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Number of log entries to skip.",
            "schema": {
              "minimum": 0,
              "default": 0,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of log entries in creation order. Inspect type, nodeId and payload to understand a step.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GetWorkflowLogEntryResponseDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing job ID in the request"
          },
          "403": {
            "description": "The account cannot access the referenced job."
          },
          "404": {
            "description": "No workflow job with this `jobId` was found."
          }
        },
        "security": [
          {
            "x-api-key": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "GetWorkflowLogEntryResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID of the workflow log entry"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string",
            "description": "Date of creation"
          },
          "type": {
            "type": "string",
            "description": "Type of the workflow log entry"
          },
          "payload": {
            "type": "object",
            "description": "Payload of the workflow log entry"
          },
          "jobId": {
            "type": "string",
            "description": "ID of the job that created this log entry"
          },
          "workflowId": {
            "type": "string",
            "description": "ID of the workflow that created this log entry"
          },
          "nodeId": {
            "type": "string",
            "description": "ID of the node that created this log entry",
            "nullable": true
          },
          "nodeType": {
            "type": "string",
            "description": "Type of the node that created this log entry",
            "nullable": true
          },
          "creditCost": {
            "type": "number",
            "description": "Actual credit cost for executing this node",
            "nullable": true
          }
        },
        "required": [
          "id",
          "createdAt",
          "type",
          "payload",
          "jobId",
          "workflowId",
          "nodeId",
          "nodeType",
          "creditCost"
        ],
        "title": "Get Workflow Log Entry Response"
      }
    },
    "securitySchemes": {
      "x-api-key": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Use a [personal API token](/authentication/#personal-api-token)."
      }
    }
  }
}
