Update a contact field
/api/v1/contact-fields/{field}Parameters
| Name | In | Type | Description |
|---|---|---|---|
fieldrequired | path | string | The field identifier. |
Request body
labelstringThe display name.
requiredbooleanWhether every contact must carry a value.
default_valuestringUsed at send time for a contact with no value of their own.
help_textstringThe hint shown beside the input on a form.
typestringHow a value is edited and shown:
text,number,dateorboolean.
Request
/api/v1/contact-fields/{field}curl -X PUT 'https://app.mailyte.com/api/v1/contact-fields/01JBT8XQ2M9WYC3K4F6R7S8T9V' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"label": "label",
"required": true
}'const response = await fetch('https://app.mailyte.com/api/v1/contact-fields/01JBT8XQ2M9WYC3K4F6R7S8T9V', {
method: 'PUT',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"label": "label",
"required": true
}),
});
const { data } = await response.json();import requests
response = requests.put(
"https://app.mailyte.com/api/v1/contact-fields/01JBT8XQ2M9WYC3K4F6R7S8T9V",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
json={
"label": "label",
"required": true
},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->put('https://app.mailyte.com/api/v1/contact-fields/01JBT8XQ2M9WYC3K4F6R7S8T9V', [
'label' => 'label',
'required' => true,
]);
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/contact-fields/01JBT8XQ2M9WYC3K4F6R7S8T9V")
request = Net::HTTP::Put.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
"label": "label",
"required": true
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataobjectOne usable key of a contact's
fieldsobject. Serves bothGET /contact-fields(the declared catalog) andGET /contacts/attribute-keys(the catalog plus keys observed on contact data), which is whydeclaredexists.objectstringcontact_fieldidstringThe definition's id, for
PUT/DELETE /contact-fields/{field}.nullwhendeclaredis false — there is no definition row, so there is nothing to address.keystringThe stable name. This is the key inside a contact's
fieldsobject and the{{ signup_date }}tag in campaign content. Contact values are keyed by this, never byid.declaredbooleanWhether this key is defined as a contact field (with a label, type and default), or was only seen on contact data. Both can be used in content and segment rules.
labelstringDisplay name. Derived from the key for an undeclared one.
typestringtext | number | date | booleanHow a value should be EDITED and displayed. Not a storage type: every value in a contact's
fieldsobject is a string whatever this says, and nothing is coerced.requiredbooleanWhether every contact must have a value. Checked when a contact is created, and when an update would clear the value; existing contacts are not checked. A default value does not count. Always false for a key that is not defined.
default_valuestringSubstituted at send time for contacts with no value of their own. It is never written into a contact's
fields.help_textstringThe hint shown beside this field on a form.
nullMEANS NONE WAS WRITTEN — it carries no behaviour, so an absent hint changes nothing about what the field accepts.contacts_with_valueintegerHow many contacts carry a non-empty value for this key — the "is it safe to delete this" signal. Always an integer.
created_atstringnullwhendeclaredis false: an observed key has no definition row and therefore no creation time. Genuinely unknown, not zero.
Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
401 | The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist. |
403 | The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys. |
404 | No such resource in this organization. |
422 | The request was understood but the values were not acceptable. |
429 | Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait. |
Every status, with what causes it and what to do, is on the error reference.