# Curly
<!--
ref: @integrations/curly
type: protocol
tags: [API, curl, automation, service integration]
aliases: [curly, curly-install, curly-setup]
triggers: [need to manage API tokens securely, want to simplify API calls, concerns about token exposure]
trigger_prompt: When a user wants to securely manage API tokens and streamline their API requests without exposing sensitive information.
category: integration
last_reviewed: 2026-07-06
complements: [@protocol/install, @protocol/curly-threading]
audience: [claude-code-user, openclaw-user, terminal-only, agent-author]
version: 24
updated_at: 2026-08-20T23:08:07.176Z
-->

Wraps `curl` commands with service-aware functionality for easier API interactions.

`curly` is a ~130-line bash script that wraps `curl` with a YAML service registry. Tokens live directly in `~/.curly.yaml`, kept private with `chmod 600`. One file, one place to edit.

**Source + install + full docs:** **https://github.com/wildeagency/curly**

## Why curly

```bash
# Without curly
curl -s -H "Authorization: Bearer tok_xxx" \
     -H "X-Ghost-User-Id: user_xxx" \
     "https://api.protocol.supply/@protocol/bootstrap"

# With curly
curly protocol bootstrap
```

That bearer token in the first command lands in `~/.zsh_history`, terminal scrollback, and any screen-share you do. The second one doesn't — it stays in `~/.curly.yaml` (chmod 600, owner-read-only).

## Install

Curly's repo is the source of truth: **https://github.com/wildeagency/curly#install**. Two paths, and **neither one passes a token through an agent** — tokens go from your clipboard into `curly init`'s hidden-input prompt (`stty -echo`) in your own terminal, landing directly in `~/.curly.yaml` at `chmod 600`.

### With an agent (Claude Code, Codex CLI, etc.)

Copy the [`curly-setup` skill](https://github.com/wildeagency/curly/tree/main/skills/curly-setup) into your agent's skills directory and ask it to run. The agent installs the script and wires PATH; for each service you name, it tells you the exact `curly init <service>` command to run **yourself, in your own terminal**. The agent never sees the token.

If any doc or agent asks you to paste API tokens into a chat window to set up curly, that flow is retired — point them at the repo.

### Manual

The README's manual section: install `yq`/`jq`, fetch the `curly` script to `~/.local/bin` (a readable file — no `curl … | sh`), `chmod +x`, then `curly init <service>` per service. Built-in host/auth defaults cover `protocol`, `notion`, `gh`, `slack`, `linear`, `airtable`, `posthog`, `n8n`, `clickup`, `mailgun`, `luma` — you only supply the token, via the hidden prompt.

Protocol.supply specifics (token creation, verification): `@protocol/install`.

## Set up a service

**This is the canonical setup flow. Every `@integrations/*` protocol defers here — none of them should restate it.**

```bash
curly init <service>
```

That's the whole thing. It prompts `Token for <service> (input hidden, blank to skip):` — paste, Enter. The token lands in `~/.curly.yaml` at `chmod 600`, never touching shell history, argv, or an agent transcript.

**Built-in services** need nothing but the token — host, auth mode, and any required headers are already in curly's table:

| Service | Host | Auth |
|---|---|---|
| `protocol` | `api.protocol.supply` | bearer |
| `notion` | `api.notion.com/v1` | bearer + `Notion-Version` |
| `gh` | `api.github.com` | bearer + `X-GitHub-Api-Version` |
| `slack` | `slack.com/api` | bearer |
| `linear` | `api.linear.app` | bearer |
| `airtable` | `api.airtable.com` | bearer |
| `posthog` | `us.posthog.com` | bearer |
| `apify` | `api.apify.com/v2` | bearer |
| `clickup` | `api.clickup.com/api/v2` | **raw** `Authorization` (no `Bearer`) |
| `mailgun` | `api.mailgun.net/v3` | basic |
| `n8n` | `localhost:5678/api/v1` | `X-N8N-API-KEY` |
| `luma` | `api.lu.ma` | cookie |

Verify with `curly doctor` (deps, file perms, gitignore hygiene) and one real call.

### Three things that are no longer true

Docs written before the YAML registry told you to do these. They are all retired — if you hit one, the doc is stale:

| Retired | Current |
|---|---|
| `SERVICE_TOKEN=…` in `~/.curly.conf` (or `.curly.json` / `.curly.env`) | `curly init <service>` → `~/.curly.yaml` |
| Hand-edit the `<service>)` case in `~/.local/bin/curly` | Service config is data in `~/.curly.yaml`; the script is never edited |
| Paste a token to an agent, or pass it as an argv | Hidden `stty -echo` prompt in **your own** terminal |

**Agents:** never run `curly init` from a shell tool — your stdin isn't the user's tty, so the prompt hangs. Print the command and let the user run it.

### Changing one field

`curly init` is also the *edit* path — re-run it on an existing service with `k=v` pairs. It leaves the token alone and doesn't re-prompt:

```bash
curly init notion Notion-Version=2026-03-11   # bump a header
curly init clickup auth=header auth_header=Authorization
curly init luma user_agent='Mozilla/5.0 …'
```

Reserved keys — `host`, `auth`, `auth_header`, `user_agent`, `token` — set that field. **Any other key becomes a request header**, which is how version pins like `Notion-Version` and `X-GitHub-Api-Version` are set. (`ghost-user=` is sugar for the `X-Ghost-User-Id` header.)

To try a value without persisting it, pass it per-call: `curly notion /… -H "Notion-Version: 2026-03-11"` (curl takes the last value of a repeated header).

## Adding a service

For a service **not** in the built-in table, supply host and auth once:

`curly init stripe host=https://api.stripe.com auth=bearer` — curly prompts for the token. Or edit `~/.curly.yaml` directly:

```yaml
services:
  stripe:
    host: https://api.stripe.com
    token: PASTE_YOUR_STRIPE_SECRET_KEY_HERE
    auth: bearer
```

Then `curly stripe /v1/customers | jq .data[0].email`.

Auth modes: `bearer`, `basic`, `header` (+`auth_header`), `cookie`, `none`. Worked examples for each — plus tokens baked into URL paths, conditional headers that drop when their var is empty, and the `${VAR}` escape hatch for vault tools like `op run` — live in [`examples/curly.yaml`](https://github.com/wildeagency/curly/blob/main/examples/curly.yaml).

## What's in the script

[All ~130 lines](https://github.com/wildeagency/curly/blob/main/curly). The hot path:

1. Discover every `.curly.yaml` in the chain (`$HOME` + ancestors of `$PWD`) and deep-merge (one `yq` call → JSON, then `jq` for fields).
2. Build a `curl` argv based on the `auth:` mode.
3. `exec curl`.

The subcommands (`services`, `doctor`, `init`) are a few lines each at the top, in a `case` statement.

## Security

`~/.curly.yaml` holds your tokens in cleartext. House rules:

- **`chmod 600 ~/.curly.yaml`.** Owner-only read/write. `curly init` sets this on creation; `curly doctor` warns if the file is world-readable.
- **Don't commit it.** `curly doctor` errors out if any `.curly.yaml` in the config chain is tracked by git (rotate immediately) and warns when a repo-local one isn't `.gitignore`d.
- **Host-override guard.** A project-local `.curly.yaml` that overrides `host` while inheriting a token from home is refused — that shape can exfiltrate credentials to an attacker-controlled endpoint. Opt in per-invocation with `CURLY_ALLOW_HOST_OVERRIDE=1`.
- **No `eval` on config values.** `${VAR}` expands via bash indirection; backticks and `$(…)` in YAML values pass through as literal text.

What curly does NOT protect against: tokens still show up in `ps aux` while a request is in flight (same risk as raw curl); tokens in your backup set go with the backup. The README at GitHub has the full threat-model breakdown.

What curly DOES protect against: tokens in shell history, terminal scrollback, screen-shares, and "share your screen real quick" pastes.


## Slack — you must override the Content-Type

`curly slack chat.postMessage -d channel=... -d text=...` fails with `{"ok":false,"error":"invalid_json"}`. curly sends `Content-Type: application/json` for this service, so Slack tries to JSON-parse a form-encoded body. Supplying a real JSON body together with your own `-H 'Content-Type: application/json'` then fails *differently* — `invalid_post_type` — because two Content-Type headers go on the wire.

The form that works, verified 2026-08-20:

```bash
curly slack chat.postMessage \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
  --data-urlencode 'channel=<channel-id>' \
  --data-urlencode 'text=Message text, including an em dash — and newlines.'
```

Use `--data-urlencode` rather than `-d`: message text routinely carries `&`, `=`, and newlines. The explicit `charset=utf-8` suppresses Slack's `missing_charset` warning.

**Both error strings are misleading** — neither `invalid_json` nor `invalid_post_type` names the header as the cause, and the first one points you at your payload, which is fine. That is the reason this is written down rather than re-derived.

---

*Related: `@integrations/linkedin` · `@integrations/agent-browser` · `@protocol/protocol-api` · `@content/youtube/dan-martell/it-s-actually-pretty-easy-to-get-ahead-of-99-of-people-with-ai` · `@content/youtube/dan-martell/i-tested-500-ai-tools-these-will-make-you-rich`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*