@eidra-bloodline/cli
v0.2.0
Published
`@eidra-bloodline/cli` is the command-line interface for working with Bloodline from a terminal, shell script, CI job, or local automation. It wraps the public Bloodline API and authentication flow so you can search companies, run saved filters, inspect c
Readme
@eidra-bloodline/cli
@eidra-bloodline/cli is the command-line interface for working with Bloodline from a terminal, shell script, CI job, or local automation. It wraps the public Bloodline API and authentication flow so you can search companies, run saved filters, inspect company-level details, and fetch timeline events without writing a custom client.
This package is aimed at operators, analysts, internal tooling, and scripts that need a stable command surface with machine-readable output.
What The CLI Can Do
- Authenticate with Bloodline using the device login flow.
- Discover which tenants are available to the current user.
- Search companies by name or org number.
- Narrow company search results with financial filters such as revenue, EBITDA, employee count, country, and industry.
- Fetch a single company record.
- Fetch a company timeline by org number.
- List saved filters and run them with pagination.
- Fetch company details for one company or many company IDs from a file.
- Return output as
table,json,ndjson, orcsvdepending on whether the target is a human or another program.
Installation
Install globally:
pnpm add -g @eidra-bloodline/cliAlternative package managers:
npm install -g @eidra-bloodline/cliyarn global add @eidra-bloodline/cliVerify the binary is available:
bloodline --helpQuick Start
Authenticate first:
bloodline auth loginInspect your current session and config:
bloodline auth status
bloodline auth debugSearch companies:
bloodline companies search "Eidra"Search by org number instead of company name:
bloodline companies search "SE5592282270" --orgnr --format jsonFetch a timeline for a company:
bloodline companies timeline SE5592282270 --limit 25 --format jsonShell Completions
The CLI can generate shell completion scripts. Add one of the following to your shell profile:
# zsh (~/.zshrc)
eval "$(bloodline --completions zsh)"
# bash (~/.bashrc)
eval "$(bloodline --completions bash)"
# fish (~/.config/fish/config.fish)
bloodline --completions fish | sourceCommand Overview
Top-level commands:
bloodline authbloodline filtersbloodline companiesbloodline company-detailsbloodline health
The CLI also normalizes arguments so options can be written before or after positionals in supported subcommands. Conventional ordering is still recommended in documentation and scripts.
Configuration
The CLI resolves configuration from three places, in this order:
- Environment variables.
- A JSON config file.
- Built-in defaults.
Default Paths
- Config file:
~/.bloodline/config.json - Token file:
~/.bloodline/tokens.json
Environment Variables
These variables are supported by the CLI and underlying public client:
BLOODLINE_API_BASE_URLBloodline API base URL. Default:https://bloodline-api.eidra.comBLOODLINE_AUTH_BASE_URLFusionAuth base URL. Default:https://bloodline-iam.eidra.comBLOODLINE_AUTH_CLIENT_IDOptional auth client ID override.BLOODLINE_AUTH_CLIENT_SECRETOptional auth client secret override. Only needed when your auth policy requires it.BLOODLINE_AUTH_SCOPESSpace-delimited OAuth scopes. If omitted, the CLI builds a default scope set fromopenid offline_accessplus any extra scopes inBLOODLINE_SCOPES.BLOODLINE_SCOPESComma-delimited extra scopes merged into the default set.BLOODLINE_SCHEMA_VERSIONOptional schema version override.BLOODLINE_CONFIG_FILEPath to the JSON config file.BLOODLINE_TOKEN_FILEPath to the token store file.
Config File Example
Minimal example:
{
"apiBaseUrl": "http://localhost:3102",
"authBaseUrl": "https://bloodline-iam.eidra.com"
}Full example:
{
"apiBaseUrl": "http://localhost:3102",
"authBaseUrl": "https://bloodline-iam.eidra.com",
"authClientId": "my-client-id",
"authClientSecret": "my-client-secret",
"authScopes": "openid offline_access profile",
"schemaVersion": "v0",
"mcpPort": 3000,
"tokenFilePath": "/Users/alice/.bloodline/tokens.json"
}Local Development Example
If you are pointing the CLI at a local API:
export BLOODLINE_API_BASE_URL=http://localhost:3102
export BLOODLINE_AUTH_BASE_URL=https://bloodline-iam.eidra.comTo use a custom config file for a project or test environment:
export BLOODLINE_CONFIG_FILE="$PWD/.bloodline.config.json"Inspect Effective Configuration
To see the exact config, auth state, endpoints, and active tenants the CLI is using:
bloodline auth debugThis is the first command to run if the CLI is talking to the wrong API, using the wrong auth base URL, or reading the wrong token/config file.
Authentication
The CLI uses device-based authentication.
bloodline auth login
Starts login.
bloodline auth loginWhat happens:
- The CLI fetches the list of active clients or tenants.
- If there is exactly one active tenant, it uses it automatically.
- If there are multiple tenants and the terminal is interactive, it prompts you to choose one.
- If there are multiple tenants and the session is non-interactive, you must pass
--tenant-id. - The CLI prints a JSON object containing the device flow information and a verification URL.
Login with an explicit tenant:
bloodline auth login --tenant-id 605d1740-6f43-4ef8-9bc7-28aa2c7dc36cTypical automation-safe usage:
bloodline auth login --tenant-id <tenantId>bloodline auth status
Shows whether you are authenticated and prints a token preview.
bloodline auth statusThis is useful in scripts before issuing data queries.
bloodline auth debug
Prints:
- Effective config.
- Which environment variables are overriding defaults.
- Which API and auth endpoints are in use.
- The list of active clients.
- Current auth status and token preview.
bloodline auth debugbloodline auth logout
Clears the stored token set.
bloodline auth logoutCompanies
The companies group supports search, direct lookup, and timeline retrieval.
bloodline companies search
Searches companies by name by default.
bloodline companies search "ai infrastructure" --limit 50 --format jsonSupported options:
--orgnrTreats the query as an org number lookup instead of a name search.--where <value>Legacy opaque filter string passed through to the API. Use only if you already know the server-side contract.--sort <value>Opaque sort payload passed through to the API.--limit <number>Maximum rows returned for this page. Default:100--cursor <value>Cursor for paginated search.--format <table|json|ndjson|csv>Output format.--min-revenue <number>Minimum revenue filter.--max-revenue <number>Maximum revenue filter.--min-employees <number>Minimum employee count filter.--max-employees <number>Maximum employee count filter.--min-ebitda <number>Minimum EBITDA filter.--max-ebitda <number>Maximum EBITDA filter.--country <value>Country code filter.--industry <value>Industry filter.
Examples:
Search by name:
bloodline companies search "Eidra"Search by org number:
bloodline companies search "SE5592282270" --orgnr --format jsonSearch with financial constraints:
bloodline companies search "software" \
--min-revenue 1000000 \
--max-revenue 500000000 \
--min-employees 10 \
--country SE \
--limit 25 \
--format jsonPaginate manually:
bloodline companies search "fintech" --limit 100 --cursor 100 --format jsonPipe into other tools:
bloodline companies search "Eidra" --format ndjson | jq .bloodline companies get
Fetches a single company record by company ID.
In practice, this is typically an org number or a company identifier returned by companies search.
bloodline companies get SE5592282270 --format jsonSupported options:
--format <table|json|ndjson|csv>
bloodline companies timeline
Fetches a timeline for a company by org number.
bloodline companies timeline SE5592282270 --limit 25 --format jsonSupported options:
--limit <number>Maximum number of events returned by the CLI output. Default:100--format <table|json|ndjson|csv>
Current timeline output contains:
orgnrcompanyNameeventCountevents
The underlying API can return event types such as:
news_articleannual_report_insightannual_report_filingcompany_movelinkedin_snapshotjob_posting
Examples:
bloodline companies timeline SE5592282270 --format jsonbloodline companies timeline SE5592282270 --limit 10 --format ndjsonA company timeline can legitimately be empty. In that case, the CLI still returns a valid response with eventCount: 0 and an empty events array.
Filters
The filters group lets you inspect and execute saved Bloodline filters.
bloodline filters list
Lists available filters.
bloodline filters list --format tableSupported options:
--format <table|json|ndjson|csv>
bloodline filters run
Runs a saved filter by ID.
bloodline filters run <filterId> --limit 100 --format ndjsonSupported options:
--since <timestamp>Optional lower-bound timestamp.--limit <number>Rows to return for the current page. Default:100--cursor <value>Cursor for pagination.--format <table|json|ndjson|csv>
Examples:
bloodline filters list --format jsonbloodline filters run 94a6f5c1-aaaa-bbbb-cccc-123456789abc --limit 250 --format csvbloodline filters run 94a6f5c1-aaaa-bbbb-cccc-123456789abc \
--since 2026-01-01T00:00:00Z \
--limit 100 \
--format ndjsonCompany Details
The company-details group fetches extended values for one or more companies.
bloodline company-details get
Fetch for one company:
bloodline company-details get SE5592282270 --columns intent_score,buying_stage --format jsonFetch for many companies from a file:
bloodline company-details get --file ids.txt --columns intent_score,buying_stage --format ndjsonSupported options:
--file <path>Read company IDs from a file instead of providing a single positionalcompanyId.--columns <comma,separated,list>Restrict the returned columns.--format <table|json|ndjson|csv>
Behavior notes:
- If
--fileis provided, the positionalcompanyIdis not required. - The file should contain one company ID per line.
- Blank lines are ignored.
- In file mode, the CLI returns an array of records.
Example ids.txt:
SE5592282270
SE5566778899
SE1122334455Output Formats
All data commands support four output formats:
tablejsonndjsoncsv
table
Best for interactive terminal use.
- Arrays render as a simple text table.
- Empty arrays render as
(no rows). - Nested objects are stringified into a single cell.
Example:
bloodline filters list --format tablejson
Best for inspection, debugging, and piping into tools that expect a single JSON value.
bloodline companies get SE5592282270 --format json | jq .ndjson
Best for line-oriented processing when each row should be handled independently.
bloodline companies search "Eidra" --format ndjsoncsv
Best for spreadsheets and flat exports.
bloodline company-details get --file ids.txt --columns intent_score --format csvNotes on CSV output:
- CSV columns are taken from the keys of the first row.
- Nested objects are JSON-stringified into a cell.
nullandundefinedvalues become empty strings.
Automation Patterns
Fail Fast On Auth Before Running Data Commands
bloodline auth status >/dev/null && bloodline companies search "Eidra" --format jsonUse JSON Or NDJSON In Scripts
Prefer json or ndjson over table for scripts.
bloodline companies search "Eidra" --format json | jq '.[0].companyId'bloodline filters run <filterId> --format ndjson | jq .companyIdUse Explicit Tenant IDs In CI
Interactive tenant selection requires a TTY. CI jobs usually do not have one.
bloodline auth login --tenant-id <tenantId>Pin Local API Targets Explicitly
If you are testing locally, export the API base URL instead of relying on shell history or implicit defaults.
export BLOODLINE_API_BASE_URL=http://localhost:3102
bloodline auth debugCommon Workflows
Find A Company And Inspect It
bloodline companies search "Eidra" --limit 5 --format json
bloodline companies get SE5592282270 --format jsonSearch By Financial Profile
bloodline companies search "software" \
--min-revenue 5000000 \
--min-employees 20 \
--max-ebitda 100000000 \
--country SE \
--format jsonRun A Saved Filter And Export Results
bloodline filters run <filterId> --limit 500 --format csv > filter-results.csvEnrich A Known Company List
bloodline company-details get \
--file ids.txt \
--columns intent_score,buying_stage,employee_count \
--format ndjsonFetch Timeline Data For Review
bloodline companies timeline SE5592282270 --limit 50 --format json | jq .eventsTroubleshooting
The CLI Is Pointing To The Wrong API
Run:
bloodline auth debugCheck:
effectiveConfig.apiBaseUrlenvOverrides.apiBaseUrleffectiveConfig.configFilePath
Login Fails In CI Or Non-Interactive Shells
If there are multiple available tenants, interactive selection will fail without a TTY.
Use:
bloodline auth login --tenant-id <tenantId>No Companies Or Timeline Events Are Returned
Possible reasons:
- The query is too strict.
- The org number is malformed.
- The company exists but there are no timeline events yet.
- You are pointed at the wrong environment.
Check with:
bloodline auth debug
bloodline companies search "<value>" --format jsonCompany Details File Import Fails
Check that:
- The file exists.
- It is readable by the current user.
- It contains one company ID per line.
- There are no unexpected separators.
Output Is Hard To Parse In Scripts
Use json, ndjson, or csv, not table.
Package Development
If you are working on the CLI package itself inside this repository:
pnpm -C packages/cli typecheck
pnpm -C packages/cli test
pnpm -C packages/cli buildRun the CLI from source in the monorepo:
pnpm -C packages/cli exec tsx src/main.ts auth debugpnpm -C packages/cli exec tsx src/main.ts companies search "Eidra" --format jsonSummary
Use the Bloodline CLI when you need Bloodline data from a terminal, script, or automation environment. Start with bloodline auth login, inspect configuration with bloodline auth debug, and prefer json or ndjson whenever another program needs to consume the results.
