Contacts: Custom fields
Define Field
Create a custom field, or rename it and change its options. Every field is indexed on its own, so you can filter and sort by it right away.
https://g.sendcorex.com/v1/contactscommand: define_fieldNeeds the contact:create scope on your API key.
Calling it again with the same key and type updates the name and options. The type never changes: trying fails with TYPE_LOCKED. To change it, delete the field and create it again.
Arguments
keystringrequireda-z,0-9and_, starting with a letter, up to 40 characters.e.g.
"plan"typestringrequiredtext,number,date,bool,enumormulti_enum.e.g.
"enum"namestringoptionalDisplay name. Defaults to the key.
e.g.
"Plan"optionsstring[]optionalRequired for
enumandmulti_enum: the allowed values.e.g.
["free", "pro", "business"]
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1/contacts',
{
commands: [
{
command: "define_field",
args: {
key: "plan",
name: "Plan",
type: "enum",
options: [
"free",
"pro",
"business"
]
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);Response
{
"type": "SUCCESS",
"results": [
{
"command": "define_field",
"id": "0",
"type": "SUCCESS",
"took_ms": 14,
"data": {
"key": "plan",
"name": "Plan",
"type": "enum",
"options": [
"free",
"pro",
"business"
],
"created_at": "2026-10-01T10:00:00.000Z",
"updated_at": "2026-10-01T10:00:00.000Z"
}
}
]
}Response fields
(field)The field as stored:
key,name,type,options,created_at,updated_at.
Types
textUp to 2,000 characters. Filter by equal (ignoring case and accents),
containsorexists.numberIntegers or decimals, negatives included.
"1234,5"is read as 1234.5. Ranges and sorting.dateYYYY-MM-DDor ISO. Ranges and sorting.booltrueorfalse."yes","sim"and"1"are read as true.enumOne of
options."PRO"is stored as"pro". A value outside the options fails the item.multi_enumAny number of
options, as a list or as"tech, golf". Cannot be used to sort.
Set up all your fields at once
Request body
{
"commands": [
{
"command": "define_field",
"args": {
"key": "plan",
"name": "Plan",
"type": "enum",
"options": [
"free",
"pro",
"business"
]
}
},
{
"command": "define_field",
"args": {
"key": "age",
"name": "Age",
"type": "number"
}
},
{
"command": "define_field",
"args": {
"key": "city",
"name": "City",
"type": "text"
}
},
{
"command": "define_field",
"args": {
"key": "birthday",
"name": "Birthday",
"type": "date"
}
},
{
"command": "define_field",
"args": {
"key": "interests",
"name": "Interests",
"type": "multi_enum",
"options": [
"golf",
"tech",
"travel"
]
}
},
{
"command": "define_field",
"args": {
"key": "vip",
"name": "VIP",
"type": "bool"
}
}
]
}An account can have up to 100 fields. Past that, define_field fails with LIMIT_REACHED.
Errors
HTTP-level errors return type, code and message. Errors marked CMD come back inside the command result, with HTTP 200.
- 401
INVALID_API_KEYThe API key does not exist, was revoked or was disabled in the dashboard.
- 429
RATE_LIMITEDMore than 15 requests/s or 15 in flight for the same IP + API key. Wait the number of seconds in Retry-After.
- CMD
MISSING_SCOPEThe API key does not have the scope this command needs. The other commands in the request still run.
- CMD
INVALID_ARGSA required argument is missing or invalid: email, field value, enum option, where key, list id…
- CMD
TYPE_LOCKEDdefine_field tried to change the type of an existing field. Delete it and create it again.
- CMD
LIMIT_REACHEDThe account already has 100 custom fields.
- CMD
INTERNALServer error. The detail is only written to the server log.