# Command: enrich-crm

Synchronize firmographic data from Data Hub to MicroCRM accounts in bulk, enriching contact and opportunity records with company size, industry, location, and funding information.

## Inputs

- **account_ids** — comma-separated MicroCRM account IDs to enrich (or leave blank to enrich all); default: all unprocessed
- **data_source** — which firmographic data set to pull (company_metrics, industry_classification, funding_data); default: company_metrics
- **fields_to_map** — which MicroCRM fields to populate (industry, headcount, annual_revenue, location_code); default: all available
- **batch_size** — number of accounts to process per request to avoid timeouts; default: 50
- **skip_existing** — if true, skip accounts with existing enrichment data; default: false

## Steps

1. Query MicroCRM for the target account set (filter by account_ids or all records).
2. Fetch firmographic profiles from Data Hub via newx-platform-data-hub API endpoint.
3. Map returned fields to MicroCRM schema (handle null values, format mismatches).
4. Batch-upsert enriched records back to MicroCRM accounts.
5. Log enrichment coverage (success rate, field completion).

## Constraints

- Data Hub API is rate-limited to 100 requests/min; batch size applies per API call.
- Only enrich accounts with valid company name and domain on file.
- Do not overwrite existing firmographic fields if skip_existing is true.

Done when: all target accounts in MicroCRM have matching firmographic fields populated from Data Hub and enrichment log shows success rate > 90%.