Skip to content
Settings and rules

Preview Product Segmentation settings

Shows how the property's products would be segmented under draft settings, without saving them: product counts and revenue per segment.

POST /properties/{propertyId}/settings/preview

Scope read · Access Read only · Operation id settings.preview

Try it

productmetrics runs after productmetrics login; curl needs PM_TOKEN (see Authentication). Set $PROPERTY_ID first.

# body.json holds the JSON body from the curl example
productmetrics settings preview \
  --property-id $PROPERTY_ID \
  --body-file body.json \
  --json

Response

API response (200), shortened:

{
  "data": {
    "summary": [
      {
        "product_segment": "stars",
        "Products": 42
        // … 14 more fields
      }
    ],
    "preview": [
      {
        "item_id": "SKU-1042",
        "product_segment": "stars"
        // … 8 more fields
      }
    ]
  },
  "request_id": "req_01JQX3WVB2T335G0ZR9TN6YKR6"
}

CLI output: productmetrics settings preview --json prints { "ok": true, "data": …, "request_id": "…" } with the same data.

Before you call

Call it after settings.get with a changed copy of labelizer_settings to compare drafts; when one looks right, save it with settings.update. Needs one concrete feed: feed_scope=all is refused with all_feed_coordinator_required.

Path parameters

NameTypeDescription
propertyIdstring (uuid)A property_id from properties.list.

Query parameters

NameTypeRequiredDescription
feed_scopestringNoWhich feed of the property: a feed id, or all for the property-wide settings. Omitted: the property’s default scope.

Body

A draft of Product Segmentation settings, in the shape of labelizer_settings from settings.get. The preview reads category_col (string), min_clicks (number), data_range (as settings.get returns it), strategy_adjustments (object) and excluded_campaign_ids (numeric strings); other fields are ignored and missing ones use the defaults.

Errors

A failure answers with its HTTP status and { error: { code, message, details? }, request_id }. Branch on code (stable, lower_snake); show message to the person. The CLI prints the same error with "ok": false.

{
  "error": {
    "code": "insufficient_scope",
    "message": "This operation needs the read scope; connect again and allow it.",
    "details": {
      "required_scope": "read"
    }
  },
  "request_id": "req_01JYZ6WJ8VNG3W6SMVDSJ8CTCE"
}
StatusCodeWhen
400invalid_requestA path, query or body value does not match this page. details.issues lists each location, path and message.
401invalid_tokenThe token is missing, expired or revoked: sign in again (productmetrics login). The WWW-Authenticate header says why.
403insufficient_scopeThe token lacks the read scope (details.required_scope): sign in again and allow it.
404not_foundAn id in the path does not exist, or the signed-in person cannot open it.
429rate_limitedMore than 600 requests a minute for this person: wait the Retry-After seconds (60) and retry.

All Settings and rules operations