Developers

Your first hug, in sixty seconds.

One command installs hug, the tool for making templates — the pages people answer on. A single file: nothing else to install to run it.

curl -fsSL https://get.gethugs.ai/hug/install.sh | sh

macOS on Apple silicon, and Linux (arm64, x64). It adds ~/.hugs/bin to your PATH; open a new terminal, then run hug --help.

Your first template

Scaffold it, try it as you edit, and build the one file you install in getHugs. Templates are npm projects, so you’ll want Node 24.

terminal
hug new my-approval
cd my-approval && npm install
hug dev # try it in the browser as you edit
hug build # → dist/my-approval.hug — install it in getHugs
Templates

@gethugs/template-kit

What a template is asked and what a valid answer is — typed with Zod and checked on both sides — plus the runtime and UI kit its page is written against. Plain web components or React.

npm install @gethugs/template-kit
hug.ts
import { define_hug } from '@gethugs/template-kit/define';
import { z } from 'zod';

export default define_hug({
  name: 'expense-check',
  title: 'Check an expense',
  params: z.object({ merchant: z.string(), amount: z.number() }),
  values: z.object({
    ok: z.boolean(),
    note: z.string().max(500).optional(),
  }),
});
Asking from code

@gethugs/client

Hugging, in one call. ask() opens the Hug, waits for the answer — across timeouts, retries and restarts, without asking twice — and hands it back, typed. Node, Bun, Deno and edge runtimes.

npm install @gethugs/client
ask.ts
import { HugsClient } from '@gethugs/client';

const hugs = HugsClient.from_env();  // reads HUGS_URL, HUGS_KEY, …

const r = await hugs.ask({
  key: 'invoice-1042-approval',  // same key → same Hug
  template: 'tpl_approval',
  title: 'Approve invoice 1042',
  params: { prompt: 'Approve **$12,400** from Acme?' },
  channels: ['finance'],
  expires_in_min: 1440,
});
r.value.decision;  // 'approve' | 'reject'
Any language

The HTTP API

JSON over HTTPS, one POST per action. Your source’s key, your workspace, and an Idempotency-Key so a retry finds the same Hug. Then wait for the answer with hugs/wait.

terminal
curl https://api.gethugs.ai/v1/hugs/create \
  -H "Authorization: Bearer $HUGS_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: invoice-1042-approval" \
  -d '{ "workspace_id": "ws_…", "template": "tpl_approval",
        "title": "Approve invoice 1042",
        "params": { "prompt": "Approve **$12,400**?" },
        "channels": ["finance"], "expires_in_min": 1440 }'

Where next