Skip to main content
PUT
/
v4
/
custom_fields
/
{id}
Update a custom field
curl --request PUT \
  --url https://api.kit.com/v4/custom_fields/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-Kit-Api-Key: <api-key>' \
  --data '
{
  "label": "Last name"
}
'
require 'uri'
require 'net/http'

url = URI("https://api.kit.com/v4/custom_fields/{id}")

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

request = Net::HTTP::Put.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"Last name\"\n}"

response = http.request(request)
puts response.read_body
const options = {
method: 'PUT',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({label: 'Last name'})
};

fetch('https://api.kit.com/v4/custom_fields/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.kit.com/v4/custom_fields/{id}"

payload := strings.NewReader("{\n \"label\": \"Last name\"\n}")

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

req.Header.Add("X-Kit-Api-Key", "<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))

}
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/custom_fields/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'label' => 'Last name'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests

url = "https://api.kit.com/v4/custom_fields/{id}"

payload = { "label": "Last name" }
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
{
  "custom_field": {
    "id": 27,
    "name": "ck_field_27_last_name",
    "key": "lastname",
    "label": "Last name"
  }
}
{
"errors": [
"The access token is invalid"
]
}
{
"errors": [
"Not Found"
]
}
{
"errors": [
"Label can't be blank"
]
}

Authorizations

X-Kit-Api-Key
string
header
required

Authenticate API requests via an API Key

Path Parameters

id
integer
required

Body

application/json
label
string
required

Response

Updates the custom field and returns its details

custom_field
object
required