Use files in a workflow
  • 30 Jan 2023
  • 2 Minutes to read
  • Dark
    Light

Use files in a workflow

  • Dark
    Light

Article Summary

You can use files in workflows by passing the file links between steps. By default, links to files that are the output of step executions can only be used in Torq steps. This means the file links can't be opened in a browser or shared with external services. There is an option to make the file link shareable.

Here are some common ways to use files in workflows:

Important to know

  • The format for links to files that are outputs of step executions: tqfile://steps/XXXXXXX
  • File links can't be shared externally. They can only be passed in Torq steps using the inline function file.
    Example: {{ file $.send_an_http_request.api_object.url  }}
  • Other file links are signed URLs and have this format: https://link.torq.io/****dEjnLCXnv7. These file links can be shared externally and used in Torq steps without using the inline function file.

Supported steps

You can return the response as a file for the following steps: 

  • Send an HTTP request
  • Any step that you can switch to HTTP mode

Share a file outside of Torq

These instructions explain how to get a signed URL for a file stored in Torq in order to share outside of Torq.

  1. In the step Execution Options section, set the Return response as file toggle to Yes.
  2. Set the Shareable link toggle to Yes.

Set Return Response As File to Yes

File expiration
A file is available for 24 hours. After 24 hours it's deleted. To change the file expiration period, contact Torq support.

Example use case

This example shows how to use a non-shareable file URL in a subsequent step.

  1. Add the step Send an HTTP request step to the designer.
  2. Under Execution Options, set the Return response as file toggle to Yes.
    How to return a step response as a shareable link file.
  3. Run the step. The file URL is available in the step output in the Execution Log. The file URL can only be used in Torq steps.
    file-url-step-output
  4. To extract data from the file, use this expression {{ file $.send_an_http_request.api_object.url }}
    JSON expression used to extract data from the file in a step.

Use files in inline scripts

To access the content of a file in an inline script, you first need to apply the Get method to the file URL.

The example below shows a Python inline script, but the same applies to other scripting languages, such as JavaScript, Bash, and so on.

Use the file inline function for non-shareable file URLs that have the format: tqfile://steps/XXXXXXX.

Use a non-shareable file URL in an inline script.

Shareable URLs that don't require the file inline function: https://link.torq.io/***dEjnLCXnv7.

Use a shareable file URL in an inline script

Upload a file using an HTTP request step

Use an HTTP request step to upload a Torq file to an external system.

  1. Add a Send an HTTP request step to the designer.
  2. Set the METHOD to POST.
  3. Add a header to the HEADERS section if you want the file to be interpreted in a specific format (for example, to suit the third-party service requirements).
    1. Key: content-type
    2. Value: file format
  4. Set the body CONTENT_TYPE parameter to raw binary.
  5. Set the BODY to the file URL. For example, {{ file $.prev_step_name.api_object.url }}. Use the file inline function for non-shareable links.

How to upload a file using an HTTP request step


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.