---
title: "Call a web API"
description: "Let an agent call an ordinary REST API with its Fetch tool: turning it on, sending a JSON or form body, using a Vault key without the agent seeing it, what"
slug: guides/building-workflows/calling-an-api
section: guides
subsection: building-workflows
canonical_url: https://cerevisor.com/docs/guides/building-workflows/calling-an-api
last_verified: 2026-10-24
last_verified_version: "unreleased"
updated_at: 2026-11-09T20:35:41.823226+00:00
---

Many services offer a web API: an address an agent can send a request to and get data back, usually as JSON. An agent calls one with its **Fetch** tool. It can read (a `GET`) or send (a `POST`, `PUT`, `PATCH` or `DELETE` with a body), use a key from your Vault without ever seeing it, and keep a large answer in a file.

You do not need to write a connector or set up an MCP server for an ordinary API.

## Turn it on

1. Open **Settings**, **Permissions**, and under **Tool categories** turn on **Web access**.
2. On the agent's card, under **Allowed Tools**, make sure **Fetch** is on.
3. In the agent's instructions, write the API's address and say how to call it: the parameters, and what to do with the answer. The agent writes each request itself.
4. Press **Run**. Cerevisor finds the API's site in the instructions and asks once: **This workflow calls a new site**. Leave it ticked and choose **Add and run**.

That is all. The site is now on the workflow's **approved sites**, and its agents reach it without asking, in this run and the next ones. Why that list matters: [Approved sites](#approved-sites).

The Fetch tool belongs to agents that run on Cerevisor's own engine: Anthropic, OpenAI-compatible providers and Gemini. Agents that run on Claude Code, Codex, Cursor, Antigravity or Grok Build fetch with their own tools, and what this page describes does not apply to them.

## Sending a body

A request that sends data carries a body. The agent gives it in one of two ways:

- **As JSON.** The agent writes the body as an object, and Cerevisor sends it as JSON with the matching content type. This is what most APIs expect.
- **As text.** The agent writes the body as text, and Cerevisor sends it exactly as written: as JSON if the text is JSON, as plain text otherwise. For form data (`name=value&other=value`) or any other format, the agent says the content type in a header.

A body goes only with `POST`, `PUT`, `PATCH` or `DELETE`. On a `GET`, the body is left out, the `GET` goes ahead, and the agent is told that its body was not sent and how to send it.

## Using a key from the Vault

Most APIs want a key. Keep it in the **Vault**, never in the agent's instructions.

1. Add the key to the Vault.
2. On the agent's card, switch on **Vault secrets** and add the key.
3. In the instructions, tell the agent to write `${{vault:NAME}}` where the key goes, with your key's name: in a header such as `X-API-Key`, in the address, or in the body.

Cerevisor puts the real value in at the moment the request goes out. The agent and its model only ever see `${{vault:NAME}}`. If the API repeats the key back in its answer, Cerevisor replaces it with `${{vault:NAME}}` before the agent reads it.

The Vault is included on the trial, Pro and Power.

## When it asks you first

| The request | Oversight | Auto | Hands-free |
|---|---|---|---|
| **Reads**: `GET` or `HEAD` | Asks you | Done | Done |
| **Sends or changes**: `POST`, `PUT`, `PATCH` or `DELETE` | Asks you | Asks you | Done |
| **Keeps the answer in a file** (see below) | Asks you | Done | Done |

A request that names a sending method in a header (such as `X-HTTP-Method-Override: DELETE`) counts as that method, even if it is written as a `GET`.

## Approved sites

Each workflow keeps a list of approved sites. A site on the list, and its subdomains, is always reached without asking. A site off the list depends on **Web access scope**, in **Settings**, **Permissions**:

- **Approved sites only**: a site off the list is never reached on its own. In Oversight and Auto you are asked. In Hands-free, and in a run nobody is watching, the request is not sent.
- **Anywhere**: a site off the list is reached, until the agent has read something from the web. An answer from a website is content someone else wrote, and it could carry instructions planted for an agent to follow. So after that, a request to a site off the list asks you first in Oversight and Auto, and is not sent in Hands-free or in a run nobody is watching. An agent that holds a Vault secret cannot reach a site off the list at all for the rest of the run.
- **Off**: no site is reached.

Without the API's site on the list, then, an agent's second call to the same API can stop. Three ways to put a site on the list, none of them in Settings:

- **When you press Run.** Cerevisor looks for web addresses in the instructions of the agents that can fetch. A site that is not on the list yet is offered on the card **This workflow calls a new site** (or **these sites**), with the agents that name it. Each site is ticked: **Add and run** adds the ticked ones, **Run without adding** runs without them, **Cancel** does not run. A site you leave out is not offered again until you restart Cerevisor.
- **When an agent asks.** On the question an agent raises when it reaches a site that is not approved, choose **Add example.com to approved sites**: it answers yes, and puts the site on the list for the next runs too. (**Always allow example.com** answers yes for this run only.) On the small card on the agent, the button is in the **⋯** menu, and in **Review**.
- **In Settings**, **Permissions**, **Web access scope**, as before. The list shows with **Approved sites only** and with **Anywhere**.

Add only sites you recognise. Taking a site off the list is the **×** next to it in Settings.

## Redirects

An API sometimes answers "go to this other address instead". Cerevisor follows up to 5 of these, and checks each new address the same way it checked the first:

- An address on this computer or your home network is never reached, wherever the redirect points.
- With **Approved sites only**, each new site must be on your list too.
- When a redirect leads to a **different site**, your headers stay behind (keys, sign-in tokens and cookies among them), except harmless ones such as which format the agent accepts. A key meant for one site is never handed to another. The same applies when a redirect drops from `https` to plain `http`.
- A request that sends or changes something is never passed on to a different site, and neither is its body. The agent is told where the API pointed, and can call that address itself if it is the right one.
- Following a redirect on the same site keeps everything, the way a browser does. An answer that says "see the result here" (`303`) is fetched with a plain `GET`.

## Time limits

Each request waits up to 30 seconds by default, for every redirect and the whole answer together. An agent can ask for between 1 second and 5 minutes for a slow API. When the time runs out, the agent is told which site did not answer.

If a request that sends or changes something runs out of time, the agent is told it **may have happened**, not that it failed. The server may have done the work and only the answer was lost, so sending it again could do it twice.

## Large answers

The agent reads at most 50,000 characters of an answer. Beyond that the answer is cut, and the agent is told so. A JSON answer that is cut no longer parses, and the agent is told that too.

To keep a large answer whole, the agent gives a file name in its working folder. Cerevisor then writes the whole answer to that file and gives the agent a short summary instead: the file's place, the size, the type, and the first 2,000 characters. The agent then reads the file in parts, searches it, or works on it with a script.

- **File creation** must be on in **Settings**, **Permissions**.
- The file must be somewhere the agent may write, the same as any file it writes: normally inside the workflow folder.
- An existing file is never replaced. The agent chooses a new name.
- An error answer (a `404` or `500`, say) is not saved.

## What is recorded

Each request leaves a line in the run's record: the address, the method, the answer's status and size, and the address it ended at after any redirects. A value in the address that looks like a key or a password is replaced with `[redacted]`. A Vault key appears in the record only as `${{vault:NAME}}`, never as its value.

## What it cannot do

- **Sign in for you.** It sends keys and tokens you keep in the Vault. A sign-in that needs a person, or a browser page, is a job for [Browse websites](./browsing-websites.md).
- **Page through results by itself.** An API that splits its answer into pages needs one request per page. Say so in the instructions, for example "keep going while the answer has a `next` link".
- **Binary files.** An answer is read as text. A picture, a zip or a PDF arrives damaged. Use the browser's download, or a script with **Bash execution**.

## See also

- [Browse websites](./browsing-websites.md): for sites that need a person's clicks and sign-ins.
- [Add and configure agents](./add-and-configure-agents.md): the **Allowed Tools** and **Vault secrets** fields.
- [MCP servers](../advanced/mcp-servers.md): for services that offer an MCP server.
- [Settings reference](../../reference/settings/README.md): every Permissions field.
