---
title: "DAG Planner Streaming"
method: POST
path: "/api/dag"
tags: ["Chat"]
---

# DAG Planner Streaming

`POST /api/dag`

Stream a conversation through a DAG planner. Returns Server-Sent Events with planning phases, step execution, and analysis.

## Request body

- ChatStreamRequest
  - `q` string, required — The user query or message
  - `conversation_id` string, nullable — Attach to an existing conversation (optional)
  - `agent_id` string, nullable — Bind to a specific agent (optional)
  - `token` string, nullable — API key (fim_xxx) or JWT token for SSE (optional, alternative to Authorization header)
  - `image_ids` string, nullable — Comma-separated image IDs to attach (optional)
  - `user_metadata` string, nullable — JSON string of custom metadata (optional)

## Response `200`

Server-Sent Events stream with DAG execution events

## Other responses

- `401` — Unauthorized (invalid or missing token)
- `404` — Conversation or agent not found

---

[API](https://skmtc.dev/fim-ai/apis/fim-one-api.md) · [All operations](https://skmtc.dev/fim-ai/apis/fim-one-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fim-ai/fim-one-api/revisions/6832c00d58dc/schema)
