> ## Documentation Index
> Fetch the complete documentation index at: https://vetta.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connections

> Let an agent act through third-party apps — OAuth or API key — without ever touching the token.

> [!NOTE]
>
> **Available now.** The connection layer is a first-party Naive Managed Agents capability ("Passport").

A connection authorizes an identity to act inside a third-party app — helpdesks, issue trackers, email, chat, CRMs, docs, and over a thousand more — over OAuth or a scoped API key. Once connected, the agent reaches the app's tools through Managed Agents' connection tooling and **never handles the raw credential**; Managed Agents stores it, injects it at call time, and refreshes managed OAuth tokens server-side.

Social networks are connected through the social endpoints, not through this app catalogue.

**There is no list of supported apps to check against.** The catalogue is read live, so the first step of any setup is a search:

```bash CLI theme={"system"}
naive identity connections apps --search helpdesk
# -> zendesk · Zendesk · managed_oauth/oauth · 12 operations
```

## Two objects

Every connection is built from two objects. Keeping them separate is what lets one authorized app serve many identities under different policies.

* **Auth config** — *how* an app authenticates. It pins the auth method (managed OAuth, your own OAuth app, or an API key), the **scopes**, any custom app credentials, and — the part that matters most — the **operations a connection may call**. Anything not pinned does not exist to the agent. An org has one auth config per app and way of signing in, shared across the org: a second of the same kind (managed OAuth again, an API key again, or the same OAuth client again) is refused with `409 name_conflict` — reuse it, or delete it first. A different kind beside it, such as your own OAuth app beside the managed one, or another OAuth client, is created.
* **Connected account** — a **per-identity** instance of that auth config: the actual authorization for one identity, with its own lifecycle, status, and token. This is what a `connection_call` runs against.

```text theme={"system"}
auth config (connector: "zendesk", scopes, pinned tools)
   └── connected account  → identity "ava"    (active)
   └── connected account  → identity "sales"  (initiated)
```

## Connecting

An end user authorizes through a hosted **Connect Link**. There is no non-interactive path: OAuth needs the user's consent, and an API-key connector asks for the key on the same hosted form so it never travels through a Managed Agents request body. Either way the result is a connected account bound to one identity.

**1. Find the app**

Search the catalogue, then read the one you want whole — it tells you which auth methods work, the operations pinned by default, and anything connecting will still ask for.

```bash CLI theme={"system"}
naive identity connections apps --search helpdesk
naive identity connections app zendesk
```

**2. Create the auth config (once per app)**

Managed OAuth needs no credentials of your own; bring a custom OAuth app or API key when you need it. Pin the operations with `--tool` to narrow the surface below the app's default set.

```bash CLI theme={"system"}
naive identity connections config-add --connector zendesk --auth managed_oauth
```

**3. Start a connection**

Initiate a connected account for an identity. Managed Agents returns a hosted **Connect Link** the end user opens to authorize — see the caveat on `connect_link` below about whose domain serves it.

```bash CLI theme={"system"}
naive identity connect --identity idn_... --auth-config ac_... --field subdomain=acme
# -> the hosted authorization page for this connected account
```

```bash cURL theme={"system"}
curl https://api.vetta.sh/v1/connections \
  -H "Authorization: Bearer $NAIVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "identity": "idn_...", "auth_config_id": "ac_...", "fields": { "subdomain": "acme" } }'
# -> { "id": "ca_8f2c", "status": "initiated",
#      "connect_link": "https://api.vetta.sh/v1/connections/link/lk_…", "connect_link_expires_at": "…" }
```

**4. Authorize**

The user completes OAuth (or submits the API key) at the Connect Link and is returned to your dashboard, which reads the account and says what happened. The connected account moves from `initiated` to `active` on its own.

> [!NOTE]
>
> **Poll, do not wait for a webhook.**`GET /v1/connections/{id}` reconciles against the provider on read, so re-reading the connection *is* the refresh. There is no `connection.*` webhook yet, so a program that needs to know when a person finished authorizing polls this route.

**5. Use it**

The identity's agent lists the tools available on the connected account and invokes them. With a key, run one
yourself — see [Run an action](#run-an-action).

```bash CLI theme={"system"}
naive identity connections list --identity ava
```

## On the developer platform

In a [developer workspace](https://vetta.sh/docs/developers/overview.md), a connected app belongs to an [identity](https://vetta.sh/docs/developers/identities.md)
like its inboxes and numbers do. You never manage auth configs: name the app and Naive reuses or creates the managed
one for you.

**In the console:** open **Resources → the identity → Connected apps → Connect an app**, pick the app, and open or copy
the sign-in link. The person who owns the account signs in there; the row turns **Active** and lists the app's actions.
**Disconnect** drops the grant.

**With a key**, connect in one call. The workspace must be funded (a top-up of \$10 or more) and the key needs
`billing:write`:

```bash cURL theme={"system"}
curl https://api.vetta.sh/v1/connections \
  -H "Authorization: Bearer $NAIVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "identity": "idn_...", "app": "gmail", "redirect_url": "https://example.com/connected" }'
# -> { "id": "ca_8f2c", "status": "initiated", "connect_link": "https://api.vetta.sh/v1/connections/link/lk_…" }
```

**app** `string`

The app's catalogue id (`slug` from `GET /v1/connections/apps`). Use it instead of `auth_config_id`.

**redirect\_url** `string`

Where the person lands after signing in. Must be `https`. Left out, they land on the console's connection page, which
checks the connection and links back to the identity.

Then poll `GET /v1/connections/{id}` until `status` is `active`.

### Run an action

A key, an MCP client or your own agent acts **as an identity** by naming one of that identity's connections. Keys
carry no identity of their own.

1. `GET /v1/connections/{id}/tools` lists the actions the connection may call, each with `name`, `description` and a
   JSON Schema in `parameters`.
2. `POST /v1/connections/{id}/execute` runs one: `tool` is a `name` from step 1, `arguments` match its `parameters`. Send an `Idempotency-Key` header to make a retry safe.

```bash cURL theme={"system"}
curl https://api.vetta.sh/v1/connections/ca_8f2c/execute \
  -H "Authorization: Bearer $NAIVE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: send-refund-42" \
  -d '{ "tool": "send_email", "arguments": { "recipient_email": "customer@example.com", "subject": "Refund", "body": "Done." } }'
```

```json theme={"system"}
{
  "object": "connection_run",
  "connection_id": "ca_8f2c",
  "identity_id": "idn_...",
  "tool": "send_email",
  "status": "succeeded",
  "output": { "id": "18c1f…" },
  "error": null,
  "cost_micro_usd": 2400,
  "created_at": "2026-11-25T10:00:00Z"
}
```

A connection that is not `active` answers `409 connection_not_active`. An action the app rejected comes back as
`status: "failed"` with the app's `error`; it reached the app, so it is billed. Every run shows in **Logs** and in
**Usage**, under the identity.

**From MCP, Claude or ChatGPT:** `tools_search` also returns the actions of your workspace's active connections when the
query names the app (or says "connected"). Each is named `conn:<connection id>/<action>`, and `tools_execute` runs it
with the same price and limits as the REST call.

### Limits

| Limit | Value |
| - | - |
| Links waiting for sign-in, per identity | 5 (finish or disconnect one first; a 6th answers `429 rate_limited`) |
| Connected apps per workspace | 50 |
| Action arguments | 64 KB (output is cut at 40 KB) |
| Google Maps | Not offered on the developer platform; use the [Google Maps tool](https://vetta.sh/docs/developers/tools.md#google-maps) instead |

Deleting an identity disconnects its apps.

## The agent can start this itself

The four steps above are the operator's path. An agent has the same flow as three tools, offered to
every session whose agent has an identity — so "connect our Zendesk" is something you can say to the
agent rather than something you have to go and do for it.

| Tool | What it does |
| - | - |
| `connections.search` | Searches the catalogue by name, category or what an app does, and returns each app's id. There are over a thousand apps and the list changes without a release of ours, so there is nothing to memorize — the agent searches. |
| `connections.connect` | Starts an authorization for this agent's identity and returns the **Connect Link**. The agent hands that link to the person; it cannot authorize on their behalf. Reuses the org's existing auth config for the app rather than creating a second. |
| `connections.status` | Reads whether the person finished. `active` means the account's tools are offered from the next turn on. |

> [!NOTE]
>
> **The consent screen is the approval.**`connections.connect` produces a URL and nothing else: no credential exists and no tool is gained until a human opens it and authorizes at the third party. If you want a gate earlier than that, these register as ordinary tool names, so `"connections.connect": { "permission": "ask" }` in the agent's `tools.configs` parks the session for approval like any other tool.

> [!NOTE]
>
> **Tools arrive on the next turn.** The session resolves its connected accounts when a turn starts, so an account authorized mid-conversation is usable on the turn after it reads `active` — which is what `connections.status` is for.

## Lifecycle

A connected account moves through a small set of states. Managed OAuth tokens are **refreshed server-side**, so an `active` account keeps working without your involvement.

**1. initiated**

Connect Link issued; awaiting the user's authorization.

**2. active**

Authorized and usable. Tokens refresh automatically in the background.

**3. failed**

Authorization or a refresh failed. `status_reason` carries the cause (denied scope, expired grant, revoked app).

**4. disconnected**

Revoked by the user or by you. The stored credential is dropped and calls are refused.

## Calling tools

The agent works through Managed Agents' connection tools, never the raw credential:

* **`connection_search`** — discover the tools available on a connected account.
* **`connection_call`** — invoke a specific tool with arguments.
* **`manage_connections`** — a meta-tool for listing connected accounts, checking status, and starting a new connection from inside a run.

```jsonc theme={"system"}
// what the agent emits, conceptually:
connection_call({
  connection: "conn_8f2c",   // a connected account
  tool: "send_message",
  args: { to: "customer@example.com", subject: "Refund", body: "Done." }
})
```

## Governance

The **auth config's pinned tools are the first governance layer, and they are enforced at the provider**: an operation the config was not pinned to is refused before it is dispatched. Above that, each connection tool is governed by the agent's [tool policy](https://vetta.sh/docs/identity/policies.md) under its `<connector>.<tool>` name: `allow`, `ask` or `deny`, like any other tool. Nothing is connected until a person opens the authorization link and signs in.

## Pricing

In a developer workspace, connected apps are billed on the `connection` component, drawn from the
[organization balance](https://vetta.sh/docs/platform/billing.md) and checked against the key's budget:

| What | Price |
| - | - |
| Connecting an app to an identity (`POST /v1/connections`), once per connected account | 500 credits (\$0.10) |
| One action on Salesforce, YouTube, Reddit, Google Ads, QuickBooks, LinkedIn, Zoho Books, Gong, Zoho Inventory, Google Photos, Zoho Invoice, Moneybird or Blackbaud | 52 credits (\$0.0104) |
| One action on Gmail, Google Calendar, Google Super, Microsoft Teams, Google Drive, HubSpot, Slack, Google Sheets, Jira, Trello, Discord Bot, TikTok Ads, Confluence or Stack Exchange | 12 credits (\$0.0024) |
| One action on any other app | 4.5 credits (\$0.0009) |
| Searching apps, listing, reading, listing actions, disconnecting | Free |

An action the connections layer refuses before it leaves Naive (not in the connection's pinned set) is not billed.

Connection tool calls made by agents running in the Naive studio, and their connected accounts, are not billed today.
The model turns that decide to make a call are billed as usual.

## Field reference

**connector** `string` *required*

The app to connect, by its catalogue id — e.g. `zendesk`, `linear`, `intercom`. Search `GET /v1/connections/apps` for it; there is no fixed set. The five category words that used to be the only accepted values (`email`, `chat`, `tracker`, `crm`, `docs`) still resolve, onto the apps they always meant.

**tools** `string[]`

The operations a connection made from this auth config may call. Omitted, the app's own featured set is pinned. This is a boundary, not a filter — anything outside it is refused at the provider.

**fields** `object`

Values the app needs before authorization can start — an account subdomain, a region, a workspace. Read them from the app or the auth config (`connect_fields`); leave them out and the hosted page asks the person instead.

**auth** `string` (default: managed\_oauth)

Auth method on the **auth config**: `managed_oauth` (Managed Agents' OAuth app), `oauth` (your own OAuth app credentials), or `api_key`.

**scopes** `string[]`

Scopes requested at authorization. Narrower scopes reduce what a connected account can do.

**identity** `string` *required*

The identity a **connected account** is bound to. One auth config can back many identities.

**status** `string`

Connected-account state: `initiated`, `active`, `failed`, or `disconnected`.

**status\_reason** `string`

Present on `failed` — the cause (denied scope, expired grant, revoked app).

**connect\_link** `string`

The URL the end user opens to authorize. It is on the API's own domain (`GET /v1/connections/link/{token}`, no key needed) and redirects to the hosted authorization page. It is returned by `POST /v1/connections` and expires — read `connect_link_expires_at` and mint a new one rather than caching it. A later read of an `initiated` account does not carry it yet: keep the one the create returned.

> [!WARNING]
>
> **The page the link opens is not on a Managed Agents domain today.** The link itself is ours, but the hosted authorization page it redirects to is served by the connection provider, on the provider's own host, and it carries the provider's name in the page title, the heading and a "Secured by" badge. Serving it from a Naive domain is not offered on the current plan; the provider's own white-labelling covers a logo, an app title and a theme — set in their dashboard, with no API — and removes the badge only when you bring your own OAuth app for that connector. Treat the connect link as a page you hand to an end user, not as part of your product's surface, until this changes.

> [card] [Next: the vault](https://vetta.sh/docs/identity/vault.md)
>
> Secrets the agent can use but never see.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.