Call API

Overview

Call API makes HTTP requests to external APIs and web services, and stores the response so the rest of your flow can use it.

Note: The variable names, values, criteria, and configuration used in this example are for demonstration purposes only.

Where to find it: Actions in the stage library.

When to Use

  • Connect to third-party services (Slack, Salesforce, Stripe, and so on)
  • Fetch data from external databases or systems
  • Send notifications or updates to external platforms
  • Trigger actions in other applications
  • Retrieve real-time information from web services
  • Submit data to webhooks or API endpoints
  • Integrate with custom-built APIs

Building Apps

Call API is the foundation for building apps on Flows. Apps are pre-built flows that users install and use directly as a single stage in their own flows, after providing their own credentials.

  • Apps package an API integration into a reusable stage
  • Users install an app and enter their own credentials (API keys, tokens, and so on)
  • Once installed, the app appears as a stage in the user's flow builder
  • Apps hide the API details, so anyone can use the integration without configuring it from scratch

Configuration

Fields Reference

FieldRequiredDescriptionExample
URI BaseYesBase path of the API endpoint; must include the protocolhttps://api.slack.com/
URI PathYesThe specific endpoint path after the base URL; no leading slashapi/chat.postMessage
MethodYesHTTP method: GET, POST, PUT, PATCH, or DELETEPOST
Output VariableYesVariable name to store the response in (defaults to body)apiResponse, userData
PayloadNoRequest body for POST, PUT, or PATCH requests{"key": "{{value}}"}
HeadersNoHTTP headers such as Authorization or Content-TypeAuthorization: Bearer {{token}}
Route through Fixed IPNoTurn on if the API requires IP whitelisting (off by default)On / Off
Asynchronous RequestNoSend the request without waiting for a response (off by default)On / Off

Using functions in these fields: Any value field above accepts @ functions, for example @NowSecond for the current time or @calc(...) for a calculation. 

See Flows Functions for the full list.

Exit Points

ExitWhenResponse Data
PassAPI call returned a success status in the 200–208 range (200, 201, 204, and so on)✓ Stored in the output variable
FailAPI returned any other status code: a 3xx redirect, or a 4xx or 5xx error✓ Still stored, so you can inspect and handle it
ErrorNetwork error, unreachable endpoint, invalid URL, or a timeout✗ No response available

About the timeout: a request that runs past the limit (10 seconds normally, 2 seconds when Asynchronous Request is on) takes the Error exit. If the builder shows a separate Timeout dot on this stage, it is not used, connect and handle the Error exit to catch timeouts.

About redirects: a 3xx redirect is not followed automatically. Because a redirect status is not in the 200–208 success range, the call takes the Fail exit. Point your request at the final URL directly rather than relying on a redirect.

How It Works

When executed, the stage:

  1. Builds the URL - Combines URI Base and URI Path, handling the slash between them automatically
  2. Prepares headers - Adds default headers when needed, then applies your custom headers
  3. Sends the request - Uses the method, headers, and payload you configured
  4. Reads the response - Decompresses it if the API sent a compressed response (Gzip and Brotli are supported)
  5. Parses the response - Converts JSON and XML into variables automatically; anything else is stored as raw text
  6. Routes to an exit - Pass for a 200–208 success, Fail for any other status code (3xx, 4xx, 5xx), Error for a network problem or a timeout

Response Format

The response is parsed automatically and stored in your output variable.

Response TypeWhat HappensAccess It With
JSON (most common)Parsed into nested variables automatically{{variable}}.field.subfield, arrays by index: {{variable}}.items.0.name
XMLDetected when the response starts with <, converted to the same format as JSON{{variable}}.field.subfield
Plain text / otherStored as raw text; useful for CSV, HTML, or anything that isn't JSON or XML{{variable}}.NonJSON

Always available: {{variable}}.responseCode (HTTP status code) and {{variable}}.responseMessage (status message, present on error responses).

Common Use Cases

1. Send a Slack Message

  • URI Base: https://slack.com/
  • URI Path: api/chat.postMessage
  • Method: POST
  • Headers: Authorization: Bearer {{slackToken}}
  • Payload: {"channel": "C1234567890", "text": "Hello from Flows!"}

2. Fetch User Data

  • URI Base: https://api.example.com/
  • URI Path: v1/users/{{userId}}
  • Method: GET
  • Headers: X-API-Key: {{apiKey}}

3. Update a Record

  • URI Base: https://crm.example.com/
  • URI Path: api/customers/{{customerId}}
  • Method: PATCH
  • Payload: {"status": "active", "lastContact": "{{currentDate}}"}

Key Behaviors

FeatureBehavior
Timeout10 seconds for a normal request, 2 seconds if Asynchronous Request is on; a timeout takes the Error exit
Compression✓ Gzip and Brotli supported; ✗ Deflate is not supported
Redirects✗ Not followed; a 3xx redirect takes the Fail exit. Call the final URL directly
SSL/TLS✓ Standard certificates work automatically; ✗ Self-signed certificates fail
Retries✗ No automatic retries; add Route Flow and Loop stages if you need them
Response Headers✗ Not included in the output; only the body and status metadata are stored

Do's and Don'ts

Do:

  • ✓ Connect Pass, Fail, and Error so every outcome is handled (a timeout arrives on the Error exit)
  • ✓ Use a meaningful Output Variable name, like userData instead of body
  • ✓ Store tokens and API keys in variables, never hardcoded
  • ✓ Set Content-Type when sending a payload (usually application/json)
  • ✓ Test with a small payload before sending real data
  • ✓ Turn on Route through Fixed IP only when the API requires whitelisting

Don't:

  • ✗ Leave a trailing slash on URI Base and a leading slash on URI Path at the same time
  • ✗ Forget authentication headers; this causes 401 or 403 errors
  • ✗ Send a payload with a GET request; use variables in the URI Path instead
  • ✗ Skip handling the Fail exit; 4xx and 5xx errors still need a path
  • ✗ Assume every call succeeds; connect Error and Timeout too

Troubleshooting

IssueCommon CauseFix
Double slash in the URLURI Base ends with / and URI Path also starts with /Remove the leading slash from URI Path
401 or 403 errorsMissing or incorrect authentication headerAdd the required header, such as Authorization or an API key
API rejects the requestContent-Type doesn't match the payload formatSet Content-Type to match your payload (usually application/json)
GET request fails with a bodyThe API rejects GET requests that include a payloadMove the data into the URI Path as variables instead
Flow stops after the API callThe Fail exit isn't connectedConnect Fail to handle 4xx and 5xx responses
Variable not replaced in the URL or payloadIncorrect variable syntaxUse {{variableName}} for every variable reference
Connection timeoutAPI endpoint is slow or unreachableCheck the URI Base, verify connectivity, and connect the Error exit (timeouts take the Error path)
Rate limit errors (429)Too many requests sent to the APIAdd delay stages between calls, and handle it on the Fail exit

Edge Cases

  • Empty responses (204 No Content): Handled without error; {{variable}}.responseCode is 204 and no body is stored
  • Deflate compression: Not supported; use an API that returns Gzip, Brotli, or plain text instead
  • Asynchronous mode: Sends the request in the background and doesn't wait for or return a response; errors are logged but don't stop the flow
  • Large responses: No fixed size limit, but very large payloads can slow down your flow

Related Stages

  • Fetch Data: Retrieve stored data from flow storage instead of external APIs
  • Save Data: Store API responses for later use
  • Route Flow: Make decisions based on API response values
  • Change Data: Transform API response data before using it
  • Loop: Process multiple API calls for array data