Skip to main content

Agent-native CLI for the morning invoicing REST API — 66 endpoints, JSON envelopes, sandbox-first, built by JangoAI.

Project description

morning-cli banner

PyPI version Python versions CI status License Downloads

66 endpoints  |  Interactive REPL  |  Onboarding wizard  |  JSON envelopes for AI agents  |  Hebrew error messages

Built by JangoAI using the cli-anything methodology  |  README בעברית


Why this exists

I'm Maor, a solo developer running JangoAI — a small AI automation studio in Israel. I use morning's API daily for my own business and my clients', and I got tired of writing the same httpx + JWT boilerplate in every project. So I built a proper CLI around it.

This started as a personal tool, but there's no reason to keep it private — if you work with morning's API, you'll save time with this. I'm sharing it with the Israeli dev community because I think we deserve better tooling for our local platforms. If it helps you, I'd love to hear about it.


Install

pip install morning-cli

Get started in 30 seconds

# 1. Run the interactive wizard — connects your morning account
morning-cli auth init

# 2. Start the REPL
morning-cli

# 3. Or use one-shot commands
morning-cli --json business current
morning-cli --json document types --lang he
morning-cli --json client search
What does auth init look like?
  morning-cli setup wizard
  ──────────────────────────

  Step 1/4 — choose environment
    sandbox    (recommended — safe, no real money)
    production (live data)
    env [sandbox]:

  Step 2/4 — get your API keys (sandbox)
    Open this URL in your browser and log in:
      https://app.sandbox.d.greeninvoice.co.il/settings/developers/api

  Step 3/4 — paste your credentials
    API Key ID:     xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    API Key Secret: ●●●●●●●●●●●●●●●●●●●●●●●●●●●●

  Step 4/4 — verifying against the real API...
    ✓ Authenticated successfully
    business:    Your Business Name
    env:         sandbox
    saved to:    ~/.greeninvoice/credentials.json

    All set. Try:
      morning-cli business current
      morning-cli --json document types --lang he
      morning-cli                      # interactive REPL

Commands

Group Endpoints Highlights
authlocalinit (wizard), login, logout, whoami, refresh
sessionlocalshow, reset, history
business10list, current, get, update, numbering, footer, types, file-upload
client8add, get, update, delete, search, assoc, merge, balance
supplier6add, get, update, delete, search, merge
item5add, get, update, delete, search
document13create, preview, get, search, close, open, download, types, statuses
expense13CRUD + open/close + 3-step file upload flow + drafts
payment3form, tokens-search, charge
partner4users, connect, get, disconnect
tools4occupations, countries, cities, currencies

Usage examples

Create a proforma invoice (חשבון עסקה)

cat > /tmp/proforma.json <<'JSON'
{
  "description": "ריטיינר חודשי",
  "type": 300,
  "lang": "he",
  "currency": "ILS",
  "vatType": 0,
  "client": {"name": "Acme Ltd", "emails": ["ap@acme.com"], "country": "IL"},
  "income": [
    {"description": "שירותי ייעוץ", "quantity": 10, "price": 300, "currency": "ILS", "vatType": 0}
  ]
}
JSON
morning-cli --json document create --file /tmp/proforma.json

Search recent clients

morning-cli --json client search --data '{"page":1,"pageSize":10}'

Get PDF download link for a document

morning-cli --json document download <document_id>

JSON output for AI agents

Every --json command returns a consistent envelope:

{"ok": true, "op": "document.create", "data": {"id": "...", "number": 12345}}

Errors include the morning errorCode and Hebrew errorMessage:

{"ok": false, "op": "document.create", "error": {"code": 1110, "message": "מחיר לא תקין.", "http_status": 400}}
Exit code Meaning
0 Success
1 Usage / local error
2 API error (4xx)
3 Server error (5xx) / network
Common morning API error codes
Code Meaning
401 Token expired (CLI auto-refreshes)
1003 No active business in the account
1006 Subscription expired
1007 Missing permission
1012 Feature requires a higher plan
1110 Invalid price in a line item
2002 Wrong email or password
2102 Can't add more businesses on this plan
2403 Document type not supported for this business type

Environment variables

Variable Purpose Default
MORNING_API_KEY_ID API key ID
MORNING_API_KEY_SECRET API key secret
MORNING_ENV sandbox or production sandbox
MORNING_BASE_URL Override base URL auto

Tests — 55 tests, including 24 live sandbox E2E
pip install -e ".[test]"

# Unit tests — no network
pytest cli_anything/greeninvoice/tests/test_core.py -v

# Full suite with live sandbox
export MORNING_SANDBOX_ID=<your-id>
export MORNING_SANDBOX_SECRET=<your-secret>
CLI_ANYTHING_FORCE_INSTALLED=1 pytest cli_anything/greeninvoice/tests/ -v

Coverage:

  • 27 unit tests — credentials, token management, session locking, payload parsing
  • 4 offline E2E — help, version, error envelopes
  • 11 read-only smoke tests — every resource group verified against the live sandbox
  • 5 paginated search tests — client, supplier, item, expense, document
  • 2 mutation round-trips — item CRUD, supplier create/delete
  • 5 workflow tests — auth login, business current, document types, full invoice lifecycle, proforma invoice with Hebrew content
  • 3 real bugs caught during development (late-binding, type 305 gate, Tools host/locale)
For AI agents — SKILL.md auto-discovery

morning-cli ships a SKILL.md file auto-discovered by the REPL banner and Claude Code / Cursor. It contains:

  • Full command reference with examples
  • Error code table
  • Agent-specific guidance (always use --json, sandbox defaults, token refresh)
  • Non-interactive auth init for CI

If you're an agent reading this, start with the SKILL.md.

Methodology — cli-anything 7-phase SOP

Built following the cli-anything 7-phase pipeline:

  1. Codebase analysis — parsed the Apiary spec into a 66-endpoint map
  2. Architecture — REPL-first, --json envelopes, session locking, sandbox-first
  3. Implementation — PEP 420 namespace package cli_anything.greeninvoice
  4. Test planning — TEST.md written before tests
  5. Test implementation — unit + live E2E
  6. Test documentation — results appended to TEST.md
  7. PyPI publishingpip install morning-cli

Full SOP: GREENINVOICE.md


Contributing

PRs welcome! Run the tests before submitting:

pip install -e ".[test]"
pytest cli_anything/greeninvoice/tests/test_core.py -v

See open issues for good first contributions.


JangoAI — AI automation for Israeli businesses

Website · GitHub · morning API docs

MIT License · morning-cli is a community project and is not officially affiliated with morning Ltd.

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

morning_cli-0.1.3.tar.gz (48.9 kB view details)

Uploaded Source

Built Distribution

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

morning_cli-0.1.3-py3-none-any.whl (53.1 kB view details)

Uploaded Python 3

File details

Details for the file morning_cli-0.1.3.tar.gz.

File metadata

  • Download URL: morning_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 48.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for morning_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d1087b574ae8df676f34211b4ccb1c82c4a15308a0f153bd5a23a8939a9e7dac
MD5 5ba5396a81762b763ae1e7c4251fe4c6
BLAKE2b-256 2e224f3d3bf98a8bc1a59d67e4c0202c063675eb27aae8e6d61312632f37b2db

See more details on using hashes here.

File details

Details for the file morning_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: morning_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for morning_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b73fa88f1c7dc250b3ddcc35c8ef542348c7abe1be797b9488573e128110558b
MD5 a62c1316ea4de8a2c31911284b7f2b0e
BLAKE2b-256 e0c3713f81ebb7a3df9981d7be9f566d73260f385932333a59989acdcded1165

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