Command line
myle is the Myle API in a terminal: list, read and
change your organization's data, try a call before writing code,
script an export. It has the commands and habits of the Stripe CLI:
if you know stripe, you know myle.
CLI
#!/usr/bin/env bash
# cli-quickstart: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle login --interactive
myle products list --status ACTIVE --limit 3
myle get /organizations/organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d/products --limit 3
Install
Coming. myle is not published yet:
the commands below are the ones it will take, once the first
release is out on
github.com/myleapp/api
and crates.io.
Each release has one archive per platform, holding the single
myle binary, and a SHA256SUMS file to check
them against.
Linux (x86_64, aarch64)
Text
VERSION=0.1.0
ARCH=$(uname -m) # x86_64 or aarch64
curl -fsSLO "https://github.com/myleapp/api/releases/download/cli/v$VERSION/myle-$VERSION-$ARCH-unknown-linux-musl.tar.gz"
tar xzf "myle-$VERSION-$ARCH-unknown-linux-musl.tar.gz"
sudo install myle /usr/local/bin/
Static binaries: they run on any distribution, Alpine included.
macOS (Apple silicon and Intel)
Text
VERSION=0.1.0
curl -fsSLO "https://github.com/myleapp/api/releases/download/cli/v$VERSION/myle-$VERSION-universal-apple-darwin.tar.gz"
tar xzf "myle-$VERSION-universal-apple-darwin.tar.gz"
xattr -d com.apple.quarantine myle 2>/dev/null # a download is quarantined by macOS
sudo install myle /usr/local/bin/
Windows (x86_64)
In PowerShell:
Text
$Version = "0.1.0"
Invoke-WebRequest "https://github.com/myleapp/api/releases/download/cli/v$Version/myle-$Version-x86_64-pc-windows.zip" -OutFile myle.zip
Expand-Archive myle.zip -DestinationPath "$env:LOCALAPPDATA\myle"
[Environment]::SetEnvironmentVariable("Path", "$env:Path;$env:LOCALAPPDATA\myle", "User")
Open a new terminal for the Path change to apply.
From source, any platform
Text
cargo install myle-cli # Rust 1.89 or later; installs the myle binary
Shell completion
CLI
#!/usr/bin/env bash
# cli-completion: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle completion --shell bash > ~/.local/share/bash-completion/completions/myle
myle completion --shell zsh > "${fpath[1]}/_myle"
myle completion --shell fish > ~/.config/fish/completions/myle.fish
powershell and elvish work too.
myle version prints the version and the
Myle-API-Version the CLI was built against.
Log in
Create a key in Myle first (see Authentication): a user key for yourself, or an organization key. Then:
Text
$ myle login --interactive --organization organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d
Enter your API key:
Done! Project default: Camille Martin <camille@example.com>, key myleAccountKey_01JD3Q…••••xQ, organization organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d. Stored in /home/camille/.config/myle/config.toml.
-
The key is read on standard input, without echo, never as an
argument: it stays out of your shell history. Off a terminal,
the first line of standard input is read
(
myle login -i < key.txt). -
It is checked with
GET /mebefore it is stored. A key Myle refuses is not stored. -
It is stored in
~/.config/myle/config.toml($XDG_CONFIG_HOME/myle/when set,--configfor another file), readable by you only (mode 600). -
--organizationis the organization of the resource commands. An organization key belongs to one organization: give it here. Without the flag,myle loginasks on a terminal. - The CLI never prints or logs a token: only its kind, the start of its id and its last two characters, as Myle shows keys.
For one command, --api-key or the
MYLE_API_KEY environment variable take precedence over
the stored key (in that order); MYLE_ORGANIZATION over
the stored organization. myle whoami tells which key is
used and whose it is.
Coming. Logging in from the browser, as
stripe login does: the CLI shows a pairing code, you
approve it in Myle with your passkey, and a key is created for the
CLI. Until then, plain myle login does what
--interactive does.
Projects
A project is a set of settings in the config file: a key, an
organization. Use one per organization or per key, and pick it with
-p / --project-name (or
MYLE_PROJECT_NAME); without it, the project is
default.
CLI
#!/usr/bin/env bash
# cli-projects: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle -p gaec-du-pre login --interactive --organization organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d
myle -p gaec-du-pre invoices list --status UNPAID
myle config --list # keys shown by their id and suffix
myle -p gaec-du-pre config --set organization organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d
myle -p gaec-du-pre logout # forget that project's key
myle logout --all # forget every key
A project's settings: api_key (set by
login only), organization,
base_url and api_version (to pin another
Myle-API-Version than the CLI's).
Resource commands
myle <resource> <verb>, one command per
operation of the reference.
myle resources lists them, --help on any of
them tells its flags.
CLI
#!/usr/bin/env bash
# cli-resource-commands: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle products list --status ACTIVE --sort name --limit 20
myle products retrieve product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f
myle products create --number A0012 --name "Œufs" --vat-rate 5.5 -d 'unitPrice[amount]=0.45' -d 'unitPrice[currency]=EUR'
myle products update product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f --name "Œufs bio" --if-match '"3"'
myle products delete product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f --confirm
myle product-barcodes create product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f --value 3012345678901 -d format=EAN_13
myle invoices validate invoice_3a1b2c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
myle me
-
Resources are named after the API's paths:
products,product-barcodes,companies,company-email-addresses,invoices… The verbs arelist,retrieve,create,update,delete, and the API's actions (validate,rotate,list-tags…). The ids of the path come first. -
Each filter and each simple member of the body has its flag,
named after it (
vatRate:--vat-rate). A repeatable one takes several values (--tag bio --tag local). A member named like a flag of every command (a barcode'sformat) goes through-d. -
A
deleteasks for confirmation on a terminal; in a script, it needs--confirm, or it is refused. Other writes never ask. -
Creates get an
Idempotency-Keyof their own, reused if the CLI retries after a network error: a create never happens twice.--idempotency-keygives yours. -
--all(or--auto-paging) fetches every page of a list, followingnextCursor.
The body: -d
-d key=value sets a member of the JSON body, with the
API's names; it can be repeated, and wins over the flags.
| Argument | Gives |
|---|---|
-d name=Œufs | {"name": "Œufs"} |
-d 'unitPrice[amount]=0.45' | {"unitPrice": {"amount": "0.45"}} |
-d 'tags[]=bio' -d 'tags[]=local' | {"tags": ["bio", "local"]} |
-d 'lines[0][name]=Foin' | {"lines": [{"name": "Foin"}]} |
-d isPrimary=true | {"isPrimary": true}: typed after the operation |
-d 'accountingNumber:=null' | {"accountingNumber": null}: JSON after := |
-d @invoice.json, -d @- | The whole body, from a file or standard input |
Quote arguments holding brackets: zsh would read them as file
patterns. Amounts stay decimal strings, as the API wants them. On a
GET or a DELETE, -d gives
query parameters (-d status=UNPAID).
Output
An answer is printed as the API sends it, in JSON: indented and
colored on a terminal, on one line in a pipe, so that
jq and other tools read it.
--format jsonl prints a list's items one per line.
CLI
#!/usr/bin/env bash
# cli-format-jsonl: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle products list --all --format jsonl | jq -r '[.number, .name] | @tsv'
myle invoices list --status UNPAID --all | jq '.data | length'
myle products retrieve product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f -i # the status and headers first: ETag, RateLimit, Myle-Request-Id
--color on|off|auto (NO_COLOR is honored)
and --log-level debug|info|warn|error:
debug shows each request, its status, its duration and
its request id on standard error.
Files and headers
A command whose operation also answers a file (an invoice's PDF:
its help says « Answers a file too ») writes it with
-o <file>, byte for byte, and
--format picks which file: pdf, or
facturx for the Factur-X of a validated invoice.
-o - writes it on standard output. A file is never
printed without -o: the command fails with
cli.output-required. On any other answer,
-o writes what would have been printed into the file.
-i prints the status and headers before the body, and
before an error object too (on standard error). With
--format json it prints one JSON object instead,
{status, headers, body}, headers by lowercase name: a
script reads a header and the body from the same call.
CLI
#!/usr/bin/env bash
# cli-files-and-headers: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle invoices retrieve invoice_3c5e7a9b-1d2f-4a6b-8c0d-e2f4a6b8c0d1 --format pdf -o invoice.pdf # -o - for stdout
myle invoices retrieve invoice_3c5e7a9b-1d2f-4a6b-8c0d-e2f4a6b8c0d1 --format facturx -o invoice.pdf # a validated one
# -i --format json: one object, {status, headers, body}, for jq.
etag=$(myle products retrieve product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f -i --format json | jq -r .headers.etag)
myle products update product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f --name 'Œufs bio' --if-match "$etag"
In a script, pass --format json (or
jsonl): warnings and messages are then off, so standard
error holds the error object alone. --log-level warn
(or info, debug) brings them back as JSON
lines, {"level": "warn", "message": "…"}.
Raw HTTP requests
myle get, post, patch and
delete call any path of the API, as
stripe get does, with your key and the same retries:
CLI
#!/usr/bin/env bash
# cli-raw-http: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle get /organizations/organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d/products --limit 3 -d status=ACTIVE
myle post /organizations/organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d/products -d number=A0012 -d name=Œufs -d vatRate=5.5
myle patch /organizations/organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d/products/product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f -d 'accountingNumber:=null'
myle delete /organizations/organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d/products/product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f --confirm
myle get /me -H 'traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01' --version 2026-11-21
| Flag | Does |
|---|---|
-d, --data | The body (query parameters on GET and DELETE), as above |
-H, --header | An extra header, "Name: value"; it replaces the CLI's own: -H "Myle-Client: my-export/1.0.0" names your program in Myle's logs |
-i, --show-headers | The response's status and headers before its body, or before an error; {status, headers, body} with --format json |
-o, --output | The body into a file (-: standard output); a file answer as received |
--idempotency-key | The Idempotency-Key (a POST gets one by default) |
--if-match | The ETag you read: the call fails with 412 if it changed since |
-v, --version | The Myle-API-Version to send |
-l, --limit, --cursor | A list's page size and start |
--all, --auto-paging | Every page of a list |
-c, --confirm | No question before a delete |
A path the CLI knows (an operation of the reference) is handled like
its resource command: -d values typed after its body,
its idempotency, its pagination, its files
(--format pdf -o invoice.pdf).
Errors and exit codes
An error answer is printed on standard error as the API sends it
(see Errors), and the command exits
with 1. After a 429 that the retries did not get past,
the object also carries retry_after, the seconds the
API asked to wait (its Retry-After):
Text
$ myle products retrieve product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f
{"code":"core.not-found","context":{"kind":"product","name":"product_0f9e8d7c-6b5a-4c3d-9e1f-0a9b8c7d6e5f"},"error":"What the path names does not exist, or the caller cannot see it.","request_id":"01M803CAJ14DSK72C4MKMWBPT7"}
$ echo $?
1
The CLI's own errors take the same shape, with a
cli.… code: cli.no-api-key,
cli.no-organization,
cli.confirmation-required,
cli.missing-member,
cli.connection-failed… A mistyped command or flag exits
with 2.
Flags of every command
| Flag | Does |
|---|---|
--api-key | A key for this command only |
-p, --project-name | The project of the config file (default) |
--organization | The organization of the resource commands (the project's) |
--format json|jsonl|pdf|facturx | JSON, or JSON Lines; or the file of a command that answers one, with -o. Given json or jsonl, logs are off unless --log-level is given, and JSON lines |
--max-retries | How many times a call is retried (network error, 429, 5xx when safe): 2, 0 for none; MYLE_MAX_RETRIES |
--accept-language fr|en | The language of error; MYLE_ACCEPT_LANGUAGE, or the project's accept_language |
--color on|off|auto | Colors |
--log-level debug|info|warn|error | What is logged on standard error (info; error with --format json|jsonl) |
--config | Another config file |