---
title: "Requests computation of an aggregated score per item group (e.g., a product range) for each customer."
url: "https://developer.migros.ch/apis/unified-customer-item-recommender-api-2/versions/99fa4982-90d2-410c-a30b-b658b93762a4/operations/m_recsys.service.recommendations_api.put_scoreitemgroup"
---

> Full API specification: https://developer.migros.ch/apis/unified-customer-item-recommender-api-2/versions/99fa4982-90d2-410c-a30b-b658b93762a4.md

# Requests computation of an aggregated score per item group (e.g., a product range) for each customer.

`PUT` `/migros/customers/v1/recommender/scoreitemgroup/{domain_id}/{reference_date}`

Operation ID: `m_recsys.service.recommendations_api.put_scoreitemgroup`

This path requests the computation of scores for all customers known in the domain. Scores are not immediately computed but must be acquired from the Google Storage URI returned. Depending on system load, it can take between a few minutes to several hours before scores are available. Clients must periodically check the returned URI, in order to know if the requested scores are ready for download. The format of the scores is parquet. After some period (usually several days) computed scores are garbage collected.

## Path parameters

- `domain_id` (string, required)
- `reference_date` (string, date-time, required)

## Request body (required)

Content types: `application/json`

## Responses

- `200` - Scoring request accepted
- `401` - Unauthenticated
- `403` - Forbidden
- `404` - Unknown domain or unknown items

## OpenAPI definition

```yaml
openapi: 3.0.1
info:
  title: Unified Customer-Item Recommender API
  version: 2.0.0.dev0
servers:
  - description: URL of upstream
    url: https://prod-unified-recommender.service.migros.cloud
paths:
  /migros/customers/v1/recommender/scoreitemgroup/{domain_id}/{reference_date}:
    put:
      description: >-
        This path requests the computation of scores for all customers known in
        the domain. Scores are not immediately computed but must be acquired
        from the Google Storage URI returned. Depending on system load, it can
        take between a few minutes to several hours before scores are available.
        Clients must periodically check the returned URI, in order to know if
        the requested scores are ready for download.


        The format of the scores is parquet.


        After some period (usually several days) computed scores are garbage
        collected.
      operationId: m_recsys.service.recommendations_api.put_scoreitemgroup
      parameters:
        - in: path
          name: domain_id
          required: true
          schema:
            default: Cumulus
            type: string
        - in: path
          name: reference_date
          required: true
          schema:
            example: 2023-04-02T00:00:00Z
            format: date-time
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                bought_limit:
                  default: 0.75
                  description: Relative share of scores to keep, descending order (aka.
                    X1FilterRatio). This filter is applied after any filters
                    based on single scores (e.g. max_score).
                  format: float
                  maximum: 1
                  minimum: 0
                  type: number
                items:
                  description: Item IDs to be scored
                  example:
                    - "100146000000"
                    - "263480108400"
                    - "110136400000"
                  items:
                    $ref: "#/components/schemas/Item"
                  type: array
                max_score:
                  default: 0.9
                  description: Inclusive upper predicted purchase probability limit. Useful for
                    not offering items which will be bought also without any
                    incentive or communication.
                  format: float
                  maximum: 1
                  minimum: 0
                  type: number
                not_bought_ratio:
                  default: 0.2
                  description: Ratio of scores for not bought (in the last 12 months) items to
                    bought items (aka. X0toX1FilterRatio). This filter is
                    applied after any filters based on single scores (e.g.
                    max_score).
                  format: float
                  minimum: 0
                  type: number
              type: object
        description: Batch scoring request parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  scores_uri:
                    example: gs://mgb-recommender-dev-data/1.0.0/scores/Cumulus/c4f01b13d11d7fd2-20211120T113908.123Z-20210919T000000.000Z/scores
                    format: uri
                    type: string
                type: object
          description: Scoring request accepted
        "401":
          description: Unauthenticated
        "403":
          description: Forbidden
        "404":
          description: Unknown domain or unknown items
      security:
        - apiKeyAuth: []
      summary: Requests computation of an aggregated score per item group (e.g., a
        product range) for each customer.
      tags:
        - Batch
security:
  - apiKeyAuth: []
components:
  schemas:
    Item:
      description: Migros ArtikelID
      example: "110136400000"
      pattern: ^[a-zA-Z0-9=]+$
      type: string
  securitySchemes:
    apiKeyAuth:
      in: header
      name: X-API-Key
      type: apiKey
      x-apikeyInfoFunc: m_recsys.service.key_auth.check_api_key
```
