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.
mercato api_keys addCreate 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
--name (required) – human-friendly label that appears in the admin table.--tenantId (required unless --organizationId resolves to a tenant) – UUID of the tenant the key should impersonate.--organizationId (optional) – UUID of the organization the key should limit itself to.--roles (optional) – comma-separated list of role IDs or role names to attach to the key.--description (optional) – short memo that helps your teammates remember why the key exists.--expiresAt (optional) – ISO timestamp after which the key can no longer authenticate.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>
api_keys.view is usually unnecessary).