buk is an independent, unofficial Go CLI wrapper for the inFakt API v3. It is designed for shell-capable AI agents that need to discover the API contract before executing an operation.
Important
buk is not affiliated with, endorsed by, sponsored by, or maintained by inFakt. The inFakt name and related marks belong to their respective owners and are used here only to identify the service and API with which buk interoperates.
The embedded catalog covers all 203 request entries published by docs.infakt.pl: 193 active entries and 10 deprecated entries. A consolidated reference is available in docs/infakt-api-v3.md.
- Offline discovery of operation groups and all API contracts
- Stable JSON output for agent automation
- JSON and multipart request bodies
- JSON, PDF, XML, HTML, and ZIP responses
- Explicit polling for documented asynchronous operations
- Structured API errors and stable exit codes
- Sandbox-first execution with explicit production selection
- Exact confirmation for writes, deletes, external actions, and side-effectful reads
- Complete source provenance and reproducible documentation generation
- Zero external Go runtime dependencies
- Sandbox is the default environment.
- Production requires the explicit flag
--environment productionon every call. - The API key is read only from
INFAKT_API_KEY. - Every operation whose risk is not
readrequires--confirm OPERATION_ID. - Deprecated operations cannot be executed.
- Unverified supplemental operations require
--allow-unverified. --dry-rundoes not require a key and never sends a request.- The HTTP client rejects arbitrary hosts, relative paths, and redirects.
- Mutating requests are not retried automatically.
- Binary responses require an explicit output destination.
These controls reduce accidental execution. They do not replace user approval or professional accounting review.
- Go 1.25 or newer.
- An inFakt API key with scopes required by the selected operation.
From the repository:
go build -o buk ./cmd/bukInstall from GitHub:
go install github.com/Thelost77/buk/cmd/buk@latestSet the key in the process environment. Do not place it in command arguments, examples, prompts, or committed files.
export INFAKT_API_KEY='...'INFAKT_ENV may set the default environment to sandbox or production. A production call still requires --environment production explicitly.
Every command level supports -h and --help. Help can also be addressed by topic:
buk --help
buk help operations
buk help operations list
buk help operations describe
buk help call
buk --versionHelp and operation discovery work offline and do not require an API key.
buk operations groups
buk operations list --group przychody.faktury-vatFilter by risk or documentation status:
buk operations list --risk read
buk operations list --status unverified
buk operations list --include-deprecatedbuk operations describe przychody.faktury-vat.stworzThe result includes the method, normalized path, required scopes, body mode, source description, examples, response mode, risk, and asynchronous completion metadata.
buk call przychody.faktury-vat.stworz \
--input examples/invoice-create.json \
--wait \
--dry-runbuk call przychody.faktury-vat.stworz \
--input examples/invoice-create.json \
--wait \
--confirm przychody.faktury-vat.stworzThe example contains placeholder client data. Replace it with an ID returned by the current account before execution.
buk call przychody.faktury-vat.pokaz-szczegoly \
--path invoice_uuid=INVOICE_UUIDbuk call przychody.faktury-vat.listuj \
--query limit=25 \
--query offset=0 \
--query 'q[paid_date_null]=true' \
--query 'order=invoice_date desc'Repeated query keys are preserved.
buk call przychody.klienci.stworz \
--input examples/client-create.json \
--confirm przychody.klienci.stworzUse --input - to read one JSON document from standard input.
Known PDF, XML, ZIP, and HTML download operations require --output:
buk call przychody.faktury-vat.pobierz-pdf \
--path invoice_uuid=INVOICE_UUID \
--output invoice.pdf \
--confirm przychody.faktury-vat.pobierz-pdfFiles are created with mode 0600. Use --output - only when the caller expects binary standard output.
For operations with embedded async metadata, --wait polls until a documented terminal state:
buk call przychody.faktury-vat.stworz \
--input examples/invoice-create.json \
--confirm przychody.faktury-vat.stworz \
--wait \
--poll-interval 2s \
--timeout 2mThe poller fails closed on unknown states. It does not infer success.
- Documented monetary values use integer minor units.
100000means1000.00 PLN. - Do not convert money through
float64. - Invoices normally use UUID values in paths.
- Clients, products, bank accounts, and some accounting resources use numeric IDs.
- KSeF operations distinguish document UUID, request UUID, task reference, and KSeF number.
Always inspect the operation before selecting an identifier.
- Successful non-empty JSON responses are written to
stdoutwithout an envelope. --prettyindents valid JSON responses.- A successful non-read operation with an empty response writes JSON containing
status,operation_id, andok: true. - A successful read with an empty response produces empty
stdout. - A downloaded file produces JSON metadata unless
--output -is used. - Errors are written as JSON to
stderrand leavestdoutempty.
Exit codes:
0: success1: transport or internal failure2: usage, configuration, confirmation, deprecated, or unverified operation3: authorization failure4: resource not found5: validation, plan, lock, or asynchronous failure6: rate limit, unavailable service, server failure, or timeout
A production read requires an explicit environment flag:
buk call przychody.faktury-vat.listuj \
--environment productionA production write requires both the environment and exact operation confirmation:
buk call przychody.faktury-vat.stworz \
--environment production \
--input invoice.json \
--confirm przychody.faktury-vat.stworzdocs/infakt-api-v3.md: consolidated endpoint referencedocs/SOURCES.md: source URLs, hashes, and prioritydocs/ai-agent-guide.md: operating policy for an AI agent
The live Postman collection is the primary source. GitHub-only operations are supplemental and marked unverified.
Regenerate the catalog and reference from the current public sources:
python3 tools/generate_docs.pyReview source hashes and catalog test failures before accepting an upstream documentation change.
go test ./...
go test -race ./...
go vet ./...
go build ./cmd/bukOptional read-only sandbox contract tests:
INFAKT_API_KEY='...' go test -tags=integration ./integration -run TestSandboxReadOnlyOptional sandbox mutation test:
INFAKT_API_KEY='...' \
INFAKT_SANDBOX_WRITE_TESTS=1 \
go test -tags=integration ./integration -run TestSandboxClientLifecycleThe integration suite uses the hard-coded sandbox base URL and never mutates production.
Releases use SemVer tags with a leading v. Keep reviewed release notes in docs/releases/ and publish the tag and GitHub Release together:
${EDITOR:-vi} docs/releases/v0.1.0.md
./scripts/release.sh v0.1.0Install a specific release:
go install github.com/Thelost77/buk/cmd/buk@v0.1.0cmd/buk/ process entry point
internal/api/ safe authenticated HTTP transport and API errors
internal/catalog/ embedded normalized operation catalog
internal/cli/ help, discovery, input handling, execution, and polling
integration/ opt-in sandbox contract tests
tools/ documentation fetch and generation
docs/ API reference, source provenance, agent policy, and plans
examples/ reviewed request and workflow examples
The catalog, offline discovery, request execution, safety gates, multipart and binary handling, and asynchronous polling are implemented and covered by unit tests. Authenticated endpoint contracts remain documented-unverified until they pass controlled sandbox tests.
- Public documentation does not define every error body.
- The normal sandbox may not expose cost and accounting workflows.
supplemental.ksef2.cancel-exportis absent from Postman and remains unverified.- The CLI executes API operations. It does not determine whether an accounting or tax action is legally correct.
buk is an independent open-source project. It is not an official inFakt implementation and has no affiliation with inFakt. No inFakt trademark, logo, or brand asset is licensed to this project. References to inFakt are descriptive and identify API compatibility only.
MIT. The MIT license covers this project's code and documentation; it does not grant rights to third-party names or marks.