V1 API Deal Custom Fields

Hello

We are using the V1 API to create contacts via the contact_sync action and we can pass in custom field values.

We now want to do the same for deals, create a deal and set the custom field values. Looking at the documentation I cannot see a way to set custom field values.

Would really appreciate some help

Thanks

Hi there, Amy from ActiveCampaign’s Customer Experience Team. We’re just refreshing our forum page and I wanted to add some help here for anyone who comes across this page/question/post.

Using V1 API, you can indeed create deals and set custom field values. However, the process might be slightly different compared to creating contacts with custom field values using the contact_sync action.

To create a deal with custom field values, you’ll need to use the following endpoints:

Create Deal: Use the /deal_add endpoint to create a new deal. You’ll need to provide the necessary parameters such as the deal name, contact ID, pipeline ID, and other deal details.
Set Custom Field Values: After creating the deal, you can set custom field values using the /fieldValues endpoint. This endpoint allows you to update custom field values for a specific deal. You’ll need to provide the deal ID and the custom field values you want to set.

Here’s an example:

Create a new deal:

POST /deal_add
{
    "contact_id": 123, // ID of the contact associated with the deal
    "pipeline_id": 456, // ID of the pipeline where the deal belongs
    "title": "New Deal", // Name of the deal
    // Other deal parameters...
}

Set custom field values for the created deal:

POST /fieldValues
{
    "fieldValues": [
        {
            "field": "123", // Custom field ID
            "value": "Custom Field Value"
        },
        // Additional custom field values...
    ],
    "object": "deal", // Indicates the object type (deal in this case)
    "id": 789 // ID of the created deal
}

Replace placeholders such as 123, 456, and 789 with actual IDs and values from your ActiveCampaign account.

Alternatively, using V3 API, you can also create deals and set custom field values. The process is similar to the V1 API but with some differences in endpoint structure and authentication methods.

To create a deal with custom field values using the V3 API, you’ll typically follow these steps:

Authenticate: Obtain an access token using OAuth 2.0 authentication. This token will be used to authenticate your API requests.
Create Deal: Use the /deals endpoint to create a new deal. Provide the necessary parameters such as the contact ID, pipeline ID, deal name, and other deal details.
Set Custom Field Values: After creating the deal, you can set custom field values using the /dealCustomFieldData endpoint. This endpoint allows you to update custom field values for a specific deal. Provide the deal ID and the custom field values you want to set.

Here’s an example of how you can achieve this using the V3 API:

Create a new deal:

POST /deals
Authorization: Bearer YOUR_ACCESS_TOKEN
{
    "contact": {
        "id": 123 // ID of the contact associated with the deal
    },
    "pipeline": {
        "id": 456 // ID of the pipeline where the deal belongs
    },
    "title": "New Deal", // Name of the deal
    // Other deal parameters...
}
  1. Set custom field values for the created deal:
POST /dealCustomFieldData
Authorization: Bearer YOUR_ACCESS_TOKEN
{
    "contact": {
        "id": 123 // ID of the contact associated with the deal
    },
    "deal": {
        "id": 789 // ID of the created deal
    },
    "fieldValues": [
        {
            "field": "custom_field_key", // Custom field key or ID
            "value": "Custom Field Value"
        },
        // Additional custom field values...
    ]
}

Remember to replace placeholders such as 123, 456, 789, YOUR_ACCESS_TOKEN, and custom_field_key with actual values from your ActiveCampaign account.

Any questions or additional ideas, thread them below!