Skip to main content

Configuration

The CLI stores its configuration at ~/.dealmachine/config.json. This file is created during dm login and contains your credentials and preferences.

Config File

Location: ~/.dealmachine/config.json Permissions: 0600 (owner-only read/write)
{
  "apiKey": "dm_sk_live_xxx",
  "keyId": "key_abc123def456",
  "organizationId": 1,
  "organizationName": "My Company",
  "organizationSlug": "my-company",
  "apiEnvironment": "production"
}

Configuration Values

KeyTypeEditableDescription
apiKeystringNoYour API key (set during login)
keyIdstringNoAPI key identifier
organizationIdnumberNoInternal organization ID
organizationNamestringNoOrganization display name
organizationSlugstringNoOrganization URL slug
apiEnvironmentstringYesAPI target: local or production

Changing the API Environment

Switch between local development and production:
# Target local API server (http://localhost:3001)
dm config set apiEnvironment local

# Target production (https://api.v2.dealmachine.com)
dm config set apiEnvironment production

Environment Variable Overrides

Environment variables take precedence over config file values:
VariablePriorityDescription
DM_API_URLHighestFull API base URL
DM_ENVMediumlocal or production
Config apiEnvironmentLowStored preference
DefaultLowestproduction
# One-off local request
DM_ENV=local dm account

# Point to custom server
DM_API_URL=https://staging-api.v2.dealmachine.com/v1 dm account
The longer forms DEALMACHINE_API_URL and DEALMACHINE_ENVIRONMENT also work.

API URL Resolution

EnvironmentURL
localhttp://localhost:3001/v1
productionhttps://api.v2.dealmachine.com/v1

Local Development Setup

If you’re working on the DealMachine codebase and want to run the CLI against your local API:
# 1. Set up the database (if you haven't already)
npm run db:setup

# 2. Set up the CLI (generates API key, builds, links `dm`, auto-logs in)
npm run dm:setup
Then start the API in another terminal:
npm run api:dev
dm:setup does not start or manage MySQL — it assumes you’ve already run npm run db:setup. It only generates an API key, builds the CLI, links it globally, and logs you in against localhost:3001.

Updating the CLI

npm update -g @dealmachine/cli

Uninstalling

npm uninstall -g @dealmachine/cli