Trello Rest API - Card Colors/Covers

Apologies if this has been asked/answered; I didn’t find any threads.

Will the Rest API be updated to allow for control over a card’s cover/color?

1 Like

Great question! It isn’t documented yet (on my to-do, I promise!).

Let me see if I can’t give a rough outline of it here:

On a PUT to /1/cards/{idCard} you can pass in a cover key and object with the following option key/values:

Option Values About
color pink, yellow, lime, blue, black, orange, red, purple, sky, green Makes the cover a solid color .
brightness dark, light Determines whether the text on the cover should be dark or light.
url An unsplash URL: https://images.unsplash.com Used if making an image the cover. Only Unsplash URLs work.
idAttachment ID of an attachment on the card Used if setting an attached image as the cover.
size normal, full Determines whether to show the card name on the cover, or below it.

brightness can be sent alongside any of the other parameters, but all of the other parameters are mutually exclusive; you can not have the cover be a color and an idAttachment at the same time.

On the brightness options, setting it to light will make the text on the card cover dark:
05%20PM

And vice versa, setting it to dark will make the text on the card cover light:
31%20PM

Additionally, we added a setCover to the attachments POST endpoint that accepts a Boolean value. If true the attached image will be made the card cover.

POST https://trello.com/1/cards/{idCard}/attachments

{
  file: [fileData],
  setCover: true,
}
1 Like

Perfect! That’ll do for me for now! Thank you!

Also, anything on your roadmap that will allow custom RGB values for card covers? Considering the brightness setting, I think this would be an awesome and useful option!

Thanks again!

As far as I know, that isn’t on the roadmap right now.

But I’ll happily pass along the idea! :slight_smile:

Hey @bcook

I tried this today but was not able to set the cover on the card, can you confirm current API supports this?

Yes, I’m certain the API supports this. Here is the blog announcing this feature: https://blog.trello.com/card-covers-and-colors.

If you open your browser’s network tab and watch the requests made by the Trello web client to the server, you’ll see a cover object in the payload when you make changes to the card cover via this widget on the right of the card back:

The API documented and available to you is the same one that the web client (and mobile clients!) use, as well.