Skip to content

metorikhq/metorik-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metorik CLI

An installable, agent-friendly CLI for the Metorik API.

It is built for the current beta API on metorik.dev, with a shape that feels close to newer API CLIs: easy install, token auth, JSON-first output, and direct endpoint coverage for agents and automation.

Install

npm install -g metorik

You can also run it without installing globally:

npx metorik@latest commands
pnpm dlx metorik commands
bunx metorik commands

Authenticate

Store your API key locally:

metorik auth login YOUR_API_KEY
metorik auth login

Get your key here:

https://app.metorik.com/settings/stores/current?area=api

Or use environment variables:

export METORIK_API_KEY=YOUR_API_KEY
export METORIK_BASE_URL=https://app.metorik.com/api/v1/store

Why this shape

  • JSON-first output for agents, scripts, and piping into other tools
  • simple top-level resource commands for common data endpoints
  • grouped report and Engage commands that mirror the docs closely
  • request escape hatch for anything new in the API before a first-class command lands
  • commands endpoint catalog so an agent can discover supported operations quickly

Examples

Search customers:

metorik search customers jarvis --count 5

Get the last 30 days of product sales:

metorik products --last 30 --search hoodie --per-page 25

Revenue by date:

metorik reports revenue-by-date --last 30 --group-by day

Revenue grouped by billing country:

metorik reports revenue-grouped-by --last 90 --grouped-by billing_address_country

Create or update an Engage profile:

metorik engage profile upsert \
  --email taylor@example.com \
  --first-name Taylor \
  --last-name Smith \
  --consent single

Call an endpoint directly:

metorik request GET /reports/sources-utms \
  --query start_date=2026-03-01 \
  --query end_date=2026-03-31 \
  --query source_type=utm_source,utm_campaign

List supported built-in commands:

metorik commands

Command overview

Top-level data endpoints:

  • metorik store
  • metorik search <resource> <query>
  • metorik products
  • metorik variations
  • metorik categories
  • metorik brands
  • metorik coupons
  • metorik custom-metrics
  • metorik custom-metrics value <metric>

Reports:

  • metorik reports customers-by-date
  • metorik reports orders-by-date
  • metorik reports revenue-by-date
  • metorik reports profit-by-date
  • metorik reports advertising-costs-by-date
  • metorik reports subscriptions-stats
  • metorik reports revenue-grouped-by
  • metorik reports orders-grouped-by
  • metorik reports customers-grouped-by
  • metorik reports sources
  • metorik reports sources-landing
  • metorik reports sources-utms
  • metorik reports customer-sources
  • metorik reports customer-sources-landing
  • metorik reports customer-sources-utms

Note: --group-by hour is only valid on the time-series report endpoints when the selected range is under 1 month.

Engage:

  • metorik engage profile upsert
  • metorik engage profile get
  • metorik engage profile delete
  • metorik engage unsubscribes list
  • metorik engage unsubscribes status
  • metorik engage unsubscribes add
  • metorik engage unsubscribes remove

Development

npm install
npm run build
npm test

Run as metorik locally

Link the package into your global npm bin:

npm run link-local

Then you can use it like a normal installed CLI:

metorik commands
metorik auth login YOUR_API_KEY
metorik products --last 30

Remove the local link when you are done:

npm run unlink-local

If you update the source, rebuild before testing the linked binary:

npm run build

Publish

nvm use 20
yarn
yarn run build
npm publish --access public

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors