The Text2Color API allows you to convert text descriptions of colors in any language into their corresponding color codes. This API uses advanced language processing to interpret color descriptions and return accurate color representations in various formats including HEX, RGB and CMYK.
All API requests should be made to:
https://api.text2color.com
The API requires authentication for all requests. You need to include your API key in the header of each request.
To use the API, you need to include your API key in the X-API-Key
header of each request:
X-API-Key: your_api_key_here
To obtain an API key, you need to register for an account. Once registered, you can generate API keys from your account dashboard.
The API uses a credit system. Each API call consumes one credit from your account.
New users receive 10 free credits upon registration.
Additional credits can be purchased through our Stripe integration. The following credit packages are available:
To purchase credits, login to your account.
This endpoint takes a text description of a color and returns the corresponding color information in the specified format. This request requires authentication and consumes one credit. The maximum input is 100 characters.
Name | Type | Description |
---|---|---|
format | string | The desired color format. Options: color (returns all), hex, rgb, cmyk |
color_description | string | A text description of the desired color (e.g., "sky blue", "vibrant red", "mint green") |
The API returns a JSON object with the following structure:
{
"color_description": "string",
"format": "string",
"value": "string or object (depending on format)"
}
Request (COLOR):
GET https://api.text2color.com/color/sky%20blue
Response:
{
"color_description": "sky blue",
"cmyk": [
42,
12,
0,
7
],
"hex_code": "#87ceeb",
"rgb": [
135,
206,
235
]
}
Request (HEX):
GET https://api.text2color.com/hex/sky%20blue
Response:
{
"color_description": "sky blue",
"format": "hex",
"value": "#87CEEB"
}
Request (RGB):
GET https://api.text2color.com/rgb/forest%20green
Response:
{
"color_description": "forest green",
"format": "rgb",
"value": {
"r": 34,
"g": 139,
"b": 34
}
}
Request (CMYK):
GET https://api.text2color.com/cmyk/deep%20purple
Response:
{
"color_description": "deep purple",
"format": "cmyk",
"value": {
"c": 75,
"m": 100,
"y": 0,
"k": 20
}
}
In case of an error, the API will return an appropriate HTTP status code along with a JSON object containing an error message.
{
"error": "Invalid color format specified"
}
{
"error": "API key is missing"
}
{
"error": "Invalid API key"
}
{
"error": "Insufficient credits"
}
Try out the API right here! Enter your API key, a color description, and select a format to see the result.
If you encounter any issues or have questions about the API, please contact our support team at support@text2color.com