---
title: "convert_session_to_workflow"
method: POST
path: "/convert_session_to_workflow"
tags: ["session_to_workflow"]
---

# convert_session_to_workflow

`POST /convert_session_to_workflow`

## Request

- Base URL: `https://app.podmule.com/api/v1`
- URL: `https://app.podmule.com/api/v1/convert_session_to_workflow`
- Auth: HTTP bearer

Convert a chat session into a saved workflow. Reads recent successful capability calls for the conversation, emits them as call_capability action steps, and saves the workflow with disabled: true so the user reviews + enables in the workflow editor. Do not call this as the first response to "make this a workflow": first review the chat transcript/tool sequence, ask any missing questions, and confirm the reusable workflow definition (trigger/context, runtime inputs, reusable read/search steps, generation contract, writes, and review state). By default only mutating calls (writes) become workflow steps — discovery reads (list_*, search_*, get_*) are filtered as exploration scaffolding (set mutates_only: false to include them). Detects runs of N consecutive same-capability calls (a strong "for-each" signal) and surfaces them as loop_candidates so the user can consolidate by hand; native for_each step kind ships in v3. Use parameterise=["key1", "key2"] to lift specific argument keys into runtime inputs (replacing the captured value with {{input.key}}). Output flags truncated/reads_excluded/loop_candidates so the caller knows what got dropped or batched. Use this only when the confirmed plan is faithfully represented by the captured trace; otherwise create or edit the workflow from the plan. If compression fails and the saved literal trace would omit required read/generation steps, tell the user and ask whether they accept a literal disabled draft before treating it as the reusable workflow.

## Request body

- unknown

## Response `200`

Capability output wrapped in `{ data }`.

- object
  - `data` unknown, required

## Other responses

- `400`: Invalid input — Zod validation failed.
- `401`: Missing, malformed, or audience-mismatched bearer token.
- `403`: Token is valid but lacks the required scope.
- `404`: Capability not registered, or referenced resource not found.
- `429`: Rate limit exceeded. Retry after the period in `Retry-After`.
- `500`: Internal error.

---

[API](https://skmtc.dev/podmule/apis/podmule-api.md) · [All operations](https://skmtc.dev/podmule/apis/podmule-api/llms.txt) · [OpenAPI document](https://skmtc.dev/podmule/apis/podmule-api/revisions/844ae61495fa?raw)
