# Request Connection

Asks the user to add a connection to the workspace, such as an API key a workflow needs, and pauses the run until they answer on a connection request card.

## When to Use

The AI uses this tool when a workflow or automation it is building needs an API key or account the workspace does not have yet. It gives the agent no tools: when the agent needs tools, it asks with `request_tool`, whose card connects the account and adds the tools in one step. A second connection of a type the workspace already has is a normal request, such as a separate API key to track one workflow's spend.

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `connection_type` | string | Yes | The connection type key, e.g. `openai` or `kimi_code`, or `generic_api` for a custom API |
| `reason` | string | Yes | One sentence on what the connection is for; the user reads it on the card |
| `name` | string | No | The name to give the connection |
| `api_url` | string | No | The API URL, absolute `http` or `https`. For `generic_api` and for a type that needs no secret only |
| `header_name` | string | No | The header the key is sent in, e.g. `Authorization` or `X-API-Key`. `generic_api` only |
| `header_prefix` | string | No | The text before the key in that header, e.g. `Bearer`; `""` sends the key alone. `generic_api` only |
| `properties` | object | No | Extra settings by the keys the type declares, e.g. `{"region": "china"}` for `kimi_code` |

## Returns

The run ends on a connection request card. **Connect** opens the connection form filled in with what the agent stated; the user types the secret, can change every value, and saves. The answer comes back as this call's result:

| Answer | Result |
|--------|--------|
| Connect, then save the form | `{"connected": {"id", "handle", "name", "provider", "account", "status"}}` |
| Not now | A refusal telling the agent not to choose for the user; the agent stops until the user writes |

Closing the form without saving leaves the card open, and nothing is added.

## Example Scenario

A user asks an agent to build a workflow that counts weekly signups from PostHog. Verdalia has no PostHog type, so the agent calls this tool with `connection_type: "generic_api"`, `name: "PostHog"`, `api_url: "https://eu.posthog.com/api/projects/@current"`, `header_name: "Authorization"`, `header_prefix: "Bearer"` and `reason: "PostHog key for the weekly signups workflow."`. The user selects **Connect**, pastes their PostHog key into the prefilled Custom API form and saves. The agent gets the new connection's id and points the workflow's HTTP Request step at it.

## Notes

- One connection per call; the agent never sees the secret
- An empty `reason`, `name` or `header_name`, and an `api_url` that is not `http` or `https`, are refused
- An unknown `connection_type` is refused with every type key and its name, so the agent can correct the call
- `header_name` and `header_prefix` on any type but `generic_api` are refused; built-in types send their key in their own header
- `mcp` is refused: apps connect through `request_tool` with group `mcp` and `app`
- A `properties` key the type does not declare is refused; the values are checked when the form is saved
- Agents only
