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
| Key | Type | Editable | Description |
|---|
apiKey | string | No | Your API key (set during login) |
keyId | string | No | API key identifier |
organizationId | number | No | Internal organization ID |
organizationName | string | No | Organization display name |
organizationSlug | string | No | Organization URL slug |
apiEnvironment | string | Yes | API 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:
| Variable | Priority | Description |
|---|
DM_API_URL | Highest | Full API base URL |
DM_ENV | Medium | local or production |
Config apiEnvironment | Low | Stored preference |
| Default | Lowest | production |
# 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
| Environment | URL |
|---|
local | http://localhost:3001/v1 |
production | https://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:
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