Api & Custom Fields


i need to update (or create) via API (curl) a task, with some custom fields (enum type) populated.
Just as an example, i have this custom field with these 4 options:
[{“id”:318336795802519,“enabled”:true,“name”:“A Miss”},
{“id”:318336795802520,“enabled”:true,“name”:“A Country miss”},
{“id”:318336795802521,“enabled”:true,“name”:“A Country price anomaly”},
{“id”:318336795802522,“enabled”:true,“name”:“B Anomaly”}],“name”:“Bug Type”,“type”:“enum”},

The job id i need to update is 318401568256461, so my curl expression is:
curl --request PUT -H “Authorization: Bearer MYAPIKEY” https://app.asana.com/api/1.0/tasks/318401568256461 --data-urlencode “custom_fields:{318336795802518:318336795802520}”

I don’t get any error but the job is not updated. Do i miss something? Thanks


Looping in one of Asana’s Developer Relations Leads, @Matt_Bramlage, who I’m hoping can help get your issue addressed! :slight_smile:


Hi there!

Sorry for such a long delay - things have been quite active over here!

Setting custom fields with input being form data can be quite tricky. If you’re using JSON, your format is spot on:

"data": {

with form data (which is what --data-urlencode sends, setting the content type to application/x-www-form-urlencoded) you have to get the path specifier just right in order for it to work. This means a successful request would be

curl --request PUT -H "Authorization: Bearer MYAPIKEY" \
https://app.asana.com/api/1.0/tasks/3184015682564611 \
--data-urlencode "custom_fields.318336795802518=318336795802520"

Hopefully this will work for you!


I’m not able to update the custom fields and get “errors”:[{“message”:"custom_fields: Value is not valid JSON:


It seems to be in the format provided and If I remove the custom_fields parameter I am able to update my task. What is missing?



I would like to recover my tasks with the custom field and others information but I can’t do it.
Can you give me the URL knowing I have this one for now et I want to have theses information too.

Thank you !


Same boat here as James_Ferreira. I can’t seem to update the custom field no matter what kind of format I try.

  var headers = {
    'Authorization': 'Bearer API_KEY'
  var formData = "custom_fields.661393451384417=123";
//  var formData = {
//    'custom_fields': {661393451384417: 123},
//  };

  //formData['custom_fields'][fieldId.toString()] = value;
  var options = {
    'method': 'put',
    'headers': headers,
    'payload': formData
  var response = UrlFetchApp.fetch('https://app.asana.com/api/1.0/tasks/' + taskId, options);

What are we doing wrong?


Did you ever hear back from anyone? I’m stuck in the exact same situation. Thanks!


This does not work. Even on regular CURL on the terminal I get “Could not interpret 683685779381761 as an identifier in custom_fields.683685779381761”

This is the CURL request and I am trying to set an number custom field
curl --request PUT -H “Authorization: Bearer MYKEY”
–data-urlencode “custom_fields.683685779381761=36”

Please Advise


Did anyone get a response to this issue? I am having the exact some problem. I’ve tried every different combination of calls without success.




Hi James,

Can you post some specific code that you’ve tried which hasn’t worked? I think having that as a starting point might make it easier to provide some advice.


Phil_Seeman, nothing form the suggested above does not work. We need just working example of how to update custom field


@Matt_Bramlage Hey Matt, these guys are correct - I just tried the CURL syntax you suggested above (and a bunch of variations of it) and got the same error.

For example, given a task with a text custom field having id 744020393575926, if I do:

curl --request PUT -H "authorization: Bearer MY-PERSONAL-ACCESS-TOKEN" https://app.asana.com/api/1.0/tasks/718125926216046 --data-urlencode "custom_fields.744020393575926=A field updated from CURL"

that results in the error Could not interpret 744020393575926 as an identifier in custom_fields.744020393575926.


Method 1 (with 2 goes at the correct uri):

Dim uri1 As String = String.Format(“https://app.asana.com/api/1.0/tasks/{0}?custom_fields:{1}:{2}”, taskId, customFieldId, value)
Dim uri2 = String.Format(“https://app.asana.com/api/1.0/tasks/{0}?custom_fields.{1}={2}”, taskId, customFieldId, value)

    Dim request As HttpWebRequest = WebRequest.Create(uri1)
    request.Headers.Add(String.Format("Authorization: Bearer {0}", token))
    request.Method = "PUT"
    request.ContentType = "application/x-www-form-urlencoded"

    Dim response As HttpWebResponse = request.GetResponse()


Dim uri As String = String.Format("tasks/{0}", taskId)

    request.Headers.Add(String.Format("Authorization: Bearer {0}", token))
    request.Method = "PUT"
    request.ContentType = "application/json"

    Dim cfParams As New Dictionary(Of String, Object)
    cfParams.Add(customFieldId, value)

    Dim parameters As New Dictionary(Of String, Object)
    parameters.Add("custom_fields", cfParams)

    Dim json As String = JsonConvert.SerializeObject(parameters)

    Using writer As New StreamWriter(request.GetRequestStream())
    End Using

    Dim response As HttpWebResponse = request.GetResponse()

Any guidance/help would be much appreciated.




Your Method 2 looks very close; just add this extra line below your “SerializeObject” line:

Dim json As String = JsonConvert.SerializeObject(parameters)
json = "{\"data\":" + json + "}"

Also, I set the following on my request object (this is in C#):

            request.AllowWriteStreamBuffering = false;
            request.ContentType = "application/json";
            request.Accept = "Accept=application/json";
            request.SendChunked = false;
            request.ContentLength = json.Length;


Great thanks. That has worked :slight_smile: I think the API reference could be clearer and provide a code example using the parameters you outlined (and maybe in a couple of different languages). Just for clarity!


PHP example that works for me.

$taskId = ‘830265114072917’;
$customFieldId = ‘832291596179375’;
$value = ‘test value’;

    $data = [
        'data' => [
            'custom_fields' => [
                $customFieldId => $value

    $url = 'https://app.asana.com/api/1.0/tasks/%s';
    $url = sprintf($url, $taskId);

    $fetch_request = curl_init($url);
    curl_setopt($fetch_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
    curl_setopt($fetch_request, CURLOPT_HEADER, false);
    curl_setopt($fetch_request, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($fetch_request, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($fetch_request, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($fetch_request, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($fetch_request, CURLOPT_POSTFIELDS, json_encode($data));

    curl_setopt($fetch_request, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json',
        "authorization: Bearer $this->secret",

    $response = curl_exec($fetch_request);

    $result = json_decode($response, true);