apyhub
SMART GENERATION

Generate Donut Graph API

Hosted on ApyHub

What it does

Donut Chart Generator creates a donut chart from your data and returns either a downloadable chart image or a pre-signed image link. Send a title, a data array, and an optional theme; each data item can include a label, value, and hex color.

Use data to define the chart segments. Each item must include label and value, and color is optional as a 6-character hex string without the #. The theme can be light or dark, with light as the default. The service also accepts slices as a deprecated alias for data, so you can keep older integrations working while you migrate.

Choose POST /download when you want the generated chart image itself. It returns a binary response suitable for direct file handling. Choose POST /link when you want a JSON response containing a data field with a pre-signed URL to the generated chart image.

This is useful when you need charts for dashboards, reports, status pages, or automated notifications where the visualization is built from live application data. You control the title and segment labels, so the chart can reflect subscription breakdowns, sales mix, usage tiers, or any other labeled distribution.

▣ ENDPOINT 01 / 02
POST
Generate donut chart image
http://localhost:8080/apyhub/mono-go-simple-donut-chart-generation/download
QUICKSTARTGUIDE

Quickstart

Create a donut chart image from a title and slice data, then download the generated binary file.

curl -X POST "http://localhost:8080/apyhub/mono-go-simple-donut-chart-generation/download?output=subscription-status-donut-chart" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Subscription Status Breakdown",
    "data": [
      { "label": "Active", "value": 72, "color": "10B981" },
      { "label": "Trial", "value": 18, "color": "3B82F6" },
      { "label": "Cancelled", "value": 10, "color": "EF4444" }
    ]
  }'

What you'll get back

Returns a binary file (string with format: "binary"), which is the generated donut chart image.

TRY ITLIVE · 60 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
data*
data-1*
6-character hex color without the leading # symbol.
Chart theme.
slices
Alias for data. Use either data or slices, not both.

About this endpoint

What it does

Generates a donut chart image from the request body and returns it as binary data. The chart is configured with a title, a theme, and an array of labeled slice values.

Request Body

ParameterTypeMandatoryDescription
titleStringYesChart title. Must be at least 1 character.
dataObject ArrayYesChart slices. Provide at least 1 item. Each item contains the slice label and value, and may include an optional 6-character hex color without the leading #.
data[].labelStringYesSlice label.
data[].valueNumberYesSlice value. Must be greater than or equal to 0.
data[].colorStringNoOptional slice color as a 6-character hex value without the leading #. Pattern: ^[A-Fa-f0-9]{6}$.
themeENUMNoChart theme. Allowed values: light, dark. Default: light.
slicesObject ArrayNoAlias for data. Deprecated. Use either data or slices, not both. Each item has the same shape as data[].
slices[].labelStringYesSlice label.
slices[].valueNumberYesSlice value. Must be greater than or equal to 0.
slices[].colorStringNoOptional slice color as a 6-character hex value without the leading #. Pattern: ^[A-Fa-f0-9]{6}$.

Response

Returns a binary response containing the generated chart image. The output schema is a string with binary format, so the success response body is the image itself rather than a JSON object.

Query parameters

Name
Type
Description
outputOPTIONAL
string

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.