Skip to content

Latest commit

 

History

History
408 lines (271 loc) · 8.25 KB

File metadata and controls

408 lines (271 loc) · 8.25 KB

Command Reference

Global Options

These flags go before the command:

bcli [global-options] <command> [command-options]
Flag Short Description
--profile <name> -p Use a specific profile
--env <name> -e Override environment name
--company <id-or-alias> -c Override company (alias, GUID, or all)
--format <type> -f Output format: table, json, csv, ndjson, raw
--verbose -v Show resolved URLs and timing
--debug Show full HTTP request/response
--dry-run Preview without executing
--quiet -q Suppress context banner
--version -V Show version

config

config init

Interactive setup wizard. Defaults to browser auth and discovers companies automatically.

bcli config init
bcli config init --automation
bcli config init --headless
Option Description
--auth <method> browser, client-credentials, or device-code
--automation Shortcut for client credentials
--headless Shortcut for device code
--scoped Hide standard APIs; only imported endpoints are visible
--import <file> Import custom endpoints after profile creation

config show

Print resolved configuration (secrets redacted).

bcli config show

config set

Set a configuration value.

bcli config set <key> <value>

Key format: defaults.<field> or profiles.<name>.<field>

bcli config set defaults.format json
bcli config set profiles.prod.environment Production

config use

Switch the active profile.

bcli config use <profile-name>

auth

auth login

Authenticate and cache a token.

bcli auth login [--method <method>] [--incognito]
Option Short Description
--method <method> -m browser, device, or client_credentials (default: profile's auth_method)
--incognito -i Open the browser in incognito/private mode — useful for logging in as a different user

Examples:

bcli auth login                              # uses profile's auth_method
bcli auth login --method browser             # browser OAuth (user's BC permissions, PKCE)
bcli auth login --method device              # device code flow
bcli auth login --method client_credentials  # service-to-service

See Authentication for method details.

auth status

Show token cache and keychain status.

bcli auth status

auth logout

Clear cached tokens for the active profile.

bcli auth logout

auth store-secret

Store client secret in the OS keychain.

bcli auth store-secret

auth delete-secret

Remove client secret from the OS keychain.

bcli auth delete-secret

env

env list

List available BC environments.

bcli env list

env use

Set the default environment. Clears company selection.

bcli env use <environment-name>

company

company list

List all companies in the current environment.

bcli company list

company use

Set the default company.

bcli company use <company-id-or-alias>

company alias

Assign a nickname to a company.

bcli company alias <name> <company-id> [--name <display-name>]

company aliases

Show all configured aliases.

bcli company aliases

endpoint

endpoint list

List all known endpoints.

bcli endpoint list [--custom] [--standard] [--category <name>]

endpoint search

Fuzzy search endpoints.

bcli endpoint search <query>

endpoint info

Show detailed metadata for an endpoint.

bcli endpoint info <entity-set-name>

registry

registry import

Import custom API endpoints.

bcli registry import --from-postman <file.json> [--profile <name>]
bcli registry import --from-json <file.json> [--profile <name>]
bcli registry import --from-metadata [--profile <name>]

registry list

Show imported registries.

bcli registry list

get

Query records from an entity.

bcli get <endpoint> [<record-id>] [options]
Option Description
--filter <expr> OData $filter expression
--select <fields> Comma-separated field names
--expand <navs> Comma-separated navigation properties
--orderby <expr> OData $orderby expression
--top <n> Maximum records to return
--skip <n> Records to skip
--count Include total record count
--all Follow pagination for all records
--publisher <name> Custom API publisher override
--group <name> Custom API group override
--version <name> Custom API version override

post

Create a new record.

bcli post <endpoint> --data <json-or-@file> [--publisher ...] [--group ...] [--version ...]

patch

Update an existing record.

bcli patch <endpoint> <record-id> --data <json-or-@file> [--etag <tag>] [--publisher ...] [--group ...] [--version ...]

delete

Delete a record.

bcli delete <endpoint> <record-id> [--etag <tag>] [--publisher ...] [--group ...] [--version ...]

test

test connection

Test auth and API reachability.

bcli test connection

test auth

Test authentication only.

bcli test auth

test endpoint

Test a specific endpoint (GET $top=1).

bcli test endpoint <entity-set-name>

batch

batch run

Execute a YAML batch file. Supports workflow-style step chaining, parameters, and result capture.

bcli batch run <file.yaml> [options]
Option Short Description
--dry-run Print resolved requests without executing
--output <path> -o Save full results (all steps + records + metadata) to a JSON file
--format <fmt> -f Print each step's returned data inline (table, json, csv, ndjson)
--set key=value Set a workflow parameter (repeatable). Values auto-typed (YAML scalar rules).
--params <file> Load workflow parameters from a YAML mapping file

Examples:

# Preview only
bcli batch run workflow.yaml --dry-run

# Run with parameters and save JSON
bcli batch run workflow.yaml --set vendor=V00011 --set month=2026-03 -o results.json

# Run with a params file and print each step's rows as a table
bcli batch run workflow.yaml --params month-end.yaml -f table

See Batch Operations for step chaining, parameter syntax, and ${{ steps.<id>.data }} references.


ai-context

Dump LLM-ready usage instructions for the CLI. Useful for priming Claude / agents.

bcli ai-context [--format json|text]

Emits a compact reference covering command syntax, OData filter quirks, output formats, and common workflows. Pipe the output into a system prompt or save it as context for LLM agents.


etl (optional — requires bc-cli[etl])

Extract Business Central data via dlt pipelines. Available only when the etl extra is installed (pip install 'bc-cli[etl]').

etl entities

List entities available for ETL extraction.

bcli etl entities [--include-standard]

By default shows only custom API endpoints for the active profile. Pass --include-standard to include the 79 built-in v2.0 entities.

etl sync

Extract data and load to a dlt destination.

bcli etl sync [options]
Option Short Description
--entities <list> Comma-separated entity names (default: all custom endpoints)
--destination <dest> -d dlt destination: filesystem, duckdb, iceberg (default: filesystem)
--dataset <name> Dataset name in destination (default: bc_raw)
--pipeline <name> Pipeline name for state tracking (default: bcli_etl)
--full-refresh Ignore cursor; reload everything
--include-standard Also sync standard v2.0 entities (skipped by default — usually handled by Fivetran)

Examples:

bcli etl sync --destination filesystem
bcli etl sync --entities customers,vendors --destination duckdb
bcli etl sync --full-refresh --destination iceberg