# List Workflow Logs — Dify

> List past runs of a Dify Workflow app, newest first, with each run's status, token usage, step count, and timing. Only Workflow apps record these logs: a Chatflow, Chatbot, Agent, or Text Generator app's key returns an empty page, not an…

- Key: `dify-list-workflow-logs`
- Type: Action (Read-only)
- Version: 0.0.1
- App: Dify (`dify`) — https://pipedream.com/apps/dify.md
- This page (HTML): https://pipedream.com/apps/dify/actions/list-workflow-logs
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/dify/actions/list-workflow-logs/list-workflow-logs.mjs

## Description

List past runs of a Dify **Workflow** app, newest first, with each run's status, token usage, step count, and timing. Only Workflow apps record these logs: a Chatflow, Chatbot, Agent, or Text Generator app's key returns an empty page, not an error. For runs started through the API, `created_by_end_user.session_id` is the `User` value sent with that run, which is useful for tracing a run back to its caller and for filtering with `User`. Runs started by a team member inside Dify have `created_by_end_user: null` and an account under `created_by_account` instead. Each entry is a run-level summary; node-by-node execution logs for finished runs aren't available. Example: `Status` `failed`, `Limit` `5` → `{ data: [{ id, created_by_role: "end_user", created_by_end_user: { id, session_id: "user-123", type: "service-api" }, workflow_run: { id, status: "failed", error, total_tokens, elapsed_time } }], page: 1, limit: 5, total: 12, has_more: true }`. If `has_more` is `true`, call again with `Page` incremented by one. [See the documentation](https://docs.dify.ai/en/api-reference/workflow-runs/list-workflow-logs)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `keyword` | `string` | No | Keyword to search for in the logs, e.g. invoice. |
| `status` | `string` | No | Only return runs that ended with this status. |
| `user` | `string` | No | Only return runs started with this User value (Dify calls it the end user's session ID, shown as created_by_end_user.session_id), e.g. user_workflow_123. Omit to see runs from all end users. |
| `createdByAccount` | `string` | No | Only return runs started by the Dify team member with this account email, e.g. name@example.com. Returns an invalid_param error if no account matches. |
| `createdAtAfter` | `string` | No | Only return runs created after this ISO 8601 timestamp, e.g. 2026-01-01T00:00:00Z. |
| `createdAtBefore` | `string` | No | Only return runs created before this ISO 8601 timestamp, e.g. 2026-02-01T00:00:00Z. |
| `page` | `integer` | No | Page number, starting at 1. Keep incrementing while the response's has_more is true. Defaults to 1. |
| `limit` | `integer` | No | Number of results to return per page, between 1 and 100. Defaults to 20. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "dify",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "dify-list-workflow-logs",
  arguments: {
    keyword: "Keyword",
    status: "Status",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "dify-list-workflow-logs",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    dify: { authProvisionId: "apn_xxxxxxx" },
    keyword: "Keyword",
    status: "Status",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "dify-list-workflow-logs",
    "configured_props": {
      "dify": { "authProvisionId": "apn_xxxxxxx" },
      "keyword": "Keyword",
      "status": "Status"
    }
  }'
```

---

- App: https://pipedream.com/apps/dify.md · All apps: https://pipedream.com/apps
