Skip to contentSkip to navigationSkip to topbar
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 (The Twilio SendGrid v3 API)

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
Property nameTypeRequiredDescription
authorizationstring
required
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
customFieldIdstring
required
Encoding type:application/json
SchemaExample
Property nameTypeRequiredDescriptionChild properties
namestring
required
Min length: 1Max length: 100
200400404
SchemaExample
Property nameTypeRequiredDescriptionChild properties
idstring

Optional


namestring

Optional

Min length: 1Max length: 100

fieldTypeenum<string>

Optional

Possible values:
TextNumberDate

Metadata_metadata

Optional

Update Custom Field DefinitionLink to code sample: Update Custom Field Definition
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const custom_field_id = "custom_field_id";
5
const data = {
6
name: "new_custom_field_name",
7
};
8
9
const request = {
10
url: `/v3/marketing/field_definitions/${custom_field_id}`,
11
method: "PATCH",
12
body: data,
13
};
14
15
client
16
.request(request)
17
.then(([response, body]) => {
18
console.log(response.statusCode);
19
console.log(response.body);
20
})
21
.catch((error) => {
22
console.error(error);
23
});