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

# Agent modes and accountability

> Control what an AI agent may do with contracts: read-only, draft and send modes, explicit confirmation, recipient domain allowlists, agent and on-behalf-of identity, and a hash-chained audit log.

When an agent prepares and sends contracts, two questions matter later: **was it allowed to**, and **who is bound
by what it did**. The MCP server answers both with guardrails that the integrator sets and the agent cannot change,
and with a log of every action.

All guardrails are enforced on the server for every tool call, and they are never set by prompts, so a confused or
manipulated agent cannot talk its way past them. Where they come from depends on how the app connected:

| Connection | Who sets account, tenant, mode, allowed domains | Default mode |
| - | - | - |
| **OAuth** (Claude, ChatGPT, Cursor, VS Code, Claude Code signed in) | The user, on the Sendforsign consent screen. This grant is the source of truth; integrator headers are ignored. A user picked there is a limit: the connector acts only as that user. | `draft` |
| **API key or client token** (server-side agents) | Your code, with [headers](https://about.sendforsign.com/ai-agents/headers.md) on each connection | `send` |

## Agent modes

Chosen on the consent screen for OAuth connections ("read only", "create drafts", "send for signature"), or set
with `X-Sendforsign-Agent-Mode` for header connections.

| Mode | Read tools | Create and edit drafts, fill fields, add recipients, create tenants | Email recipients (`send_for_signature`), archive |
| - | - | - | - |
| `read_only` | yes | blocked | blocked |
| `draft` | yes | yes | blocked |
| `send` (default) | yes | yes | yes, with `confirm: true` |

`draft` is the right default for most products: the agent prepares the contract and the signing links, and a human
(or your own code) sends it, or shows the links in your UI. Recipients added in `draft` mode are not emailed.

A blocked call returns a tool error such as
`Blocked by policy: this connection is in draft mode (X-Sendforsign-Agent-Mode)...`, which tells the agent to hand
over to a human instead of retrying.

## Explicit confirmation

`send_for_signature` and `archive_contract` require the argument `confirm: true`. Without it, they do nothing and
return:

> Not executed: sending for signature needs confirm: true. Show the user exactly what will happen ... and call
> again with confirm: true only after they explicitly approve.

The tool descriptions tell the model the same thing. This is a second line of defence, not a substitute for modes: a
model can still set `confirm: true` on its own. If no human is in the loop, use `draft` mode, or let your own code
decide when to call `send_for_signature`. MCP clients that ask the user before tools marked `openWorldHint` or
`destructiveHint` (these two tools are) add a third line.

## Recipient domain allowlist

Allowed domains entered on the consent screen, or `X-Sendforsign-Allowed-Domains: customer.com,partner.org` on a
header connection, make `create_contract`, `add_recipients` and
`send_for_signature` reject any recipient whose email is outside those domains:

> Blocked by policy: recipients outside the allowed domains (customer.com, partner.org): [someone@gmail.com](mailto:someone@gmail.com)

Use it when the agent should only ever contract with known parties, for example your customer's own staff and its
existing clients.

## Identity: agent and principal

For **OAuth** connections both come from the grant: the agent is the AI app's registered name (for example
"Claude"), and the principal is the email of the Sendforsign user who approved the connection.

For **header** connections:

* `X-Sendforsign-Agent` names the agent (product, version, deployment).
* `X-Sendforsign-On-Behalf-Of` names the person or company the agent acts for: the user who asked, or the customer
  account. Set it from your own authenticated session, not from anything the model says.

Both are written to the audit log with every action.

## Audit log

Every **write** tool call and every **blocked** call is recorded, with:

| Field | Meaning |
| - | - |
| `create_time` | When |
| `agent`, `on_behalf_of`, `mode` | Who acted, for whom, under which mode |
| `client_key`, `user_key` | In which account and tenant |
| `tool`, `args` | What was called, with which arguments. Contract bodies are stored as a SHA-256 hash and length, not verbatim. |
| `contract_key` | Which contract |
| `outcome`, `message` | `ok`, `error` or `blocked`, with the error text |
| `prev_hash`, `hash` | Hash chain: each record includes the hash of the previous record of the same account, so an edited or deleted record breaks the chain |

Read calls that succeed are not logged. The agent's actions for a contract are returned by
[`get_contract_timeline`](https://about.sendforsign.com/ai-agents/tools#get_contract_timeline) as `agentActions`, next to the signing events
(sent, seen, signed, fully signed).

> [!NOTE]
>
> The audit log is being rolled out. `get_connection_info` returns `auditLog: "on"` when it is active for your
> connection. Contact us to enable it or to export the log.

## Disconnecting an AI app

**OAuth connections.** Removing the Sendforsign connector in the AI app (for example **Settings → Connectors** in
Claude) stops that app from using it. The server side of a connection ends when:

* the app revokes its tokens (the server supports OAuth token revocation, RFC 7009; many apps call it when you
  disconnect),
* the access token expires (after 1 hour) and the refresh token is not used for 90 days, or
* a used refresh token or authorization code is presented again, which revokes the whole connection as a safety
  measure.

A list of connected AI apps with a **Disconnect** button in the Sendforsign app settings is planned. Until then, if you
need a connection cut off on the server immediately (for example a lost laptop), contact Sendforsign support and we
will revoke it.

**API-key connections.** Rotate or delete the API key in the dashboard, or stop sending it. Client tokens can be
[revoked](https://about.sendforsign.com/api-reference/authentication.md) through the API.

## Legal context

> [!WARNING]
>
> This section explains why the controls above exist. It is not legal advice; whether a particular contract is
> binding depends on the jurisdiction, the parties' agreement and the facts. Ask your counsel.

**United States.** The federal ESIGN Act, 15 U.S.C. §7001(h), provides that a contract may not be denied legal effect
solely because its formation, creation or delivery involved the action of one or more electronic agents, **so long as
the action of the agent is legally attributable to the person to be bound**. The Uniform Electronic Transactions Act
(UETA), adopted by most states, says the same for automated transactions (§14) and lets attribution be shown in any
manner, including by the efficacy of a security procedure (§9). UETA §10 deals with changes and errors: where the
parties agreed on a security procedure to detect them, it allocates the consequences to the party that did not follow
it.

The practical consequence for agent builders: be able to show **which principal an agent acted for, under which
authority, and what exactly it did**. Agent and on-behalf-of identity, explicit modes and confirmations, and a
tamper-evident log are the evidence. Agreeing these controls with your customers (for example in your terms) makes
them an agreed procedure rather than an internal setting.

**European Union.** Sendforsign signatures are simple electronic signatures under eIDAS, which may not be denied
legal effect solely because they are electronic. The same evidence (who acted, for whom, what was signed and when)
supports them. Qualified signatures and seals are out of scope.

Signers themselves are always humans: the agent prepares and sends; the recipient opens the signing link, reviews and
signs.


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