Skip to main content
The Happenstance CLI (hpn) gives you access to the full Happenstance API from your terminal. All output is JSON, so you can pipe results to jq or integrate with scripts.

Install

Requires Python 3.11+.

Configure

Get your API key from the Settings page, then:
The API key can also be provided via the HPN_API_KEY environment variable or the --api-key flag on any command. Priority: flag > env var > config file. Verify your configuration:

Commands

CommandDescription
hpn config set --api-key KEYSave your API key
hpn config showShow saved API key (masked)
hpn search "query"Search your network
hpn search get IDGet search results by ID
hpn search find-more IDFind additional results for an existing search
hpn research "description"Research a person
hpn research get IDGet research results by ID
hpn friendsList your friends (useful for @mentions)
hpn groupsList your groups
hpn groups get IDGet group details and members
hpn usageShow credit balance and usage

Search Your Network

By default, the CLI waits for the search to complete and prints the results. Use --no-wait to get the search ID immediately and poll later:

Scope Control

Control where to search with scope flags. When no flags are specified, all sources are searched.

@Mentions

Filter results to a specific person’s connections using @mentions in your query:
Use hpn friends or hpn groups get ID to look up names for @mentions.

Find More Results

If a search returns has_more: true, get additional results (costs 2 credits):

Research a Person

Include as much detail as possible (full name, company, title, social handles) for best results. The CLI waits for the research to complete (up to 10 minutes). Use --no-wait to return the research ID immediately:

Check Credits

Returns your credit balance, purchase history, usage history, and auto-reload settings.

Pipe to jq

All output is JSON. Combine with jq for filtering and formatting:

Need Help?

Support

Contact our support team