apyhub
Back

Detect Image Color from URL API

What it does

Detect Image Color lets you find the dominant color of any image from its URL. Send a GET request to /detect-color with the image url, and get back structured color data you can use right away, without running your own image analysis.

The url parameter is required and can be up to 1000 characters long. The response is a JSON array of objects. Each object can include hex_code, main_color, and specific_color, which are all strings. Any of them may be null when a value can't be determined, so handle empty fields in your code.

Use hex_code when you need an exact value for styling, such as a card background or accent color. Use main_color for broad categories like red or blue, and specific_color when you want a more precise color name for labels or search filters.

Use Detect Image Color when you need to tag or sort images by color, build color filters for a product or media catalog, match UI accents to uploaded pictures, or add color metadata to images in a content pipeline.

GET
Detect Main Image Color API
https://api.eu.apyhub.com/skycraft/image-color-detection-api/detect-color

QUICKSTART

GUIDE

Quickstart

Detect the main color of an image by passing its url query parameter.

curl -X GET "https://api.eu.apyhub.com/skycraft/image-color-detection-api/detect-color?url=https://assets.apyhub.com/samples/sample.png&width=200&height=200&crop=true" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON array of objects. Each object may include hex_code, main_color, and specific_color, all of which can be null.

[
  {
    "hex_code": "#73685b",
    "specific_color": "Dim Gray",
    "main_color": "Gray"
  },
  {
    "hex_code": "#e5eeed",
    "specific_color": "Catskill White",
    "main_color": "White"
  },
  {
    "hex_code": "#b78f1f",
    "specific_color": "Dark Golden Rod",
    "main_color": "Yellow"
  },
  {
    "hex_code": "#3f3326",
    "specific_color": "Woody Brown",
    "main_color": "Brown"
  }
]
TRY ITLIVE · 20 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.

About this endpoint

What it does

Detects the main color in an image identified by the url query parameter and returns the result as a JSON array of color objects.

Query Parameter(s)

AttributeTypeDescription
urlStringImage URL to analyze. Max length: 1000 characters.

Response

Returns a JSON array of objects. Each object may contain hex_code, main_color, and specific_color fields, all of which are strings and may be null.

ParameterTypeDescription
itemObjectOne detected color result.
item.hex_codeStringHex color code for the detected color, or null.
item.main_colorStringMain color name, or null.
item.specific_colorStringMore specific color name, or null.
▣ 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.