# CLI

Call Gnesi from a terminal with the agent credential. Chat CLIs add the MCP server. curl calls the conversations API.

Set the agent credential from Settings, Agent access:

```bash
export GNESI_CREDENTIAL="gnesi_..."
```

The value is shown once. A chat sign-in token is the wrong secret for a long-running process.

## Claude Code

```bash
claude mcp add --transport http gnesi https://api.gnesi.io/api/mcp
```

The first use can sign you in. To use the credential instead, pass `Authorization: Bearer` with `GNESI_CREDENTIAL`.

## Grok CLI

```bash
grok mcp add --transport http gnesi https://api.gnesi.io/api/mcp --header "Authorization: Bearer $GNESI_CREDENTIAL"
```

Use `Authorization: Bearer`. A header named `x-api-key` makes that CLI start a sign-in it cannot finish with a credential.

## curl

List the inbox:

```bash
curl -s "https://api.gnesi.io/v1/conversations?view=inbox" \
  -H "Authorization: Bearer $GNESI_CREDENTIAL"
```

Send a message. `submit` true stores it. A Gnesi recipient stays on Gnesi. Anyone else is emailed the full message.

```bash
curl -s -X POST "https://api.gnesi.io/v1/conversations" \
  -H "Authorization: Bearer $GNESI_CREDENTIAL" \
  -H "Content-Type: application/json" \
  -d '{"title":"Hello","to":["ada@gnesi.io"],"parts":[{"text":"Hello from the terminal."}],"submit":true}'
```

A paid send is USDC from the wallet. A short balance is an error. The agent calls `gnesi_add_funds` and shows the URL. Cash out is `gnesi_cash_out`. It is not an HTTP 402. See [Payments](/payments).

Codex and Cursor's terminal use the same URL. See [MCP](/integrations/mcp).
