---
title: "Rating Image API — Star rating images via API | Imejis"
description: "Turn review scores into star, heart or emoji rating images with exact partial fills, updated on every API call. Start generating rating images free."
url: "https://www.imejis.io/components/rating"
---

# Rating Image API — Star rating images via API | Imejis

A row of stars, hearts, circles or custom icons filled to a value — with exact/half/rounded partial fills and an optional numeric label. Perfect for reviews and scores.

## Use cases

- Product OG images showing the live review average
- Testimonial cards with the customer score rendered as stars
- App store rating badges for marketing sites
- Weekly CSAT report images for Slack or email

## Authoring notes

- Use a wide box; for large max values wrap into a grid with perRow.
- max is not limited to 5 — "7 of 10" tallies work fine.

## Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `number` (min 0) | `3` | Current rating value (supports fractions). |
| `max` | `number` (min 1) | `5` | Total number of icons. |
| `iconShape` | `'star' \| 'heart' \| 'circle' \| 'custom'` | `"star"` | Icon used for each rating unit. |
| `customPath` | `string` | — | SVG path for the icon when iconShape is 'custom'. |
| `customEmoji` | `string` | — | Emoji used as the icon when iconShape is 'custom'. |
| `activeColor` | `color` | `"#FBBF24"` | Color of filled (active) icons. |
| `inactiveColor` | `color` | `"#E5E7EB"` | Color of unfilled (inactive) icons. |
| `emptyStyle` | `'filled' \| 'outline'` | `"filled"` | Whether empty icons render solid in the inactive color or as outlines. |
| `partial` | `'exact' \| 'half' \| 'round'` | `"exact"` | How fractional values fill the last icon. |
| `showValue` | `boolean` | `false` | Show the numeric value next to the icons. |
| `valueFormat` | `'decimal' \| 'fraction' \| 'countOfTotal'` | `"decimal"` | Format of the numeric label (4.5, 4.5/5, or "4 of 5"). |
| `valueColor` | `color` | `"#374151"` | Color of the numeric label. |
| `perRow` | `number` (min 0) | `0` | Icons per row before wrapping (0 = single row). |
| `opacity` | `number` | `1` | Overall component opacity from 0 (transparent) to 1 (opaque). |
| `borderWidth` | `number` | `0` | Border thickness in pixels around the component. |
| `borderColor` | `color` | `"transparent"` | Border color (any CSS color). |
| `borderStyle` | `'solid' \| 'dashed' \| 'dotted' \| 'double' \| 'none'` | `"solid"` | Border line style. |
| `borderRadius` | `number` | `0` | Corner radius in pixels. |
| `boxShadow` | `string` | — | CSS box-shadow applied to the component, e.g. "0 4px 6px rgba(0,0,0,0.1)". |

## Sample design JSON

```json
{
  "title": "Rating sample",
  "description": "A dynamic star rating",
  "dimensions": {
    "width": 800,
    "height": 420
  },
  "background": {
    "color": "#ffffff"
  },
  "components": [
    {
      "id": "sample-rating",
      "key": "score",
      "type": "rating",
      "position": {
        "x": 260,
        "y": 182
      },
      "rotation": 0,
      "size": {
        "width": 280,
        "height": 56
      },
      "dynamic": true,
      "properties": {
        "value": 4,
        "max": 5,
        "iconShape": "star",
        "activeColor": "#FBBF24",
        "inactiveColor": "#E5E7EB",
        "emptyStyle": "filled",
        "partial": "exact",
        "showValue": false,
        "valueFormat": "decimal",
        "opacity": 1
      }
    }
  ]
}
```

## Examples

### App store rating badge

A 4.8-star average with the decimal score alongside, ready for a landing page.

API overrides that reproduce this example:

```json
{
  "score.value": 4.8,
  "score.showValue": true,
  "score.valueFormat": "decimal",
  "score.valueColor": "#374151"
}
```

### Weekly CSAT report

The support team satisfaction average as green stars for a Monday Slack digest.

API overrides that reproduce this example:

```json
{
  "score.value": 4.2,
  "score.activeColor": "#10B981",
  "score.showValue": true,
  "score.valueFormat": "fraction",
  "score.valueColor": "#065F46"
}
```

## API overrides

Set '<key>.value' (or just '<key>') to the score for each render; max, colors and border props are overridable too.

Flat override payload (`key.property` addressing) with the sample design's current values — send only the keys you want to change:

```json
{
  "score.value": 4,
  "score.max": 5,
  "score.iconShape": "star",
  "score.activeColor": "#FBBF24",
  "score.inactiveColor": "#E5E7EB",
  "score.emptyStyle": "filled",
  "score.partial": "exact",
  "score.showValue": false,
  "score.valueFormat": "decimal",
  "score.opacity": 1
}
```

```bash
curl --location 'https://render.imejis.io/v1/{{YOUR_DESIGN_ID}}' \
--header 'dma-api-key: {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
    "score.value": 4,
    "score.max": 5,
    "score.iconShape": "star",
    "score.activeColor": "#FBBF24",
    "score.inactiveColor": "#E5E7EB",
    "score.emptyStyle": "filled",
    "score.partial": "exact",
    "score.showValue": false,
    "score.valueFormat": "decimal",
    "score.opacity": 1
}'
```

`{{YOUR_DESIGN_ID}}` and `{{YOUR_API_KEY}}` are placeholders: first create
the design in your account (paste the sample design JSON above into the
editor at https://app.imejis.io, or create it programmatically via the
imejis MCP server's `create_design` + `update_design` tools), then render
it with the design's id and one of your API keys.

Agents: the MCP server at https://api.imejis.io/api/mcp exposes this same
catalog as structured data via the `list_component_types` tool (property
kinds, allowed values, bounds, ready-to-use sample designs).

## Frequently Asked Questions

### Can the rating value change on every API call?

Yes — send '<key>.value' (or just the key) with any number, including fractions like 4.3; max, colors and other properties are overridable too.

### How are fractional scores like 4.3 displayed?

The partial property controls the last icon: 'exact' fills it proportionally, 'half' rounds to halves and 'round' rounds to a whole icon.

### Can I use icons other than stars?

iconShape supports star, heart, circle or custom — with customEmoji for any emoji or customPath for your own SVG path.

### Can I show the numeric score next to the icons?

Enable showValue and pick a valueFormat — decimal (4.5), fraction (4.5/5) or countOfTotal ("4 of 5") — with valueColor for styling.

## Variants

- [Hearts](https://www.imejis.io/components/rating/hearts.md) — Heart icons — likes, favorites and health bars.
- [Half fill + label](https://www.imejis.io/components/rating/half-fill-label.md) — Fractional score rounded to halves with a "3.5/5" label alongside.
- [Outline empty](https://www.imejis.io/components/rating/outline-empty.md) — Unfilled icons render as outlines instead of solid gray.
- [Emoji](https://www.imejis.io/components/rating/emoji.md) — Any emoji as the rating unit via the custom icon shape.
- [Ten-point scale](https://www.imejis.io/components/rating/ten-point.md) — Ten icons with a fractional "8.6/10" label — review scores out of ten.

All components: https://www.imejis.io/components.md
