curl --request POST \
--url https://{your-subdomain}.neetodesk.com/api/external/v2/fields \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"field": {
"name": "Browser",
"kind": "single_option",
"data": [
"Chrome",
"Firefox",
"Safari"
],
"state": "active",
"is_required": false,
"is_required_for_agent_when_submitting_form": false,
"is_required_for_agent_when_closing_ticket": false,
"display_order": 3,
"placeholder_slug": "browser"
}
}
'import requests
url = "https://{your-subdomain}.neetodesk.com/api/external/v2/fields"
payload = { "field": {
"name": "Browser",
"kind": "single_option",
"data": ["Chrome", "Firefox", "Safari"],
"state": "active",
"is_required": False,
"is_required_for_agent_when_submitting_form": False,
"is_required_for_agent_when_closing_ticket": False,
"display_order": 3,
"placeholder_slug": "browser"
} }
headers = {
"X-Api-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
field: {
name: 'Browser',
kind: 'single_option',
data: ['Chrome', 'Firefox', 'Safari'],
state: 'active',
is_required: false,
is_required_for_agent_when_submitting_form: false,
is_required_for_agent_when_closing_ticket: false,
display_order: 3,
placeholder_slug: 'browser'
}
})
};
fetch('https://{your-subdomain}.neetodesk.com/api/external/v2/fields', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{your-subdomain}.neetodesk.com/api/external/v2/fields",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'field' => [
'name' => 'Browser',
'kind' => 'single_option',
'data' => [
'Chrome',
'Firefox',
'Safari'
],
'state' => 'active',
'is_required' => false,
'is_required_for_agent_when_submitting_form' => false,
'is_required_for_agent_when_closing_ticket' => false,
'display_order' => 3,
'placeholder_slug' => 'browser'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{your-subdomain}.neetodesk.com/api/external/v2/fields"
payload := strings.NewReader("{\n \"field\": {\n \"name\": \"Browser\",\n \"kind\": \"single_option\",\n \"data\": [\n \"Chrome\",\n \"Firefox\",\n \"Safari\"\n ],\n \"state\": \"active\",\n \"is_required\": false,\n \"is_required_for_agent_when_submitting_form\": false,\n \"is_required_for_agent_when_closing_ticket\": false,\n \"display_order\": 3,\n \"placeholder_slug\": \"browser\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{your-subdomain}.neetodesk.com/api/external/v2/fields")
.header("X-Api-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"field\": {\n \"name\": \"Browser\",\n \"kind\": \"single_option\",\n \"data\": [\n \"Chrome\",\n \"Firefox\",\n \"Safari\"\n ],\n \"state\": \"active\",\n \"is_required\": false,\n \"is_required_for_agent_when_submitting_form\": false,\n \"is_required_for_agent_when_closing_ticket\": false,\n \"display_order\": 3,\n \"placeholder_slug\": \"browser\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{your-subdomain}.neetodesk.com/api/external/v2/fields")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"field\": {\n \"name\": \"Browser\",\n \"kind\": \"single_option\",\n \"data\": [\n \"Chrome\",\n \"Firefox\",\n \"Safari\"\n ],\n \"state\": \"active\",\n \"is_required\": false,\n \"is_required_for_agent_when_submitting_form\": false,\n \"is_required_for_agent_when_closing_ticket\": false,\n \"display_order\": 3,\n \"placeholder_slug\": \"browser\"\n }\n}"
response = http.request(request)
puts response.read_body{
"field": {
"id": "aaaabbbb-cccc-dddd-eeee-ffff00003333",
"name": "Browser",
"kind": "single_option",
"state": "active",
"resource_type": "ticket",
"is_required": false,
"is_required_for_agent_when_submitting_form": false,
"is_required_for_agent_when_closing_ticket": false,
"display_order": 3,
"placeholder_slug": "browser",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"options": [
{
"id": "aaaabbbb-cccc-dddd-eeee-ffff00004444",
"label": "Chrome",
"display_order": 0
}
]
}
}Create ticket field
Creates a custom ticket field in the workspace.
curl --request POST \
--url https://{your-subdomain}.neetodesk.com/api/external/v2/fields \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"field": {
"name": "Browser",
"kind": "single_option",
"data": [
"Chrome",
"Firefox",
"Safari"
],
"state": "active",
"is_required": false,
"is_required_for_agent_when_submitting_form": false,
"is_required_for_agent_when_closing_ticket": false,
"display_order": 3,
"placeholder_slug": "browser"
}
}
'import requests
url = "https://{your-subdomain}.neetodesk.com/api/external/v2/fields"
payload = { "field": {
"name": "Browser",
"kind": "single_option",
"data": ["Chrome", "Firefox", "Safari"],
"state": "active",
"is_required": False,
"is_required_for_agent_when_submitting_form": False,
"is_required_for_agent_when_closing_ticket": False,
"display_order": 3,
"placeholder_slug": "browser"
} }
headers = {
"X-Api-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
field: {
name: 'Browser',
kind: 'single_option',
data: ['Chrome', 'Firefox', 'Safari'],
state: 'active',
is_required: false,
is_required_for_agent_when_submitting_form: false,
is_required_for_agent_when_closing_ticket: false,
display_order: 3,
placeholder_slug: 'browser'
}
})
};
fetch('https://{your-subdomain}.neetodesk.com/api/external/v2/fields', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{your-subdomain}.neetodesk.com/api/external/v2/fields",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'field' => [
'name' => 'Browser',
'kind' => 'single_option',
'data' => [
'Chrome',
'Firefox',
'Safari'
],
'state' => 'active',
'is_required' => false,
'is_required_for_agent_when_submitting_form' => false,
'is_required_for_agent_when_closing_ticket' => false,
'display_order' => 3,
'placeholder_slug' => 'browser'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{your-subdomain}.neetodesk.com/api/external/v2/fields"
payload := strings.NewReader("{\n \"field\": {\n \"name\": \"Browser\",\n \"kind\": \"single_option\",\n \"data\": [\n \"Chrome\",\n \"Firefox\",\n \"Safari\"\n ],\n \"state\": \"active\",\n \"is_required\": false,\n \"is_required_for_agent_when_submitting_form\": false,\n \"is_required_for_agent_when_closing_ticket\": false,\n \"display_order\": 3,\n \"placeholder_slug\": \"browser\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{your-subdomain}.neetodesk.com/api/external/v2/fields")
.header("X-Api-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"field\": {\n \"name\": \"Browser\",\n \"kind\": \"single_option\",\n \"data\": [\n \"Chrome\",\n \"Firefox\",\n \"Safari\"\n ],\n \"state\": \"active\",\n \"is_required\": false,\n \"is_required_for_agent_when_submitting_form\": false,\n \"is_required_for_agent_when_closing_ticket\": false,\n \"display_order\": 3,\n \"placeholder_slug\": \"browser\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{your-subdomain}.neetodesk.com/api/external/v2/fields")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"field\": {\n \"name\": \"Browser\",\n \"kind\": \"single_option\",\n \"data\": [\n \"Chrome\",\n \"Firefox\",\n \"Safari\"\n ],\n \"state\": \"active\",\n \"is_required\": false,\n \"is_required_for_agent_when_submitting_form\": false,\n \"is_required_for_agent_when_closing_ticket\": false,\n \"display_order\": 3,\n \"placeholder_slug\": \"browser\"\n }\n}"
response = http.request(request)
puts response.read_body{
"field": {
"id": "aaaabbbb-cccc-dddd-eeee-ffff00003333",
"name": "Browser",
"kind": "single_option",
"state": "active",
"resource_type": "ticket",
"is_required": false,
"is_required_for_agent_when_submitting_form": false,
"is_required_for_agent_when_closing_ticket": false,
"display_order": 3,
"placeholder_slug": "browser",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"options": [
{
"id": "aaaabbbb-cccc-dddd-eeee-ffff00004444",
"label": "Chrome",
"display_order": 0
}
]
}
}{your-subdomain} with your workspace’s subdomain. Learn how to find your subdomain in Workspace subdomain.
Headers
Use the X-Api-Key header to provide your workspace API key. Refer to Authentication for more information.
Body
Hide child attributes
Hide child attributes
Name of the field. It must be unique in the workspace.
"Browser"
Type of the field. It cannot be changed once the field is created.
text, textarea, integer, decimal, date, checkbox, single_option, multi_option "single_option"
Option labels of the field. Required for single_option and multi_option fields and ignored for all other kinds. Labels must be unique and cannot exceed 500 options. An ID is generated for every option, and these IDs are needed to rename or remove the option later.
["Chrome", "Firefox", "Safari"]
State of the field. Defaults to active.
active, inactive "active"
Set to true to make the field mandatory for customers while submitting a ticket. Defaults to false.
false
Set to true to make the field mandatory for agents while creating a ticket. Defaults to false.
false
Set to true to make the field mandatory for agents before they close a ticket. Defaults to false.
false
Position of the field in the list of ticket fields. The field is added at the end when omitted.
3
Unique name for this field that can be used in placeholders and automations. Generated from the name when omitted.
"browser"
Response
Created - Field created successfully
Hide child attributes
Hide child attributes
"aaaabbbb-cccc-dddd-eeee-ffff00003333"
"Browser"
Type of the field. It cannot be changed after the field is created.
text, textarea, integer, decimal, date, checkbox, single_option, multi_option "single_option"
Fields in the inactive state are hidden from agents and customers.
active, inactive "active"
Resource the field belongs to. Always ticket.
"ticket"
Whether customers must fill this field while submitting a ticket.
false
Whether agents must fill this field while creating a ticket.
false
Whether agents must fill this field before closing a ticket.
false
Position of the field in the list of ticket fields.
3
Slug used to refer to the field in placeholders and automations, as {{ticket.custom_fields.<placeholder_slug>}}. Generated from the name when the field is created, and not regenerated when the field is renamed.
"browser"