Skip to main content

Kommandozeilen-Client für die NorthData-API mit Credit Guard.

Project description

northdata-cli

A command-line client for the NorthData API with a built-in credit guard.

northdata-cli wraps the relevant NorthData endpoints (suggest, power search, company, person, publications, reference, billing) behind a clean, installable CLI. It is usable interactively by humans and unattended by scripts or agents — every command emits JSON by default and a pretty table with --pretty.

Why a credit guard? NorthData charges per returned company, not per HTTP call. A single search --limit 100 can burn 100 credits in one request. This CLI refuses unapproved high-limit calls and keeps a local append-only log of every billed call it makes.


Installation

Regular install (Recommended)

pipx install northdata-cli
# or
pip install northdata-cli

One-shot via uvx (no install)

uvx northdata --help

Editable install for development

git clone https://github.com/p-meier/northdata-connectors.git
cd northdata-connectors/northdata-cli
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

Configuration

API key (required)

Set the NORTHDATA_API_KEY environment variable:

export NORTHDATA_API_KEY="XXXX-XXXX"

Or pass it per invocation:

northdata suggest "Example GmbH" --api-key XXXX-XXXX

Get a key at https://www.northdata.com.

Optional: credit guard thresholds

export NORTHDATA_APPROVAL_THRESHOLD=25   # above this, --approve-high-cost is required
export NORTHDATA_ABSOLUTE_MAX=100        # absolute ceiling for --limit
export NORTHDATA_CREDIT_LOG=~/.northdata/credits.jsonl  # override log path

Quickstart

# Free: discover what the API knows about a company name
northdata suggest "Siemens" --pretty

# Free: show your current credit usage for the period
northdata billing --pretty

# Billed (1 credit): full company profile by register
northdata company --register "HRB123456/Muenchen" --pretty

# Billed (up to --limit credits): power search with filters
northdata search \
    --segment-codes "62|63" \
    --legal-forms "GmbH|UG" \
    --address "Munich" --max-distance-km 150 \
    --revenue-min 5000000 --revenue-max 50000000 \
    --limit 5 --pretty

# Peek without spending credits
northdata search --segment-codes "62" --legal-forms "GmbH" --limit 5 --dry-run

Credit guard

Every billable command respects a two-tier ceiling on --limit:

Tier Default Override
Approval threshold (requires --approve-high-cost to exceed) 25 NORTHDATA_APPROVAL_THRESHOLD
Absolute maximum (hard stop, flag-immune) 100 NORTHDATA_ABSOLUTE_MAX

On top of that, every billed call is appended to ~/.northdata/credits.jsonl:

northdata credits --pretty

The local log is informational — the NorthData billing endpoint (northdata billing) remains the source of truth for actual credit consumption.

--dry-run

Any billable command with --dry-run builds the request URL and returns it without calling the API. Zero credits spent.

northdata company --register "HRB123456/Muenchen" --dry-run

Command reference

Command Billed Purpose
suggest QUERY Autocomplete for company / person names
search [filters] up to --limit Power search
company --register | --name 1 Full company profile
person FIRST LAST 1 Person lookup (incl. birth date)
publications [--name | --register] 1 Publications (e.g. shareholder lists)
reference overview | segments API reference data
billing Current credit usage for the billing period
credits Local credit log (this CLI only)

Use northdata COMMAND --help for the full option list.

Output formats

  • Default: JSON on stdout, pipeable into jq and friends.
  • --pretty / -p: Rich table on stderr-free stdout for humans.

Exit codes

Code Meaning
0 Success
2 Configuration error (missing key, bad argument)
3 Credit guard refused the request
4 NorthData API error (HTTP 4xx / 5xx / timeout)

Development

pip install -e ".[dev]"
pytest
pytest --cov

Tests use httpx.MockTransport — no network access required for the unit test suite.


License

MIT. See LICENSE.


Project status

This CLI is the library layer for the northdata-mcp MCP server and the northdata Claude skill. The client and credit guard are written to be importable as a Python library so those layers can reuse them directly without shelling out.

See the monorepo root for the full picture.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

northdata_cli-0.1.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

northdata_cli-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file northdata_cli-0.1.0.tar.gz.

File metadata

  • Download URL: northdata_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for northdata_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab77fb4d8580686eb34966e08b5bfde3ca656554918880a33307af46d088b4c5
MD5 af2d6d0d4576d5f4d980576fc2931e98
BLAKE2b-256 077a7883d06c97fd449c872d46b1bea918344d6f5c0ada5864f5fe772a5fad42

See more details on using hashes here.

File details

Details for the file northdata_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: northdata_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for northdata_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff4db986f9d552236d0f9868221f5c35a9091a2661bc1e1e243c73f9c38368bc
MD5 4cb4b57474a029f3dea1e85075514624
BLAKE2b-256 df7f0074038d31a46a31873c9bba3d73a18b9140d7d1f8f5f26c57d62d9f32f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page