Updating project color via Update A Project API?

I’m using Zapier with some Node.js code to be able to update the color of a new project that gets created. At the end of the flow, I have this code:

let body = {
    "data": {
        "color": "light-purple"
    }
};
// find the project based on the newProjectID
const res = await fetch('https://app.asana.com/api/1.0/projects/1234567, {
    method: 'PUT',
    headers: {
        'Authorization': 'Bearer 0/69555555555555555c375'
    },
    body: JSON.stringify(body)
});
const data = await res.json();
output = {data: data};

Based on the “Data Out” of the code in Zapier it should be updating the project color, since it does show the color being properly set:

I’ve used similar code to update other things within the project, but for whatever reason, this one isn’t changing the color in Asana (or even when I check the task’s output via:

https://app.asana.com/api/1.0/projects/XXXXX?opt_pretty

It just shows “color” : “none”

Any ideas? Can we not update the color via the API? Or am I doing something wrong?

Hi @FreshyJon,

I haven’t set the project colors through API myself, but is “light-purple” a supported color name in Asana? I couldn’t find the supported color names in the API doc.
I checked the color palette with browser developer tool and there is “purple” but not “light-purple”.

Yes, it looks like that’s a color. Here is a list I’ve stumbled upon when attempting other colors (that didn’t have light- or dark- in them): Color codes in API - #16 by FreshyJon

For whatever reason, it does seem my code is now working, but pretty sure it wasn’t earlier. Seems to be good now.

1 Like

Hi @FreshyJon,
Thank you for the reply and thank you for sharing the color code thread :slight_smile: That’s interesting.
It’s great to hear that your code works now.