API
Overview

API Overview

Welcome to the Trycolors API documentation. Our API allows you to integrate powerful color mixing and matching capabilities into your applications. With the Trycolors API, you can programmatically mix colors, find similar paints, and reverse-engineer color mixes.

Getting Started

To start using the Trycolors API:

  1. Sign up for an account at trycolors.com/signin (opens in a new tab).
  2. Generate your API key in your user account settings.
  3. Use the API key to authenticate your requests.

Base URL

All API requests should be made to:

https://api.trycolors.com/v1

Available Endpoints

The Trycolors API offers the following main endpoints:

  • /mix-colors: Mix multiple colors together
  • /unmix-color: Reverse-engineer a target color into its constituent colors
  • /similar-paints: Find paints similar to a given color

Example: Mixing Colors

Here's a quick example of how to use the API to mix colors:

async function mixColors() {
    const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key
    const endpoint = 'https://api.trycolors.com/v1/mix-colors';
    const payload = {
        colors: [
            { hex: '#FFAA16', count: 1 },
            { hex: '#BA12FF', count: 1 }
        ]
    };
 
    try {
        const response = await fetch(endpoint, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'X-API-KEY': apiKey
            },
            body: JSON.stringify(payload)
        });
 
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
 
        const data = await response.json();
        console.log('Mixed Color:', data.mixedColor);
    } catch (error) {
        console.error('Error mixing colors:', error.message);
    }
}
 
mixColors();

Next Steps

For any questions or feedback, please contact our support team (opens in a new tab).