---
title: "Retrieve chat messages for a step in a sub DAG-run"
method: GET
path: "/dag-runs/{name}/{dagRunId}/sub-dag-runs/{subDAGRunId}/steps/{stepName}/messages"
tags: ["dag-runs"]
---

# Retrieve chat messages for a step in a sub DAG-run

`GET /dag-runs/{name}/{dagRunId}/sub-dag-runs/{subDAGRunId}/steps/{stepName}/messages`

## Request

- Base URL: `http://localhost/api/v1`
- URL: `http://localhost/api/v1/dag-runs/{name}/{dagRunId}/sub-dag-runs/{subDAGRunId}/steps/{stepName}/messages`
- Auth: one of:
  - HTTP bearer
  - HTTP basic
  - none

Fetches the LLM chat message history for a chat step in a sub DAG-run. Returns empty array for non-chat steps.

## Path parameters

- `name` string, regex, required: Name of the DAG
- `dagRunId` string, required: Unique identifier for the DAG-run. The special value 'latest' can be used to reference the most recent DAG-run.
- `subDAGRunId` string, required
- `stepName` string, required

## Query parameters

- `remoteNode` string

## Response `200`

Chat messages retrieved successfully

- ChatMessagesResponse: Response containing chat messages for a step
  - `messages` ChatMessage[], required: List of chat messages
    - `role` 'system' | 'user' | 'assistant' | 'tool', required: Message role in the session
    - `content` string, required: Message content
    - `toolCalls` ChatToolCall[]: Tool calls made by the assistant (only for assistant messages)
      - `id` string, required: Unique identifier for this tool call
      - `name` string, required: Name of the tool being called
      - `arguments` string: JSON string of tool arguments
    - `metadata` ChatMessageMetadata: Metadata about an LLM API call
      - `provider` string: LLM provider (openai, anthropic, gemini, etc.)
      - `model` string: Model identifier used
      - `promptTokens` integer: Number of tokens in the prompt
      - `completionTokens` integer: Number of tokens in the completion
      - `totalTokens` integer: Total tokens (prompt + completion)
  - `toolDefinitions` ToolDefinition[]: Tool definitions that were available to the LLM
    - `name` string, required: Name of the tool
    - `description` string: Description of what the tool does
    - `parameters` object: JSON Schema describing the tool's parameters
  - `stepStatus` 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9, required: Numeric status code indicating current node state: 0: "Not started" 1: "Running" 2: "Failed" 3: "Aborted" 4: "Success" 5: "Skipped" 6: "Partial Success" 7: "Waiting for manual action" 8: "Rejected" 9: "Retrying"
  - `stepStatusLabel` 'not_started' | 'running' | 'failed' | 'aborted' | 'succeeded' | 'skipped' | 'partially_succeeded' | 'waiting' | 'rejected' | 'retrying', required: Human-readable status description for the node
  - `hasMore` boolean, required: True if step is still running and more messages may arrive

## Other responses

- `404`: Sub DAG-run or step not found
- `default`: Generic error response

## Changes

> 208 revisions in range; 1 not diffed.

- **2026-07-23** (v1) `75b8e91aaf57`: 6 warning
  - added the new `conflict` enum value to the `code` response property for the response status `404`
  - added the new `conflict` enum value to the `code` response property for the response status `default`
  - added the new `human_task_resume_failed` enum value to the `code` response property for the response status `404`
  - added the new `human_task_resume_failed` enum value to the `code` response property for the response status `default`
  - …2 more
- **2026-05-24** (v1) `8a2d5d3e9608`: 2 warning
  - added the new `rate_limited` enum value to the `code` response property for the response status `404`
  - added the new `rate_limited` enum value to the `code` response property for the response status `default`
- **2026-03-19** (v1) `ae16c384ffe1`: 2 warning
  - added the new `9.00` enum value to the `stepStatus` response property for the response status `200`
  - added the new `retrying` enum value to the `stepStatusLabel` response property for the response status `200`
- **2026-02-04** (v1) `a047d6ba27d5`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/dagucloud/apis/dagu/changes/dag-runs/:name/:dagRunId/sub-dag-runs/:subDAGRunId/steps/:stepName/messages/get.md)

---

[API](https://skmtc.dev/dagucloud/apis/dagu.md) - [All operations](https://skmtc.dev/dagucloud/apis/dagu/llms.txt) - [OpenAPI document](https://skmtc.dev/dagucloud/apis/dagu/revisions/742c8ecb39ce?raw)
