Open MercatoDocsSearch docsAPI reference

CLI

API keys CLI

Provision a separate key for each integration or CI job. The CLI lets an operator create and manage those keys without opening the admin interface.

Use the api_keys command group to create secrets without opening the admin UI. Each key you mint through the CLI is scoped by tenant, organization, and roles – mirroring the UI workflow described in the Managing API keys guide.

Command reference

mercato api_keys add

Create a new API key and print the secret one time.

yarn mercato api_keys add \
  --name "CI deployer" \
  --tenantId 4c1378aa-1d27-4bc5-9a82-5afecf05c8f3 \
  --organizationId 6b4b3a5d-9a5d-4fcf-927f-830e1d9b3eee \
  --roles admin,employee \
  --description "Deployments from GitHub Actions" \
  --expiresAt 2025-12-31T23:59:59Z

Flags

The CLI prints:

API key created:
  id: 1d7fdd99-2081-4a4e-b50f-2a5f6670bcab
  name: CI deployer
  tenantId: 4c1378aa-1d27-4bc5-9a82-5afecf05c8f3
  organizationId: 6b4b3a5d-9a5d-4fcf-927f-830e1d9b3eee
  keyPrefix: <key-prefix>

Secret (store immediately):
<generated-api-key>

Operational tips

Next: mercato auth add-user