---
title: "API"
description: "Call an HTTP URL with method, headers, query, and body."
canonical_url: "https://docs.vettero.com/build/workflows/blocks/utility/api"
---
# API

> Call an HTTP URL with method, headers, query, and body.

<block-meta block="Yes" channels="Any" folder="basic/utility" group="Utility" groupTo="/build/workflows/blocks/utility" icon="i-lucide-globe" pipe="Value" scope="Any" tool="No" type="act.api">



</block-meta>

**API** performs an HTTP request. **URL**, query keys, headers, and body fields can be literals or context variables. The response is written to the data pipe.

## Configure

<table>
<thead>
  <tr>
    <th>
      Setting
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Method
      </strong>
    </td>
    
    <td>
      GET, POST, PUT, PATCH, or DELETE
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        URL
      </strong>
    </td>
    
    <td>
      Request address (required)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Query parameters
      </strong>
    </td>
    
    <td>
      Key/value pairs appended to the URL
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Headers
      </strong>
    </td>
    
    <td>
      Key/value request headers
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Content type
      </strong>
    </td>
    
    <td>
      <strong>
        None
      </strong>
      
      , <strong>
        JSON
      </strong>
      
      , <strong>
        Form data
      </strong>
      
      , <strong>
        URL encoded
      </strong>
      
      , <strong>
        Text
      </strong>
      
      , or <strong>
        XML
      </strong>
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        JSON body format
      </strong>
    </td>
    
    <td>
      For JSON: <strong>
        Object builder
      </strong>
      
       or <strong>
        Raw JSON (variables)
      </strong>
    </td>
  </tr>
  
  <tr>
    <td>
      Body
    </td>
    
    <td>
      Form rows, raw text/XML, or JSON — depending on <strong>
        Content type
      </strong>
    </td>
  </tr>
</tbody>
</table>

## Handles

<table>
<thead>
  <tr>
    <th>
      Handle
    </th>
    
    <th>
      Role
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        In
      </strong>
      
       (target)
    </td>
    
    <td>
      Incoming connection
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Out
      </strong>
      
       (source)
    </td>
    
    <td>
      Continues after the response
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Error
      </strong>
    </td>
    
    <td>
      Catchable failures: private/loopback URL (<code>
        LOOPBACK_URL_BLOCKED
      </code>
      
      ), invalid URL (<code>
        INVALID_SERVER_URL
      </code>
      
      ), or request failure (<code>
        API_REQUEST_FAILED
      </code>
      
      )
    </td>
  </tr>
</tbody>
</table>

Connect [Branch errors](https://docs.vettero.com/build/workflows/blocks/error/branch) to **Error** to split those codes. Unlisted codes still go to **Other**.

## Pipe schema

The next block reads this on the data pipe (`pipe.value`). The value is an object:

<table>
<thead>
  <tr>
    <th>
      Key
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      number
    </td>
    
    <td>
      HTTP status code
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data
      </code>
    </td>
    
    <td>
      any
    </td>
    
    <td>
      Response body
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        headers
      </code>
    </td>
    
    <td>
      object
    </td>
    
    <td>
      Response headers (text values)
    </td>
  </tr>
</tbody>
</table>

Use [Bind Pipe](https://docs.vettero.com/build/workflows/blocks/context/bind-pipe) if you need to keep the response under a name while the next block still reads `pipe.value`.

## Use case

- Call an internal or third-party HTTP API from a **general** or **chat** workflow.
- POST JSON built from `args.*` or earlier blocks.

<block-page-nav>



</block-page-nav>


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
