Skip to main content
POST
/
v2
/
custom-field
Create Custom Field
curl --request POST \
  --url https://api.sonderplan.com/v2/custom-field \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Booking Type",
  "type": "select",
  "module": "booking",
  "description": "Select the type of booking",
  "options": [
    {
      "id": "4934",
      "name": "Video Editing",
      "order": "2"
    }
  ],
  "order": 3,
  "required": true,
  "update_key": "2_1_8942"
}
'
import requests

url = "https://api.sonderplan.com/v2/custom-field"

payload = {
"name": "Booking Type",
"type": "select",
"module": "booking",
"description": "Select the type of booking",
"options": [
{
"id": "4934",
"name": "Video Editing",
"order": "2"
}
],
"order": 3,
"required": True,
"update_key": "2_1_8942"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Booking Type',
type: 'select',
module: 'booking',
description: 'Select the type of booking',
options: [{id: '4934', name: 'Video Editing', order: '2'}],
order: 3,
required: true,
update_key: '2_1_8942'
})
};

fetch('https://api.sonderplan.com/v2/custom-field', 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://api.sonderplan.com/v2/custom-field",
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([
'name' => 'Booking Type',
'type' => 'select',
'module' => 'booking',
'description' => 'Select the type of booking',
'options' => [
[
'id' => '4934',
'name' => 'Video Editing',
'order' => '2'
]
],
'order' => 3,
'required' => true,
'update_key' => '2_1_8942'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$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://api.sonderplan.com/v2/custom-field"

payload := strings.NewReader("{\n \"name\": \"Booking Type\",\n \"type\": \"select\",\n \"module\": \"booking\",\n \"description\": \"Select the type of booking\",\n \"options\": [\n {\n \"id\": \"4934\",\n \"name\": \"Video Editing\",\n \"order\": \"2\"\n }\n ],\n \"order\": 3,\n \"required\": true,\n \"update_key\": \"2_1_8942\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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://api.sonderplan.com/v2/custom-field")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Booking Type\",\n \"type\": \"select\",\n \"module\": \"booking\",\n \"description\": \"Select the type of booking\",\n \"options\": [\n {\n \"id\": \"4934\",\n \"name\": \"Video Editing\",\n \"order\": \"2\"\n }\n ],\n \"order\": 3,\n \"required\": true,\n \"update_key\": \"2_1_8942\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sonderplan.com/v2/custom-field")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Booking Type\",\n \"type\": \"select\",\n \"module\": \"booking\",\n \"description\": \"Select the type of booking\",\n \"options\": [\n {\n \"id\": \"4934\",\n \"name\": \"Video Editing\",\n \"order\": \"2\"\n }\n ],\n \"order\": 3,\n \"required\": true,\n \"update_key\": \"2_1_8942\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": {
    "id": 1
  }
}
{
"error": {
"code": "404",
"message": "Requested resource was not found"
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Custom Field object that needs to be added

The default custom field schema

name
string
required

Name of the custom field

Example:

"Booking Type"

type
enum<string>
required

The type of the custom field

Available options:
text,
textarea,
select,
number,
date,
datetime
Example:

"select"

module
enum<string>
required

The module that this custom field is linked to

Available options:
booking,
project,
people,
organization,
quote,
invoice,
quote_invoice,
billable_item
Example:

"booking"

description
string

Description of the custom field, shown in the UI at the help icon

Example:

"Select the type of booking"

options
Custom Field Option Model · object[]
order
integer

Relative order id of this field in relation to other custom fields in the same module

Example:

3

required
boolean

Marks this field as required, enforced by the API and UI

Example:

true

update_key
string
deprecated

The update key to pass back when updating this field

Example:

"2_1_8942"

Response

Successful Operation

success
object