studio-web
latest
false
UiPath logo, featuring letters U and I in white

Studio Web User Guide

Last updated Aug 6, 2025

Response

The Response activity terminates an API workflow and sends a structured response to the requester. The response typically includes a status and additional data.

Use the Response activity to:

  • Always return the correct status and response details.
  • End workflows with a clear and structured result.
  • Handle errors gracefully, especially when combined with the Try-Catch activity.

The Response activity should be the final step in a workflow, to ensure the process provides the intended information.

Important: If you do not add a Response activity, the workflow returns the response from the last executed request. If an error occurs, the workflow returns the error details instead.

Using Response activity

To add a Response activity to your workflow:
  1. On your API workflow designer canvas, select the plus (+) icon. The Add activity menu appears.
  2. Select Response.
  3. In the Properties panel, configure the following fields:
    • Type
      • Select Success when the workflow completes successfully and returns the expected response.
      • Select Failure when the workflow encounters an error or lacks the necessary data for a successful response.
    • Details—Use the Expression editor to define a JSON object containing the desired response information.
  4. Save the configuration.

Response activity example

The following example retrieves a worker from Workday and aggregates details about their manager and direct reports.

The following image displays the example workflow:

Workday workflow

The Failure response

The workflow returns a Failure status with an error message if any retrieval step fails.

To achieve this:

  • Wrap the retrieval steps inside a Try-Catch block.
  • If an error occurs, the Error Response step in the Catch flow returns a structured failure response.
Configure the Response with the following details:
  • Type—Failure
  • Details—Open the Expression editor and write the following:
    ({
        "error_message": $context.outputs.Try_Catch_3.error.title,
        "status": $context.outputs.Try_Catch_3.error.status
    })({
        "error_message": $context.outputs.Try_Catch_3.error.title,
        "status": $context.outputs.Try_Catch_3.error.status
    })
    Here, $context.outputs.Try_Catch_3.error provides a structured error output from the Try-Catch activity. When the Try flow encounters an error during execution, the workflow returns the following output:
    Failure response output

The Success response

The workflow returns a Success status with the aggregated worker information. The Search Workers by Name or ID activity returns an array, even when ther is only one match. There, we use a For Each activity to process each result, and then consolidate the data using a Script activity.

Configure the Response with the following details:
  • Type—Success
  • Details—Open the Expression editor and write the following:
    ({
        "workers": $context.outputs.For_Each_2.results
    })({
        "workers": $context.outputs.For_Each_2.results
    })
    Here, workers contains the aggregated output from the Script step of the For Each loop. The workflow returns the following output:
    Success response output
  • Response
  • Using Response activity
  • Response activity example
  • The Failure response
  • The Success response

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo
Trust and Security
© 2005-2025 UiPath. All rights reserved.