Tools

Data health

Five tools make an assistant a catalog auditor: two reads over the cached quality state, one non-destructive scan recompute, and two remediation batches that fix what the scan found — as drafts, never straight to Shopify.

get_data_health_v1

get_data_health_v1pim:read

Read the account's catalog-quality state per dimension — sync, completeness, media, structure, cross-store divergence, translations — as of the last scan. This never scans, so it is cheap.

ArgumentTypeDescription
channel_idstringScope to one store.
null means "never scanned", not "clean".

A dimension that has never been scanned comes back null. Call run_data_health_scan_v1 when you need fresh numbers.

list_data_health_issues_v1

list_data_health_issues_v1pim:read

List the individual items behind one section's numbers — which products are unpublished, which are missing required fields, where stores disagree, which files are unused.

ArgumentTypeDescription
sectionstring, requiredWhich issue list to read — e.g. sync-failed, completeness-required, divergence, media-unused, translations-untranslated.
channel_idstringScope to one store.
localestringNarrow the translation sections to one target language.
pageinteger1-based page number.
page_sizeintegerRows per page (clamped to the server max).

run_data_health_scan_v1

run_data_health_scan_v1pim:write

Recompute one dimension and cache the result. The scan reads the catalog and writes only a cached snapshot — it touches no merchant data and nothing reaches Shopify, so it is a non-destructive recompute: re-running it simply recomputes the same dimension.

ArgumentTypeDescription
dimensionstring, requiredWhich dimension to recompute.
channel_idstringScope the scan to one store, where the dimension is store-scoped.

Scanning the catalog is slow — call it on request rather than polling it. It shares publish's extended 120 s budget, as do the two remediation batches below.

fill_completeness_gaps_v1

fill_completeness_gaps_v1pim:write

Write values into fields that are still empty, in one batch. The server re-checks before every write: a field filled by someone else since the last scan is skipped, never overwritten.

ArgumentTypeDescription
entity_typestring, requiredWhich kind of item the batch targets — e.g. Product or Variant.
operationsarray, requiredUp to 500 fills; each names one item, one store, one field, and the value to write.
master_idstring, requiredThe item id.
channel_idstring, requiredThe store id.
fieldstring, requiredThe field key to fill.
valuestring, requiredThe value to write (must not be blank).

reconcile_value_divergence_v1

reconcile_value_divergence_v1pim:write

Bring one field into agreement across stores, in one batch: either adopt a winner store's value or write an explicit one. Stores that already match are left untouched.

ArgumentTypeDescription
entity_typestring, requiredWhich kind of item the batch targets — e.g. Product or Variant.
operationsarray, requiredEach names one item and one field, plus exactly one of winner_channel_id or value.
master_idstring, requiredThe item id.
fieldstring, requiredThe field key to harmonize.
winner_channel_idstringAdopt this store's value. Mutually exclusive with value.
valuestringWrite this value to every store that differs. Mutually exclusive with winner_channel_id.
channel_idstringNarrow an explicit value to one store.

Batch semantics: drafts, and partial success is normal

The audit-and-fix loop

  1. get_data_health_v1 — where does the catalog stand? (run_data_health_scan_v1 first if a dimension is stale or null.)
  2. list_data_health_issues_v1 — which items, exactly?
  3. fill_completeness_gaps_v1 / reconcile_value_divergence_v1 — fix them as drafts, in batches.
  4. publish_master_v1 — a person or a publish-tier connection pushes the result live.