> ## Documentation Index
> Fetch the complete documentation index at: https://docs.genlook.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate a Generation

> Record shopper feedback (thumbs up or down, with a reason) on a try-on result.

Let shoppers rate a try-on result. Ratings feed the quality dashboard in the Genlook admin and help you spot products that generate poorly. If you build a custom result screen, wire your thumbs up and thumbs down buttons to this endpoint.

## Request

Shop is identified via app proxy authentication.

<ParamField body="generationId" type="string" required>
  The generation ID to rate.
</ParamField>

<ParamField body="rating" type="number" required>
  The shopper's rating:

  * `1`: thumbs up
  * `-1`: thumbs down
  * `0`: clear a previous rating
</ParamField>

<ParamField body="reason" type="string">
  Optional reason code explaining a thumbs down. One of:

  * `distorted_body`
  * `wrong_fit`
  * `face_changed`
  * `wrong_colors`
  * `something_else`
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://your-store.myshopify.com/apps/proxy_genlook-x/public/rate-generation" \
    -H "Content-Type: application/json" \
    -d '{
      "generationId": "gen_xyz789abc",
      "rating": -1,
      "reason": "wrong_fit"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('/apps/proxy_genlook-x/public/rate-generation', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      generationId: 'gen_xyz789abc',
      rating: -1,
      reason: 'wrong_fit',
    })
  });
  const result = await response.json();
  ```
</RequestExample>

## Response

<ResponseField name="rating" type="number">
  The stored rating (`1`, `-1`, or `null` once cleared).
</ResponseField>

<ResponseField name="ratedAt" type="string">
  ISO 8601 timestamp of the rating, or `null` once cleared.
</ResponseField>

<ResponseField name="ratingReason" type="string">
  The stored reason code, or `null` when none was provided.
</ResponseField>

<ResponseExample>
  ```json Thumbs Down theme={null}
  {
    "rating": -1,
    "ratedAt": "2024-01-15T10:32:15Z",
    "ratingReason": "wrong_fit"
  }
  ```

  ```json Cleared theme={null}
  {
    "rating": null,
    "ratedAt": null,
    "ratingReason": null
  }
  ```
</ResponseExample>

## Error Cases

<ResponseField name="404" type="error">
  The generation ID does not exist for this shop.
</ResponseField>

<ResponseField name="500" type="error">
  The rating could not be recorded.
</ResponseField>
