apyhub
IMAGE PROCESSING · SMART GENERATION

Pie Chart Generator

What it does

Pie Chart Generator turns a set of labeled values into a pie chart image or a shareable chart link. Send a required title and a data array, where each item includes label and value, and you can optionally add color for each slice. You can also set theme to light or dark and fine-tune options such as width, height, title_style, and canvas_color.

Use /download when you need a binary chart image for a report, dashboard export, email attachment, or generated asset pipeline. Use /link when you want a pre-signed URL to the generated chart image instead of the file itself. Both endpoints are built around the same chart inputs, so you can switch between a direct download and a hosted image without changing your chart data.

Pie Chart Generator is a fit for product mix charts, budget breakdowns, survey results, and other share-of-total visualizations. Each slice is defined by a label and non-negative value, so the output stays predictable and easy to render in downstream systems.

If you need a quick way to turn structured totals into a chart image, this service keeps the contract simple: define the title, pass the values, and get back either the image bytes or a URL to the generated chart.

▣ ENDPOINT 01 / 02
POST
Generate pie chart image
https://api.eu.apyverse.com/apyhub/generate-pie-chart/download

QUICKSTART

GUIDE

Quickstart

Generate a pie chart from your chart data and download the result.

curl -X POST "https://api.eu.apyverse.com/apyhub/generate-pie-chart/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Product Market Share",
    "data": [
      { "color": "3B82F6", "label": "Product A", "value": 45 },
      { "color": "10B981", "label": "Product B", "value": 30 },
      { "color": "F59E0B", "label": "Product C", "value": 25 }
    ]
  }'

What you'll get back

Returns a binary file response (string with format: "binary"), so the endpoint downloads the generated pie 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.
pies
Alias for data. Use either data or pies, not both.
Chart theme.
options
title_style
Padding in pixels.
Font size in pixels.
6-character hex color without the leading # symbol.
6-character hex color without the leading # symbol.

About this endpoint

What it does

Generates a pie chart image from the supplied chart data and returns the image as binary content. The request body defines the chart title, slices, theme, and optional rendering options.

Request Body

ParameterTypeMandatoryDescription
dataObject ArrayYesChart slices. Each item must include label and value; color is optional.
data[].colorStringNo6-character hex color without the leading # symbol. Pattern: ^[A-Fa-f0-9]{6}$.
data[].labelStringYesSlice label.
data[].valueNumberYesSlice value. Must be greater than or equal to 0.
piesObject ArrayNoAlias for data. Deprecated. Use either data or pies, not both. Each item must include label and value; color is optional.
pies[].colorStringNo6-character hex color without the leading # symbol. Pattern: ^[A-Fa-f0-9]{6}$.
pies[].labelStringYesSlice label.
pies[].valueNumberYesSlice value. Must be greater than or equal to 0.
themeENUMNoChart theme. Allowed values: light, dark. Default: light.
titleStringYesChart title. Minimum length: 1.
optionsObjectNoRendering options for the chart.
options.widthIntegerNoChart width in pixels. Minimum: 1.
options.heightIntegerNoChart height in pixels. Minimum: 1.
options.title_styleObjectNoTitle styling options.
options.title_style.paddingIntegerNoPadding in pixels. Minimum: 0.
options.title_style.font_sizeNumberNoFont size in pixels. Minimum: 1.
options.title_style.font_colorStringNo6-character hex color without the leading # symbol. Pattern: ^[A-Fa-f0-9]{6}$.
options.canvas_colorStringNoCanvas color as a 6-character hex value without the leading # symbol. Pattern: ^[A-Fa-f0-9]{6}$.

Response

Returns a binary file response containing the generated pie chart image. The output schema is a binary string, so the success response is the image payload itself rather than a JSON object.

ParameterTypeMandatoryDescription
binaryStringYesGenerated pie chart image content returned as binary data.

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.