FluxyAPIFluxyAPI
BlocksCore Functions

Response Block

Send the final HTTP response back to the client.

Response Block

The Response Block is used to terminate a flow by sending a final response back to the client that made the request. Once this block is executed, the request is considered fulfilled, and no further blocks in the flow can send another response.

Core Concept

Imagine an endpoint as a customer service desk. The client (customer) makes a request, and your flow processes it. The Response Block is the moment you hand the result (or an error message) back to the customer. Once you've handed it over, the transaction is finished.

Configuration

FieldRequiredDescription
Status CodeThe HTTP status code to send (e.g., 200 for success, 404 for not found, 500 for internal error).
CookiesA list of cookies to set in the client's browser.
HeadersCustom HTTP headers to include in the response (e.g., Content-Type, X-Custom-Header).
Response BodyThe content sent back to the client. This can be text, a JSON object, or a variable like {my_result}.

When adding cookies, you can configure the following:

  • Cookie Name: The key used to identify the cookie.
  • Cookie Value: The data stored in the cookie.
  • Path: Usually / to make it available across the whole site.
  • Max Age: How long the cookie lasts (e.g., 30s, 5min, 12h, 7d).
Automatic JSON Detection

If the Response Body contains a JSON object or a variable that holds an object, FluxyAPI will automatically set the Content-Type to application/json.

Response Already Sent

Ensure that only one Response Block is reachable in any given path of your flow. If the flow attempts to execute a second response block, it will trigger an error.

Error Handling

  • FIELD_MISSING — Triggered when the Status Code is not provided.
  • INVALID_STATUS_CODE — Triggered when the status code is not a valid integer between 100 and 599.
  • INVALID_COOKIE — Triggered when a cookie is missing a required name, value, or path.
  • INVALID_HEADER — Triggered when a header name or value is missing.
  • RESPONSE_ALREADY_SENT — Triggered if the request has already been responded to by a previous block.
  • RUNTIME_ERROR — Triggered if an unexpected error occurs while sending the response.

(Note: These errors do not populate an Output Variable. They terminate the flow via the error edge.)

Example

Sending a successful JSON response with a custom header:

  1. Add the Response Block to the end of your flow.
  2. Set Status Code to 200.
  3. In the Headers section, add a header with name X-Powered-By and value FluxyAPI.
  4. Set the Response Body to { "status": "ok", "data": {result_var} }.
  5. When the endpoint is called, the client will receive the JSON data and the custom header.

On this page