Using fetch-url and api-call steps
Using fetch-url and api-call steps
Use Fetch URL for HTTP requests and page retrieval. Use Make API Call for JSON API requests that need response mapping. Both steps support GET, POST, PUT, DELETE, and PATCH requests, custom headers, request bodies, templates, and output variables.
Open a flow in the Flow editor to add either step. Rename a step in its header, then set its result variable in Output variable. New Fetch URL and Make API Call steps use fetch_result and api_result as their default output variables.
Before you begin
Open a flow in the Flow editor. If a request needs credentials, create a secret in Managing secrets before you configure the step.
Fetch URL step
Fetch URL sends a standard HTTP request or retrieves page content through Firecrawl.
Add a Fetch URL step
To add a Fetch URL step, follow these steps:
- In the Flow editor, click Add Step.
- Select Fetch URL.
- In the Fetch selector, choose Standard HTTP or Firecrawl (Web Scraping).
Standard HTTP mode
Configure the following fields for a standard HTTP request:
- URL: enter the endpoint URL. You can include flow variables such as
{{PRODUCT_ID}}. - Method: choose
GET,POST,PUT,DELETE, orPATCH. The default isGET. - Body: enter the request payload for
POST,PUT, orPATCH. Changing the method toGETorDELETEhides this field without clearing its stored value. - Response type: choose JSON or Text/HTML. When you choose Text/HTML, enable Prefer Markdown when available to request Markdown before HTML or text.
- Headers: add key-value pairs in the advanced Headers settings.
Use a URL template when a flow variable supplies part of the endpoint:
Replace PRODUCT_ID with the name of the flow variable that contains the product ID.
Firecrawl mode
Choose Firecrawl (Web Scraping) when you need page content in one or more output formats.
Configure the following Firecrawl options:
- Formats: choose one or more of Markdown, HTML, Raw HTML, Screenshot, Links, or JSON.
- Extract main content only: request the page’s main content without its surrounding navigation.
- JSON extraction: when you select JSON, enter a JSON schema or describe the data to extract.
- Advanced settings: configure result caching,
maxAge, country, and languages.
Make API Call step
Make API Call sends an HTTP request and parses the response as JSON. Use responseMapping to select fields from the JSON response when you define the step through the API or SDK.
Add a Make API Call step
To add a Make API Call step, follow these steps:
- In the Flow editor, click Add Step.
- Select Make API Call.
- Configure the method, URL, request body, and headers.
Configure the following fields for the step:
- Method: choose
GET,POST,PUT,DELETE, orPATCH. - URL: enter the endpoint URL.
- Body: enter the request body for
POST,PUT, orPATCH. - Headers: add key-value pairs in the advanced Headers settings.
Set headers
Add headers as key-value pairs in either step’s Headers settings. This example uses a managed secret and a flow variable:
Replace API_KEY with the name of your managed secret and CUSTOM_HEADER_VALUE with the name of a flow variable.
Set the request body
For POST, PUT, or PATCH requests, enter a request body. JSON is a common format:
Replace CUSTOMER_NAME, ORDER_ITEMS, and CALCULATE_TOTAL with the names of flow variables.
Configure authentication
Use headers for authentication in the Flow editor. Flow definitions can also set the auth configuration. Store credentials as managed secrets instead of writing them directly in a Flow.
Use a bearer token
Send a bearer token in the Authorization header:
Replace API_KEY with the name of the managed secret that stores the token.
Use Basic auth
Encode the USERNAME:PASSWORD string as base64, then send the result in the Authorization header:
Replace BASE64_CREDENTIALS with the encoded credentials. Store the encoded value in a managed secret instead of hardcoding it.
Send an API key in a header
Send an API key in a header that the external service accepts:
Replace API_KEY with the name of the managed secret that stores the API key.
Handle responses
Each step stores its result under the configured Output variable. Fetch URL stores either a parsed JSON value or text. Make API Call stores the full parsed JSON response unless responseMapping selects fields.
Reference a full result or a nested property in a later step:
Replace API_RESPONSE with the output variable name and DATA with a property in the response.
Handle errors
To choose how a step responds to an error, open its Error handling control and choose Continue on error, Stop on error, or Use fallbacks. Add a Conditional Logic step when you need to inspect the result before the next step runs.
Build dynamic URLs
Build a URL from flow variables when the endpoint depends on earlier data:
Replace RESOURCE, ITEM_ID, and SEARCH_TERM with the names of flow variables.
Rate-limit requests
Add a Wait Until step between requests when an external API limits request frequency. Use this sequence:
- Add a Fetch URL or Make API Call step.
- Add a Wait Until step and set
delayMsto1000for a one-second pause. - Add the next Fetch URL or Make API Call step.
Test a step
Test an HTTP step with the inputs from the most recent flow run. Run the flow at least once before you test a step. The test uses the current step configuration, including unsaved edits, and does not save its output to run history.
To test a step, follow these steps:
- Run the flow once.
- Open the step’s action menu.
- Choose Test with last run.
- Review Previous output and New output in the test panel.
- If Runtype asks you to confirm side effects, review the warning and click Run anyway.
Apply best practices
Apply these practices when you build HTTP steps:
- Validate responses: check status codes and expected fields before using response data.
- Handle errors: configure step-level error handling and use conditional logic for fallbacks.
- Protect secrets: reference credentials with
{{secret:SECRET_NAME}}instead of hardcoding them. - Choose the right step: use Fetch URL for direct HTTP requests or page content, and use Make API Call for JSON API requests.
Next steps
Continue with these guides:
- Using transform-data steps: process fetched data.
- Using conditional steps: branch on response values.
- Flow variables and templates: build dynamic requests.
- Managing secrets: store credentials for HTTP requests.