Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Update Custom Field Definition



API Overview

api-overview page anchor

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.


Authentication

authentication page anchor
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
custom_field_idstringrequired
SchemaExample
namestringrequired
Min length: 1Max length: 100
200400404
SchemaExample
idstring

namestring
Min length: 1Max length: 100

field_typeenum<string>
Possible values:
TextNumberDate

_metadataobject

Update Custom Field Definition

update-custom-field-definition page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_22
const client = require('@sendgrid/client');
_22
client.setApiKey(process.env.SENDGRID_API_KEY);
_22
_22
const custom_field_id = "ZGkrHSypTsudrGkmdpJJ";
_22
const data = {
_22
"name": "new_custom_field_name"
_22
};
_22
_22
const request = {
_22
url: `/v3/marketing/field_definitions/${custom_field_id}`,
_22
method: 'PATCH',
_22
body: data
_22
}
_22
_22
client.request(request)
_22
.then(([response, body]) => {
_22
console.log(response.statusCode);
_22
console.log(response.body);
_22
})
_22
.catch(error => {
_22
console.error(error);
_22
});


Rate this page: