Skip to content

CLI

The hedge CLI (npm hedge-broker) runs the API flow from a terminal or a script and handles sign-in and token renewal for you. Source lives at github.com/taventech/hedge-cli.

Terminal window
npm i -g hedge-broker
Terminal window
hedge login # device code (default)
hedge login --browser # browser sign-in on this machine
hedge login --client-id bac_... --client-secret bas_... # an API key, for scripts

The API key mode exchanges a key from Settings → API keys for a token and renews it when it expires. Prefer HEDGE_CLIENT_SECRET in the environment over the flag so the secret stays out of shell history. With an API key, every submit command names the producing broker with --producer-email.

hedge whoami shows who you are signed in as. See Authentication for the full model.

Flag
--sandbox Use the sandbox (sandbox-api.hedgespecialty.com). Sign-ins are kept per environment.
--json Print the API’s JSON instead of tables. Errors print their JSON body too, with a non-zero exit code.
  1. Check appetite and read what the markets need:

    Terminal window
    hedge appetite "Residential landscaping, 6 employees" --state CA --lines gl --naics 561730
    hedge requirements --state CA --lines gl --naics 561730
  2. Create the file (or hedge intake with PDFs):

    Terminal window
    hedge create --insured "Green Thumb Landscaping LLC" \
    --narrative "Residential landscaping and lawn care, 6 employees." \
    --lines gl --state CA --naics 561730 --effective 2026-11-15 \
    --set annual_revenue=850000 --set employee_count=6 \
    --client-reference AI-9f3c2b --quote --producer-email dana@youragency.com
  3. Follow it and answer the gaps:

    Terminal window
    hedge status <submission-id> --wait
    hedge answer <submission-id> --confirm-suggestions
    hedge answer <submission-id> --set annual_revenue=900000 # correct a fact
  4. Quote, then read the quotes and save every PDF:

    Terminal window
    hedge quote <submission-id> --wait
    hedge quotes <submission-id> --download ./quotes
  5. Get the bind link:

    Terminal window
    hedge bind-link <submission-id> <quote-id>

This matches hedge-broker 0.5. Run hedge <command> --help for every flag.

Command What it does
hedge appetite [description] --state <ST> --lines <lines> [--naics <code>] Which Hedge Instant Quote markets will quote the risk (POST /broker/appetite/instant). When none fits, prints the email_us block.
hedge requirements --state <ST> --lines <lines> [--programs <ids>] [--naics] [--description] The core fields and each market’s questions (POST /broker/requirements). Without --programs, uses every instant market appetite returns.
hedge create [applicant flags] [--programs <ids>] [--set ...] [--client-reference <ref>] [--quote] [--file <payload.json|->] [--producer-email] Create the file (POST /broker/submissions). Flags or a full JSON body with --file; flags win. submit is an alias.
hedge intake [files...] [--text <text>|--text-file <path|->] [--insured] [--lines] [--state] [--effective] [--programs] [--client-reference] [--quote] [--producer-email] Create the file from PDFs and text (POST /broker/intake). Same result as create.
hedge status <id> [--wait] [--timeout <min>] Each market’s state, what it is missing and what Hedge suggested (GET .../instant-quotes). --wait polls until no market is preparing or quoting.
hedge answer <id> [--set ...] [--confirm-suggestions] [--file <answers.json>] [--producer-email] Answer the gaps (PATCH .../answers), all or nothing. --confirm-suggestions confirms every value Hedge suggested (suggested[]) as it stands.
hedge business <id> [--insured] [--address --city --state --zip] [--contact-name] [--contact-email] [--contact-phone] [--effective] [--naics [--description]] [--producer-email] Correct the file’s core facts (PATCH .../business): name, mailing address, the insured’s contact, class, effective date. Use it when status points a gap at it or answer refuses a core field. The markets re-prepare.
hedge quote <id> [--programs <ids>] [--wait] [--producer-email] Request quotes for the ready markets (POST .../quote); prints each market’s outcome.
hedge quotes <id> [--download [dir]] The itemized quotes (GET .../quotes). --download saves every quote PDF to dir (default: the current directory): Hedge’s quote PDF, the carrier PDFs Hedge stored and carrier-hosted PDFs; other carrier-hosted pages (an online proposal) are listed. Hedge prepares its quote PDF on the first read, so a second run a few seconds later picks it up.
hedge bind-link <id> <quoteId> [--for broker|insured] [--insured-email <email>] [--attest] [--producer-email] The link to bind the quote: the portal’s bind checklist, or the insured’s pay-and-bind page.
hedge events [--since <cursor>] [--limit <n>] Your brokerage’s events feed (GET /broker/events), followed to the tail; prints the cursor to resume from.

Applicant flags on create: --insured, --narrative, --lines, --state, --naics, --effective, --website, --fein, --entity-type, --business-phone, --business-email, --contact-first, --contact-last, --contact-email, --contact-phone, and the mailing address (--address, --address2, --city, --zip, with --state).

--set (repeatable, on create and answer) takes:

Form Sends
key=value shared_answers[key]. Numbers and true/false are typed; everything else is a string.
key:=json shared_answers[key] as exact JSON, e.g. --set 'zip:="95610"' or --set 'lines:=["gl"]'.
<programId>:<id>=value answers[programId][id]: one market’s own question. := works here too.

key is a question’s canonical key from hedge requirements; id is the market’s own question id.

Command What it does
hedge submissions [--status] [--search] [--limit] [--offset] [--updated-since] List your brokerage’s files.
hedge upload <id> <file.pdf> [--name] Attach a document to a file.
hedge documents <id> / hedge download <documentId> [-o file] List a file’s documents and download one.
hedge withdraw <id> [--producer-email] Withdraw a file.
hedge forms [search] / hedge form <formKey> [-o file] Search the blank application forms (ACORDs, Hedge supplementals) and download one, for risks you email Hedge.
hedge policies / hedge policy <policyId> / hedge policy-doc <policyId> <kind> [-o file] Bound policies, one policy, and its binder, policy or declarations PDF.
hedge payments Payment and invoice status.
hedge login / hedge logout / hedge whoami Sign-in and identity.
  • hedge create --file payload.json sends a full body (- reads stdin); explicit flags win over the file.
  • Always pass --client-reference from a script. The same reference returns the existing file instead of creating another, so a retry is safe.
  • create and intake send an Idempotency-Key (a random UUID per run, or --idempotency-key <key>).
  • Exit codes: 0 on success, 1 on any error. hedge quote also exits 1 when no market could be requested.
  • The CLI stops on a 403 and prints the Retry-After wait on a 429; it never retries either for you.
Terminal window
hedge --json status <submission-id> | jq '.markets[] | {market, state, missing: [.missing[].label]}'