Documentation
HomeAPISign In
  • Getting Started
    • Overview
      • Core Concepts
      • Building your First Workflow
    • API Reference
  • Your Data
    • Brand Kits
    • Knowledge Bases
      • Add Data
        • Upload Files
        • Web Scrape
        • Import from Google Drive
        • Import from SQL Database
        • Import from Shopify
      • Knowledge Base Search
      • Knowledge Base Metadata
      • Knowledge Base API
  • Building Workflows
    • Workflow Concepts
      • Workflow Inputs
        • Input Types
      • Workflow Outputs
      • Variable Referencing
      • Liquid Templating
    • Workflow Steps
      • AI
        • Prompt LLM
          • Model Selection Guide
          • Prompting Guide
        • Transcribe Audio File
      • Web Research
        • Google Search
        • Web Page Scrape
      • Code
        • Run Code
        • Call API
        • Format JSON
        • Run SQL Query
        • Write Liquid Text
      • Flow
        • Condition
        • Iteration
        • Human Review
        • Content Comparison
        • Error
      • Data
        • Read from Grid
        • Write to Grid
        • Search Knowledge Base
        • Write to Knowledge Base
        • Get Knowledge Base File
      • AirOps
        • Workflow
        • Agent
      • Image & Video
        • Generate Image with API
        • Search Stock Images
        • Fetch Stock Image with ID
        • Resize Image
        • Screenshot from URL
        • Create OpenGraph Image
        • Create Video Avatar
      • SEO Research
        • Semrush
        • Data4SEO
      • Content Quality
        • Detect AI Content
        • Scan Content for Plagiarism
      • Content Processing
        • Convert Markdown to HTML
        • Convert PDF URL to Text
        • Group Keywords into Clusters
      • B2B Enrichment
        • Hunter.io
        • People Data Labs
      • CMS Integrations
        • Webflow
        • WordPress
        • Shopify
        • Contentful
        • Sanity
        • Strapi
      • Analytics Integrations
        • Google Search Console
      • Collaboration Integrations
        • Gmail
        • Google Docs
        • Google Sheets
        • Notion
        • Slack
    • Testing and Iteration
    • Publishing and Versioning
  • Running Workflows
    • Run Once
    • Run in Bulk (Grid)
    • Run via API
    • Run via Trigger
      • Incoming Webhook Trigger
      • Zapier
    • Run on a Schedule
    • Error Handling
  • Grids
    • Create a Grid
      • Import from Webflow
      • Import from Wordpress
      • Import from Semrush
      • Import from Google Search Console
    • Add Columns in the Grid
    • Run Workflows in the Grid
      • Add Workflow Column
      • Run Workflow Column
      • Map Workflow Outputs
      • Review Workflow Run Metadata
    • Review Content in the Grid
      • Review Markdown Content
      • Review HTML Content
      • Compare Content Difference
    • Publish to CMS from Grid
    • Pull Analytics in the Grid
    • Export as CSV
  • Copilot
    • Chat with Copilot
    • Edit Workflows with Copilot
    • Fix Errors with Copilot
  • Monitoring
    • Task Usage
    • Analytics
    • Alerts
    • Execution History
  • Your Workspace
    • Create a Workspace
    • Folders
    • Settings
    • Billing
    • Use your own LLM API Keys
    • Secrets
    • Team and Permissions
  • Chat Agents (Legacy)
    • Agent Quick Start
    • Chat Agents
    • Integrate Agents
      • Widget
      • Client Web SDK
  • About
    • Ethical AI and IP Production
    • Principles
    • Security and Compliance
Powered by GitBook
On this page
  • Configuration
  • Reference Inputs or Outputs in the API Step
  • How to continue if the API step fails
  • How to retry if the API step fails
  • Need more control?

Was this helpful?

  1. Building Workflows
  2. Workflow Steps
  3. Code

Call API

Call external API's in your workflow

The "API" Utility Step allows your AirOps Workflows to communicate with external services via their APIs. This allows you to integrate and interact with data and functionalities that are outside of your Workflow.

Configuration

There are two types of request method that we support, read the API docs for your integration to find out the best method to use :

  • GET Requests:

    • This type of request is generally used to retrieve data from a service

  • POST Requests:

    • A POST request is used to push data to a service

    • This is typically used when you want to create or update data on the server

    • For instance, you may want to create a new record in a database or update a user's profile information

Reference Inputs or Outputs in the API Step

To dynamically set variables in your API and reference an input (defined in the "Start" step) or output variable (generated by any step), you will need to use Liquid syntax. Additionally, you will need to specify your Headers and Body values.

Headers

For passing in your header value, it is important that you format the information as JSON. We will always set our Content-Type as shown below, and you can include the API Key for any calls that require authorization:

{ 
    "authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

Body

The body allows us to specify any additional parameters (i.e. variables or outputs) to be included in the API call. We use the same syntax as the header, where both our keys and values are wrapped in quotes. If we're passing in any inputs or step outputs, we use Liquid syntax while still wrapping with double-quotes, e.g.

{
  "properties": {
    "amount": "",
    "dealname": "{{ step_2.output.deal_name }}",
    "pipeline": "",
    "closedate": "{{ step_2.output.deal_close_date }}",
    "dealstage": "",
    "hubspot_owner_id": ""
  }
}

Examples

Let's put this all together with a couple of examples. If you have a user input defined as location at the start of your Workflow, you can include {{ location }} in the URL or body of your API step to make a request to a weather API:

GET https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&query={{ location }}

Similarly, you can use outputs from other steps as variables. If you have a step that retrieves a user's ID, you can use the output of that step as a variable in the API step:

POST https://api.example.com/user/{{ step_1.output }}/profile

This enables you to create dynamic API requests that adjust based on the inputs and outputs in your workflow. As an example, you can reference the API Step shown in our "Sales Call Lead Qualifier" template shown below:

How to continue if the API step fails

By default, the API step will terminate the workflow if it fails. However, to continue the workflow if the step fails, simply click Continue at the bottom of the step.

The step will return the following keys:

  • output : this will be null

  • error :

    • message: the message returned from the step

    • code : the error code representing the error

How to retry if the API step fails

You can retry the API step up to 3 times by clicking on Advanced Settings

However, if the step still failed after 3 retries, you may:

  1. Select Continue instead of Terminate Workflow if the step fails

  2. Add a conditional where the condition checks if the error from the step exists e.g. step_1.error

  3. Add the step that you want to retry if there was an error

Need more control?

Last updated 10 months ago

Was this helpful?

For advanced API requests, use our Python step with custom code, using the , which can make external requests.

Code Step
Our API Step calls the Fireflies API
Click continue to continue the workflow