Create Contact with custom field values

We are trying to create new Contact with APIv3 .Contact has some custom fields like Name.
Need to make two API calls one to create contact and another one to add custom field value.
Is there any way in one API call we can create Contact aswell with custom field Name.

Similarly, If we need to add the contact to some predefined list need to make another Rest call.

Can we do all together in one call createContact+add customField value + assign contact to list.

1 Like

I have the same problem. I have done code based on this example: https://www.activecampaign.com/api/example.php?call=contact_add

But i am not able to set custom field value while adding through API
any help will be appreciated.

Hey,
You can create Contact with custom fields value set in the Active campaign using the API v3.

https://developers.activecampaign.com/reference#create-a-contact-new
Check out this API doc.

{
	"contact": {
		"email": "johndoe@example.com",
		"firstName": "John",
		"lastName": "Doe",
		"phone": "7223224241",
           "fieldValues":[
                {
                    "field":"1",
                    "value":"The Value for First Field"
                },
               {
                    "field":"6",
                    "value":"2008-01-20"
              }
         ]
	}
}

Here you have fieldValues which are the custom fields of Contact.

Get all details about the custom fields from your Contact using the API: https://developers.activecampaign.com/reference#retrieve-fields-1

From this API you will get to know all the custom fields and their IDs. Use that ID and set the value that you want while creating the API.

{
“field”:“fieldId”,
“value”:“value of the field”
}

It would be super nice when custom fields where also available on E-Commerce Customers (DeepData) https://developers.activecampaign.com/reference#customers

I have tried this and it seems to be not working.

I posted this to AC. the contact was created but no field values.

The field(s) exist and I have tried with fields that don’t exist too… same issue

   "contact":{
      "email":"myemail@gmail.com",
      "firstName":"abc",
      "lastName":"123",
      "phone":null,
      "fieldValues":[
         {
            "field":"fieldOne",
            "value":"True"
         },
         {
            "field":"Project",
            "value":"Avengers"
         }
      ]
   }
}

I have changed the value in “field” to be the field ID. Its working for me now.

This could be more explicit in the docs.

Thank you, @srosamac3, for bringing this to our attention. We are editing the documentation now to better reflect the need to use the custom field’s id.