Skip to content

CLI

The hedge CLI is the fastest way for a broker to work with Hedge from a terminal or a script. It wraps the REST API 1:1 and handles OAuth 2.1 sign-in and token refresh for you. Source lives at github.com/taventech/hedge-cli.

Terminal window
npm i -g hedge-broker
Terminal window
hedge login

By default hedge login uses the OAuth 2.1 device flow: it prints a short code and a URL, you approve the sign-in in the broker portal, and the CLI stores a short-lived token. Two other modes:

Terminal window
hedge login --browser # loopback redirect on a machine with a browser
hedge login --client-id bac_... --client-secret bas_... # a machine credential, for scripts

The machine mode uses the client_credentials grant with an API key created under Settings → API keys in the portal. Prefer HEDGE_CLIENT_SECRET in the environment over the flag so the secret stays out of shell history; the token is cached with its expiry and renewed by re-exchange, and the secret is never printed. Writes made with a machine credential name the producing broker with --producer-email.

Check who you are signed in as with hedge whoami. For the full auth model, see Authentication.

The table below matches hedge-broker 0.4.0. Run hedge <command> --help for flags and examples on any command.

Command What it does
hedge intake [files...] [--text <text>|--text-file <path|->] [--insured <name>] [--lob <slugs>] [--state <ST>] [--effective <date>] [--producer-email <email>] [--hold] Send Hedge a risk as free text and/or PDFs (up to 20, 15 MB each). Creates the submission and starts the run. Requires --text/--text-file or --insured.
hedge submit --insured <name> --narrative <text> [flags] [--hold] Create a submission from structured fields and start the run. --body <file|-> sends a full JSON body, with explicit flags taking precedence.
hedge markets <submissionId> [--wait] [--timeout min] The markets being tried, in the three categories, with status, needs_from_you, assumptions ([ ] standing, [x] confirmed) and released quotes. --wait polls until a lane attaches.
hedge thread <submissionId> [--since cursor] [--limit n] [--one-page] The conversation with Hedge, oldest first, following next_cursor to the tail. --json returns {messages, next_cursor, last_cursor}.
hedge reply <submissionId> <text|-> [--attach ids] [--producer-email] Reply to Hedge exactly as you would reply to its email.
hedge answer-asks <submissionId> [--set k=v ...] [--producer-email] Answer the outstanding items the matched markets still need, in one batch. Without --set it lists them with their keys.
hedge upload <submissionId> <file.pdf> [--name label] Attach an ACORD, loss runs, or a supplement; it flows into the open lanes.
hedge requirements <submissionId> The gaps view: what the submission still needs (per market, forms, carrier questions).
hedge finalize <submissionId> [--wait] Release a held submission (one created with --hold).
hedge withdraw <submissionId> [--producer-email] Withdraw: a held draft is deleted, a live placement is pulled from every engaged market.
hedge status <submissionId> Submission detail plus the per-carrier marketing table, status roll-up, and documents on file.
hedge submissions [--status state] [--search q] [--limit n] [--offset n] [--updated-since iso] List your brokerage’s submissions, with filters and paging.
Command What it does
hedge bind <submissionId> --quote <quoteId> [--payment in_full|monthly] [--attest | --attest-keys k1,k2] [--producer-email] Request to bind a released quote. While assumptions stand unconfirmed the API answers 409 assumptions_unconfirmed; the CLI prints them and the exact re-run with --attest.
hedge bind-status <submissionId> [bindRequestId] Bind requests on a submission, or one in full: status, unconfirmed assumptions, contingencies with upload paths, next steps.
hedge bind-upload <submissionId> <bindRequestId> <contingencyId> <file.pdf> [--notes] Attach a PDF to a pre-bind contingency while the request is drafted.
hedge bind-submit <submissionId> <bindRequestId> [--attest | --attest-keys] Submit the drafted bind request to Hedge for placement.
Command What it does
hedge programs [--category c] [--lob slug] [--state ST] The carrier programs your brokerage can quote, one row per program with its category.
hedge program-schema <programId> [--lob slug] [--state ST] The application question schema for an instant-quote program, for your own application builder.
hedge appetite <class> [--state ST] [--lob slug] Which markets have appetite for a class of business.
hedge market-requirements <marketId> --lob <slug> [--state ST] [--programs keys] What a market needs to quote a line.
hedge forms [search] / hedge form <formKey> [-o file] Search the blank application-form catalog and download a blank.
hedge quotes <submissionId> / hedge answer <submissionId> <sessionId> --set k=v / hedge request-quote <submissionId> <sessionId> Work an instant-quote carrier session directly.
Command What it does
hedge documents <submissionId> / hedge download <documentId> [-o file] List a submission’s finalized documents and download one.
hedge policies / hedge policy <policyId> / hedge policy-doc <policyId> <kind> [-o file] Bound policies, one policy’s detail, and its binder, policy or declarations PDF.
hedge payments Payment and invoice status, with invoice links.
hedge whoami / hedge login / hedge logout Identity and sign-in.

Prefer building the request in a file or another program? hedge submit --body sends a full JSON body; explicit flags still win. hedge intake --text-file - and hedge reply <id> - read from stdin.

Terminal window
hedge submit --body ./submission.json --hold
cat notes.txt | hedge intake ./acord-125.pdf --text-file - --producer-email dana@youragency.com

Every intake, submit and reply sends an Idempotency-Key header (a random UUID each run). A scripted retry that must not double-create should pass its own key with --idempotency-key <key>.

  1. Send the risk; the run starts:

    Terminal window
    hedge intake ./acord-125.pdf ./loss-runs.pdf \
    --text "Acme Roofing LLC, residential roofing contractor in San Jose CA, 12 employees, no prior losses. GL and property, effective 2026-10-01."
  2. Read the three categories once matching lands:

    Terminal window
    hedge markets <submission-id> --wait
  3. Answer what only your brokerage can answer:

    Terminal window
    hedge thread <submission-id>
    hedge reply <submission-id> "Payroll is 900k. No hot-tar work."
    hedge answer-asks <submission-id> --set years_in_business=8
    hedge upload <submission-id> ./supplement.pdf
  4. Bind, with attestation:

    Terminal window
    hedge bind <submission-id> --quote <quote-id> # 409 lists the assumptions
    hedge bind <submission-id> --quote <quote-id> --attest # after the agent reviewed them
    hedge bind-upload <submission-id> <bind-request-id> <contingency-id> ./signed-app.pdf
    hedge bind-submit <submission-id> <bind-request-id>
  5. Read results:

    Terminal window
    hedge bind-status <submission-id> <bind-request-id>
    hedge documents <submission-id>
    hedge policies
    hedge policy <policy-id>