Update Custom Field Definition
Custom Fields allow you to add extra information about your contacts to your contact database. With custom fields, you can create custom segments from your individual contacts or from your contact database that will dynamically update your content with the values for the individual contact receiving the email. Your custom fields are completely customizable to the use cases and user information that you need.
You can also manage your Custom Fields using the Custom Fields UI in the Marketing Campaigns App(link takes you to an external page) . For more about creating Custom Fields, including a list of Reserved Fields, see our Custom Fields documentation .
PATCH /v3/marketing/field_definitions/{custom_field_id} Base url: https://api.sendgrid.com This endpoint allows you to update a defined Custom Field.
Only your Custom fields can be modified; Reserved Fields cannot be updated.
Property name Type Required Description
custom_field_id string required
Property name Type Required Description Child properties
name string required
Min length: 1
Max length: 100
{
"name" : "new_custom_field_name"
}
Property name Type Required Description Child properties
name string
Min length: 1
Max length: 100
field_type enum<string>
Possible values: Text
Number
Date
_metadata object
Show child properties
for _metadata Property name Type Required Description Child properties
{
"id" : "a1_T" ,
"name" : "custom_field_name" ,
"field_type" : "Text" ,
"_metadata" : {
"self" : "https://api.sendgrid.com/v3/marketing/field_definitions/a1_B"
}
}
Property name Type Required Description Child properties
errors array[object]
Show child properties
for errors Property name Type Required Description Child properties
Property name Type Required Description Child properties
errors array[object]
Show child properties
for errors Property name Type Required Description Child properties
_22 const client = require('@sendgrid/client');
_22 client.setApiKey(process.env.SENDGRID_API_KEY);
_22 const custom_field_id = "ZGkrHSypTsudrGkmdpJJ";
_22 "name": "new_custom_field_name"
_22 url: `/v3/marketing/field_definitions/${custom_field_id}`,
_22 client.request(request)
_22 .then(([response, body]) => {
_22 console.log(response.statusCode);
_22 console.log(response.body);
_22 console.error(error);