---
title: "Responding to the Caller"
url: https://flexie.io/resources/dynamic-endpoints/responding
description: "An endpoint can reply to whatever called it. There are five ways, from a fixed \"thanks, received\" to a live streamed response computed by the workflow."
---

# Responding to the Caller

Last updated 23 May 2026

![A workflow producing five different responses, data, html, redirect, continue, and an SSE stream](https://flexie.io/image/resources/dynamic-endpoints-responding.png)

The reply is controlled by the endpoint listener's **response type** (`return_type`), set when [creating the endpoint](https://flexie.io/resources/dynamic-endpoints/creating-an-endpoint). All response bodies support [Flexie Scripting](https://flexie.io/resources/flexie-scripting/overview), so they can include the incoming data and anything your steps produced.

## The five response types

### 1\. `data`, a body you define

Return a fixed (or token-filled) body. Flexie auto-detects whether it is **JSON**, **XML**, or **HTML** and sets the content type accordingly. Returned with HTTP 200.

Field: **`return_data`**.

```json
{ "status": "received", "ref": "{{ __data.case_ref }}" }

```

This is the default choice for webhooks: acknowledge receipt and optionally echo back an id your workflow created.

### 2\. `html`, an HTML page

Return an HTML page. Useful when a browser hits the endpoint and you want to show something.

Field: **`return_html`**.

```html
<html><body><h1>Thanks, {{ __data.first_name }}</h1></body></html>

```

### 3\. `redirect`, send the caller elsewhere

Return a redirect to a URL you specify (HTTP 302). Useful for "submit, then go to a thank-you page."

Field: **`return_redirect`**.

```
https://example.com/thank-you?ref={{ __data.case_ref }}

```

### 4\. `continue`, let the workflow decide the reply

Instead of a fixed response, the reply is produced **by a step inside the workflow**: the **endpoint response** action. Use this when the answer depends on what the workflow finds or computes, different replies down different branches.

How it works:

* Add an **endpoint response** action at the point in the tree where you know the answer. It has its own `return_type` (**data**, **html**, or **redirect**) and the matching body or URL field.
* The workflow runs, reaches that action, and the action's output becomes the caller's response.

Timing depends on the workflow's [run mode](https://flexie.io/resources/workflows/runtime-parallel-and-tree):

* **Sync workflow:** the endpoint holds the request open and returns the moment the response action fires, a true request and response.
* **Async workflow:** the endpoint waits for the response for up to **20 seconds**. If the response action fires within that window, the caller gets it; if not, the request times out. For reliable `continue` responses, prefer a **Sync** workflow so the reply is produced within the request.

### 5\. `sse`, a live, streamed response

Stream a response as a sequence of events (Server-Sent Events), for progressive output, such as a long-running computation or AI output appearing piece by piece. The workflow's steps emit frames as they run, and a final frame closes the stream.

> **`sse` requires the workflow to be in Sync mode.** An Async workflow has nowhere to stream to. Set the run mode to **Sync** before relying on streaming.

## Choosing

| You want…                                       | Use                          |
| ----------------------------------------------- | ---------------------------- |
| A fixed acknowledgement or echo                 | **data**                     |
| To show a web page                              | **html**                     |
| To bounce the caller to another URL             | **redirect**                 |
| A reply that depends on what the workflow finds | **continue** (Sync workflow) |
| Progressive or streamed output                  | **sse** (Sync workflow)      |

## A reminder on security

The response can include incoming data and computed values. Be careful not to echo back anything sensitive to an unauthenticated caller. If the endpoint returns data that matters, protect it with [authentication](https://flexie.io/resources/dynamic-endpoints/creating-an-endpoint).

## Next steps

* [End-to-end examples](https://flexie.io/resources/dynamic-endpoints/examples): responses in complete round trips.
* [Creating an endpoint](https://flexie.io/resources/dynamic-endpoints/creating-an-endpoint): where the response type is set.
