Custom Object Fields
You can use this API to add fields to your custom objects. Basic text fields, date fields, as well as customizable drop-down and number fields are available. The fields correspond to the custom object fields that admins can add using the Zendesk admin interface.
The fields are only visible to agents and admins.
Standard Custom Object Fields
Some fields, such as name
and external id
, are predefined and required for every object. The standard fields can't be manually created, deleted, or deactivated, and only the title
, description
, and properties
attributes can be edited. The purpose of these standard fields is to allow customers to edit the display title and description of the name
and external id
fields on a custom object's records. Standard field keys begin with the standard::
prefix.
About dropdown and multiselect fields
Most custom fields let agents enter a single value such as free-form text or a date. The dropdown field lets agents choose a single value from a list of options. The multiselect field lets agents choose one or more values from a list of options. Each option has a name that's visible to the agent and an underlying value that's not visible. In the API, these options are listed in the dropdown and multiselect field's custom_field_options
property. Each option in the list has a name
and value
property. In the Zendesk admin interface, these properties correspond to the "Name" and "Tag" fields.
About lookup relationship fields
Lookup relationship fields are used to connect custom objects to other objects in Zendesk. The lookup relationship field can be defined on a standard object and point to a custom object or within the custom object and point to another custom object or standard object. See Lookup relationships.
JSON format
Custom Object Fields are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
active | boolean | false | false | If true, this field is available for use |
created_at | string | true | false | The time of the last update of the ticket field |
custom_field_options | array | false | false | Required and presented for a custom field of type "dropdown". Each option is represented by an object with a name and value property |
description | string | false | false | User-defined description of this field's purpose |
id | integer | true | false | Automatically assigned upon creation |
key | string | false | true | A unique key that identifies this custom field. This is used for updating the field and referencing in placeholders. The key must consist of only letters, numbers, and underscores. It can't be only numbers |
position | integer | false | false | Ordering of the field relative to other fields |
properties | object | false | false | A set of properties which describe the standard::name field's autonumbering and uniqueness behavior. Autonumbering and uniqueness can't be used together |
raw_description | string | false | false | The dynamic content placeholder, if present, or the description value, if not. See Dynamic Content Items |
raw_title | string | false | false | The dynamic content placeholder, if present, or the title value, if not. See Dynamic Content Items |
regexp_for_validation | string | false | false | Regular expression field only. The validation pattern for a field value to be deemed valid |
relationship_filter | object | false | false | A filter definition that allows your autocomplete to filter down results |
relationship_target_type | string | false | false | A representation of what type of object the field references. Options are "zen:user", "zen:organization", "zen:ticket", and "zen:custom_object:{key}" where key is a custom object key. For example "zen:custom_object:apartment". |
system | boolean | true | false | If true, only active and position values of this field can be changed |
tag | string | false | false | Optional for custom field of type "checkbox"; not presented otherwise. |
title | string | false | true | The title of the custom field |
type | string | false | true | The custom field type: "checkbox", "date", "decimal", "dropdown", "integer", "lookup", "multiselect", "regexp", "text", or "textarea" |
updated_at | string | true | false | The time of the last update of the ticket field |
url | string | true | false | The URL for this resource |
Example
{
"active": true,
"created_at": "2022-09-07T23:21:59Z",
"description": "Make",
"id": 4398096842879,
"key": "make",
"position": 0,
"properties": {
"autoincrement_enabled": true,
"autoincrement_next_sequence": 1,
"autoincrement_padding": 5,
"autoincrement_prefix": "Order # ",
"is_unique": false
},
"raw_description": "Make",
"raw_title": "Make",
"regexp_for_validation": null,
"system": false,
"title": "Make",
"type": "text",
"updated_at": "2022-09-07T23:22:00Z",
"url": "https://company.zendesk.com/api/v2/custom_objects/car/fields/4398096842879.json"
}
List Custom Object Fields
GET /api/v2/custom_objects/{custom_object_key}/fields
Lists all undeleted custom fields for the specified object.
Allowed For
- Agents
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
include_standard_fields | boolean | Query | false | Include standard fields if true. Exclude them if false |
custom_object_key | string | Path | true | The key of a custom object |
Code Samples
Curl
curl --request GET https://example.zendesk.com/api/v2/custom_objects/car/fields?include_standard_fields=true \
--header "Content-Type: application/json" \
-u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/custom_objects/car/fields?include_standard_fields=true"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/fields")
.newBuilder()
.addQueryParameter("include_standard_fields", "true");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/custom_objects/car/fields',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
params: {
'include_standard_fields': 'true',
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/fields?include_standard_fields=true"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/fields")
uri.query = URI.encode_www_form("include_standard_fields": "true")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
curl - Get custom object fields, with standard fields included
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/fields.json?include_standard_fields=true \
-v -u {email_address}/token:{api_token}
Example response(s)
200 OK
// Status 200 OK
{
"custom_object_fields": [
{
"active": true,
"created_at": "2022-09-07T23:21:59Z",
"description": "Name",
"id": 4398096842877,
"key": "standard::name",
"position": 0,
"properties": {
"autoincrement_enabled": true,
"autoincrement_next_sequence": 1,
"autoincrement_padding": 5,
"autoincrement_prefix": "Order # ",
"is_unique": false
},
"raw_description": "Name",
"raw_title": "Name",
"regexp_for_validation": null,
"system": false,
"title": "Name",
"type": "text",
"updated_at": "2022-09-07T23:22:00Z",
"url": "https://{subdomain}.zendesk.com/api/v2/custom_objects/car/fields.json?id=4398096842877"
},
{
"active": true,
"created_at": "2022-09-07T23:21:59Z",
"description": "External ID",
"id": 4398096842878,
"key": "standard::external_id",
"position": 1,
"raw_description": "External ID",
"raw_title": "External ID",
"regexp_for_validation": null,
"system": false,
"title": "External ID",
"type": "text",
"updated_at": "2022-09-07T23:22:00Z",
"url": "https://{subdomain}.zendesk.com/api/v2/custom_objects/car/fields.json?id=4398096842878"
},
{
"active": true,
"created_at": "2022-09-07T23:22:14Z",
"description": "Model",
"id": 4398096843007,
"key": "model",
"position": 2,
"raw_description": "Model",
"raw_title": "Model",
"regexp_for_validation": null,
"system": false,
"title": "Model",
"type": "text",
"updated_at": "2022-09-07T23:22:14Z",
"url": "https://{subdomain}.zendesk.com/api/v2/custom_objects/car/fields.json?id=4398096843007"
}
]
}
Create Custom Object Field
POST /api/v2/custom_objects/{custom_object_key}/fields
Creates any of the following custom field types:
- text (default when no "type" is specified)
- textarea
- checkbox
- date
- integer
- decimal
- regexp
- dropdown
- lookup
- multiselect
See About custom field types in Zendesk help.
Allowed For
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
custom_object_key | string | Path | true | The key of a custom object |
Example body
{
"custom_object_field": {
"key": "color",
"title": "Color",
"type": "text"
}
}
Code Samples
Curl
curl --request POST https://example.zendesk.com/api/v2/custom_objects/car/fields \
--header "Content-Type: application/json" \
-u {email_address}/token:{api_token} \
--data-raw '{
"custom_object_field": {
"key": "color",
"title": "Color",
"type": "text"
}
}'
Go
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://example.zendesk.com/api/v2/custom_objects/car/fields"
method := "POST"
payload := strings.NewReader(`{
"custom_object_field": {
"key": "color",
"title": "Color",
"type": "text"
}
}`)
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/fields")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
{
\"custom_object_field\": {
\"key\": \"color\",
\"title\": \"Color\",
\"type\": \"text\"
}
}""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var data = JSON.stringify({
"custom_object_field": {
"key": "color",
"title": "Color",
"type": "text"
}
});
var config = {
method: 'POST',
url: 'https://example.zendesk.com/api/v2/custom_objects/car/fields',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
data : data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
import json
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/fields"
payload = json.loads("""{
"custom_object_field": {
"key": "color",
"title": "Color",
"type": "text"
}
}""")
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers,
json=payload
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/fields")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
request.body = %q({
"custom_object_field": {
"key": "color",
"title": "Color",
"type": "text"
}
})
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
curl - Create custom object field
For clarity, the example places the JSON in a separate file and imports it into the cURL statement
my_object.json
{
"custom_object_field": {
"title": "Color",
"key": "color",
"type": "text"
}
}
curl - Create custom object field snippet
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/fields.json \
-d @my_object.json \
-H "Content-Type: application/json" -v -u {email_address}/token:{api_token} -X POST
Example response(s)
201 Created
// Status 201 Created
{
"custom_object_field": {
"active": true,
"created_at": "2022-09-07T23:21:59Z",
"description": "Make",
"id": 4398096842879,
"key": "make",
"position": 0,
"raw_description": "Make",
"raw_title": "Make",
"regexp_for_validation": null,
"system": false,
"title": "Make",
"type": "text",
"updated_at": "2022-09-07T23:22:00Z",
"url": "https://{subdomain}.zendesk.com/api/v2/custom_objects/car/fields.json?id=4398096842879"
}
}
Show Custom Object Field
GET /api/v2/custom_objects/{custom_object_key}/fields/{custom_object_field_key_or_id}
Returns a custom field for a specific object using a provided key or id of the field.
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
custom_object_field_key_or_id | string | Path | true | The key or id of a custom object field |
custom_object_key | string | Path | true | The key of a custom object |
Code Samples
Curl
curl --request GET https://example.zendesk.com/api/v2/custom_objects/car/fields/make \
--header "Content-Type: application/json" \
-u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/custom_objects/car/fields/make"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/fields/make")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/custom_objects/car/fields/make',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/fields/make"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/fields/make")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
curl - Get custom object field by key or id
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/fields/{custom_object_field_key_or_id}.json \
-v -u {email_address}/token:{api_token}
Example response(s)
200 OK
// Status 200 OK
{
"custom_object_field": {
"active": true,
"created_at": "2022-09-07T23:21:59Z",
"description": "Make",
"id": 4398096842879,
"key": "make",
"position": 0,
"raw_description": "Make",
"raw_title": "Make",
"regexp_for_validation": null,
"system": false,
"title": "Make",
"type": "text",
"updated_at": "2022-09-07T23:22:00Z",
"url": "https://{subdomain}.zendesk.com/api/v2/custom_objects/car/fields.json?id=4398096842879"
}
}
Update Custom Object Field
PATCH /api/v2/custom_objects/{custom_object_key}/fields/{custom_object_field_key_or_id}
Updates individual custom object fields. The updating rules are as follows:
- Takes a
custom_object_field
object that specifies the properties to update - The
key
property cannot be updated - If updating a standard field, only the
title
,description
, andproperties
attributes can be updated. - The
properties
parameter is comprised of four parts and can't be changed if any records exist for the object.autoincrement_enabled
: A Boolean that enables and disables autonumbering. Must be false if is_unique is true.autoincrement_prefix
: A string value that is used as a prefix to the autogenerated numbers. It can't exceed 30 characters.autoincrement_padding
: An integer specifying the starting number of digits in the autogenerated numbers. This value may be between 0-9. However, if you create records in excess of of these digits, additional digits are added as necessary.autoincrement_next_sequence
: An integer that will be used as the next number in the autonumbering sequence. It can't be negative or less than the current autonumbering value.is_unique
: A Boolean that enforces uniqueness for manually entered record names. When true, custom object record names must be unique. Must be false if autoincrement_enabled is true.
Allowed For
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
custom_object_field_key_or_id | string | Path | true | The key or id of a custom object field |
custom_object_key | string | Path | true | The key of a custom object |
Code Samples
Curl
curl --request PATCH https://example.zendesk.com/api/v2/custom_objects/car/fields/make \
--header "Content-Type: application/json" \
-u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/custom_objects/car/fields/make"
method := "PATCH"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/fields/make")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("PATCH", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'PATCH',
url: 'https://example.zendesk.com/api/v2/custom_objects/car/fields/make',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/fields/make"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"PATCH",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/fields/make")
request = Net::HTTP::Patch.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
curl - Update a custom object field by key or id
For clarity, the example places the JSON in a separate file and imports it into the cURL statement
updated_field.json
{
"custom_object_field": {
"title": "Primary Color"
}
}
curl - Update a custom object field by key or id snippet
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/fields/{custom_object_field_key_or_id}.json \
-d @updated_field.json \
-H "Content-Type: application/json" -X PATCH \
-v -u {email_address}/token:{api_token}
curl - Update a custom object field's autonumbering properties
This example includes changes to the properties of a custom object's name field.
updated_field.json
{
"custom_object_field": {
"properties": {
"autoincrement_enabled": true,
"autoincrement_prefix": "Order Number: ",
"autoincrement_padding": 5,
"autoincrement_next_sequence": 1,
"is_unique": false
}
}
}
curl - Update a custom object field's autonumbering properties snippet
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/fields/{custom_object_field_key_or_id}.json \
-d @updated_field.json \
-H "Content-Type: application/json" -X PATCH \
-v -u {email_address}/token:{api_token}
Example response(s)
200 OK
// Status 200 OK
{
"custom_object_field": {
"active": true,
"created_at": "2022-09-07T23:21:59Z",
"description": "Make",
"id": 4398096842879,
"key": "make",
"position": 0,
"raw_description": "Make",
"raw_title": "Make",
"regexp_for_validation": null,
"system": false,
"title": "Make",
"type": "text",
"updated_at": "2022-09-07T23:22:00Z",
"url": "https://{subdomain}.zendesk.com/api/v2/custom_objects/car/fields.json?id=4398096842879"
}
}
Delete Custom Object Field
DELETE /api/v2/custom_objects/{custom_object_key}/fields/{custom_object_field_key_or_id}
Deletes a field with the specified key. Note: You can't delete standard fields.
Allowed For
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
custom_object_field_key_or_id | string | Path | true | The key or id of a custom object field |
custom_object_key | string | Path | true | The key of a custom object |
Code Samples
Curl
curl --request DELETE https://example.zendesk.com/api/v2/custom_objects/car/fields/make \
--header "Content-Type: application/json" \
-u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/custom_objects/car/fields/make"
method := "DELETE"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/fields/make")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("DELETE", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'DELETE',
url: 'https://example.zendesk.com/api/v2/custom_objects/car/fields/make',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/fields/make"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"DELETE",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI