Control the Response Returned by an Okta Workflows Flow
Last Updated:
Overview
When an external client invokes an Okta Workflows flow, the client receives the output of the flow’s execution. By default, the response is determined by the last card that executes in the flow and the specific output fields defined on that card.
Administrators can use control cards, such as the Return or Return Raw card, to override default outputs and define exactly which values are returned to the caller.
Applies To
- Okta Workflows
Solution
What does a flow return to the caller?
The flow structure and the presence of explicit return cards determine the response Okta sends to the caller.
-
Default Behavior: The flow automatically returns the output of the last card executed in the primary flow’s execution. If the last executed card has output fields defined, those specific fields and their values are returned to the caller. If the last card has no output fields defined, no additional data is returned.
-
Using a Return Card: If the flow contains a Return or Return Raw card, the execution stops immediately, and the response is strictly limited to the specific values configured on that card.
-
Using a Close Card: The Close card can send a response to the caller immediately, but unlike Return cards, it does not halt the flow's ongoing execution.
As a best practice, Okta recommends explicitly defining your workflows' responses to minimize the data returned to what is necessary.
How can administrators explicitly define the response with a Return card?
- Open the Okta Workflows console and open a flow.
- Identify each logical path that ends the flow.
- From the Flow Control category, add a Return card at the end of each path.
- On the Return card, create fields manually for each value the caller needs, or drag output fields from other cards onto the Return card (the Return card has no input fields by default).
- Run the flow by invoking the endpoint and review the execution history to confirm it contains only the intended, configured values.
The following images show a Return card configured with specific input fields and the resulting execution history, which shows the values passed to the caller.
Following best practices
Review these practices for flows:
- Define the response explicitly:
Use a Return or Return Raw card to set the exact values sent back to the caller. - Return only what the caller needs:
Include only the values the calling client uses. If the caller only needs the outcome, return a single value such as success or failure. - Cover each path:
Add a Return card to each logical path that ends the flow to avoid unexpected responses.
