> ## 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.

# Identities and approval rules

> Give each agent an identity, its resources, and a short list of actions that ask you first.

An **identity** (`idn_…`) is a named actor your agent works as: "Support", "Research", "Trader". Inboxes, phone
numbers, brokerage accounts, cards, wallets, companies, social accounts and connected apps belong to an identity, and every call made
for it is logged against it.

Each identity also carries its **approval rules**: which actions wait for a person before they run. Configuring an
identity and what it asks for is one screen in the console (**Identities → the identity → Ask me first**), with sensible
defaults already set.

The console's **Identities** page has two tabs. **Identities** lists each identity with what it owns, what asks first
and its spend. **Resources** lists every resource in the workspace, the workspace's own (apps, domains, computers,
vaults) and each identity's, filterable by type and owner. See [Resources](https://vetta.sh/docs/developers/resources.md).

## Create an identity

`POST /v1/identities` — the existing route, documented in the [API reference](https://vetta.sh/docs/api/identities.md).

```bash curl theme={"system"}
curl https://api.vetta.sh/v1/identities \
  -H "Authorization: Bearer $NAIVE_API_KEY" -H "Content-Type: application/json" \
  -d '{ "name": "Trader" }'
```

```ts TypeScript theme={"system"}
const trader = await client.identities.create({ name: "Trader" });
```

A new identity has no rules of its own: it **inherits the workspace defaults** until you change one. A signed-in owner
or admin can also pass `approval_rules` on create to set them in the same call.

In the SDK, an identity's resources are `client.resources.forIdentity(id)` and its rules are
`client.approvals.rules.get(id)` and `client.approvals.rules.set(id, rules)`.

## Connected apps

An identity can act in third-party apps (Gmail, Slack, HubSpot, Notion and over a thousand more) once a person signs
in to the app for it. In the console: **Identities → the identity → Connected apps → Connect an app**, pick the app,
and open or copy the sign-in link. With a key: `POST /v1/connections` with `{ "identity": "idn_…", "app": "gmail" }`
returns the link.

Once the connection is **Active**, your keys, MCP clients and agents act as the identity by naming that connection:
`GET /v1/connections/{id}/tools` lists its actions and `POST /v1/connections/{id}/execute` runs one. Over MCP,
`tools_search` finds them as `conn:<connection id>/<action>`.

Connecting costs $0.10 once; each action $0.0009 to \$0.0104, by app. Both need a funded workspace. Deleting an
identity disconnects its apps. The full guide: [Connected apps](https://vetta.sh/docs/identity/connections.md#on-the-developer-platform).

## Approval rules

Each action has one rule:

| Rule | Meaning |
| - | - |
| `"never"` | Runs straight away. |
| `"always"` | Waits for a person every time. |
| `{ "over_usd": 50 }` | Waits only when the call's amount is over \$50. Only actions with an amount accept it. |

### Actions and workspace defaults

| Action | In the console | Checked on | Amount | Default |
| - | - | - | - | - |
| `email.send` | Send email | `POST /v1/identities/{id}/emails/{eid}/send` | — | Never |
| `sms.send` | Send SMS (sending is not available yet; the rule applies once it is) | `POST /v1/identities/{id}/phones/{pid}/send` | — | Never |
| `phone.buy` | Buy a phone number | `POST /v1/identities/{id}/phones` | — | Always |
| `domain.buy` | Buy a domain | `POST /v1/domains/purchase` | the quoted price | Always |
| `trade.place` | Place a live trade | `POST /v1/identities/{id}/trading/orders` and `…/positions/{symbol}/close`, live accounts only (paper never asks) | notional, or quantity × limit price | Always |
| `card.spend` | Issue / fund a card | `POST /v1/identities/{id}/cards` | the amount loaded onto the card | Over \$50 |
| `money.out` | Move money out | wallet pay, transfer, fund and sweep | the amount | Always |
| `company.create` | Form a company | `POST /v1/identities/{id}/legal/companies/{cid}/submit` | — | Always |
| `social.post` | Publish a social post | `POST /v1/identities/{id}/social/posts` | — | Never |
| `spend.over` | Any single call over \$X | `POST /v1/tools/runs` (send `identity_id` to run as that identity), plus the routes above that state an amount | the tool's listed price (a `data:` / `social:` id has none, so only Always holds it) | Over \$5 |

**Workspace defaults** apply to every identity that has not set its own rule for an action, and to workspace-owned
resources such as a domain purchase. Change them in **Settings → Ask me first**.

Before a company is filed, its owners verify who they are through a secure link (KYC, \$2.00 per person link). That step
is not an approval rule: see [Verify the people behind a company](https://vetta.sh/docs/developers/resources.md#kyc).

### Who is held

* Rules apply to calls made with a **key** or an **MCP / ChatGPT / Claude** connection in a developer workspace.
* A person signed in to the console is never held; the console asks them to confirm instead.
* Keys carry no approval rules. Narrow what a key can do with its [preset and budget](https://vetta.sh/docs/developers/keys.md).

### Read the effective rules

`GET /v1/identities/{id}/approval_rules` — scope `approvals:read` (a key with `agents:read` also works).

```json theme={"system"}
{
  "object": "approval_rules",
  "scope": "identity",
  "identity_id": "idn_01JD7Q2R5T7V9X1Z3B5D7F9H1K",
  "rules": {
    "email.send": { "value": "never", "source": "workspace" },
    "trade.place": { "value": { "over_usd": 100 }, "source": "identity" },
    "spend.over": { "value": { "over_usd": 5 }, "source": "workspace" }
  }
}
```

Each action shows its `value` and whether it comes from the identity or the workspace.

### Change an identity's rules

`PUT /v1/identities/{id}/approval_rules` — signed-in owner or admin only. Keys and MCP connections are refused with
`403 forbidden`, so an agent can never loosen its own rules.

**rules** `object` *required*

A map of action to rule. An action you leave out inherits the workspace default.

```bash theme={"system"}
curl -X PUT https://api.vetta.sh/v1/identities/idn_01JD7Q2R5T7V9X1Z3B5D7F9H1K/approval_rules \
  -H "Authorization: Bearer $NAIVE_SESSION" -H "Content-Type: application/json" \
  -d '{ "rules": { "trade.place": { "over_usd": 100 }, "email.send": "always" } }'
```

### Workspace defaults

`GET /v1/organizations/{id}/approval_rules` (scope `approvals:read`) and `PUT /v1/organizations/{id}/approval_rules`
(owner or admin only, with a full map of every action).

## What happens when a call is held

The call is not run. It answers **`202`** with an [approval](https://vetta.sh/docs/developers/approvals.md) in `pending`. A person approves or
denies it in the console; on approve, Naive runs the original request exactly once, as the original key, and stores the
result on the approval.

## From the CLI

```bash theme={"system"}
naive approvals rules --identity Trader
naive approvals rules --identity Trader --set trade.place=over:100 --set email.send=always
```


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