Create custom contact field
curl --request POST \
--url https://api.withallo.com/v2/api/crm/attributes \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "Lead Source",
"type": "TEXT"
}
'import requests
url = "https://api.withallo.com/v2/api/crm/attributes"
payload = {
"label": "Lead Source",
"type": "TEXT"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({label: 'Lead Source', type: 'TEXT'})
};
fetch('https://api.withallo.com/v2/api/crm/attributes', 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.withallo.com/v2/api/crm/attributes",
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([
'label' => 'Lead Source',
'type' => 'TEXT'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.withallo.com/v2/api/crm/attributes"
payload := strings.NewReader("{\n \"label\": \"Lead Source\",\n \"type\": \"TEXT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://api.withallo.com/v2/api/crm/attributes")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"Lead Source\",\n \"type\": \"TEXT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withallo.com/v2/api/crm/attributes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"Lead Source\",\n \"type\": \"TEXT\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "lead_source",
"label": "Lead Source",
"type": "TEXT",
"already_existed": false
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}Champs personnalisés
Créer un champ personnalisé
Creates a custom field on your team’s people. The key is derived from the label. Creating the same label with the same type again returns the existing field with already_existed set to true.
POST
/
v2
/
api
/
crm
/
attributes
Create custom contact field
curl --request POST \
--url https://api.withallo.com/v2/api/crm/attributes \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "Lead Source",
"type": "TEXT"
}
'import requests
url = "https://api.withallo.com/v2/api/crm/attributes"
payload = {
"label": "Lead Source",
"type": "TEXT"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({label: 'Lead Source', type: 'TEXT'})
};
fetch('https://api.withallo.com/v2/api/crm/attributes', 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.withallo.com/v2/api/crm/attributes",
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([
'label' => 'Lead Source',
'type' => 'TEXT'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.withallo.com/v2/api/crm/attributes"
payload := strings.NewReader("{\n \"label\": \"Lead Source\",\n \"type\": \"TEXT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://api.withallo.com/v2/api/crm/attributes")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"Lead Source\",\n \"type\": \"TEXT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withallo.com/v2/api/crm/attributes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"Lead Source\",\n \"type\": \"TEXT\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "lead_source",
"label": "Lead Source",
"type": "TEXT",
"already_existed": false
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}Scope requis :
CRM_WRITEChamps du body
| Champ | Type | Requis | Description |
|---|---|---|---|
label | string | oui | Nom affiché, de 1 à 255 caractères, avec au moins une lettre ou un chiffre |
type | string | oui | TEXT, NUMBER, DATE ou BOOLEAN |
DROPDOWN sont synchronisés depuis vos intégrations CRM et ne peuvent pas être créés ici.
Dérivation de la clé
Lakey est dérivée du label : minuscules, accents supprimés, séquences de caractères non alphanumériques remplacées par _, tronquée à 64 caractères. Lead Source devient lead_source.
Un label qui correspond à la clé d’un champ natif est rejeté avec ATTRIBUTE_KEY_RESERVED. Les clés réservées sont name, phone_numbers, company, job_title, emails, last_activity, website, created_at et updated_at.
Créer deux fois le même champ
L’appel peut être répété sans risque. Si un champ avec la même clé et le même type existe déjà, l’endpoint renvoie201 avec already_existed à true et le label avec lequel il a été créé. Rien n’est créé.
{
"data": {
"key": "lead_source",
"label": "Lead Source",
"type": "TEXT",
"already_existed": true
}
}
409 ATTRIBUTE_KEY_CONFLICT.
Limites
Une équipe peut avoir jusqu’à 150 champs personnalisésTEXT, 50 NUMBER, 30 DATE et 30 BOOLEAN. Lorsqu’un type est plein, créer un autre champ de ce type renvoie 409 ATTRIBUTE_SLOTS_EXHAUSTED.
Erreurs
| Statut | Code | Quand |
|---|---|---|
400 | ATTRIBUTE_LABEL_INVALID | label est vide, dépasse 255 caractères ou ne contient ni lettre ni chiffre |
400 | ATTRIBUTE_KEY_RESERVED | Le label correspond à la clé d’un champ natif |
400 | INVALID_REQUEST_BODY | type est absent ou n’est pas l’un de TEXT, NUMBER, DATE, BOOLEAN |
403 | API_KEY_INSUFFICIENT_SCOPE | La clé n’a pas le scope CRM_WRITE |
404 | TEAM_NOT_FOUND | L’espace de travail n’utilise pas le nouveau modèle de contacts |
409 | ATTRIBUTE_KEY_CONFLICT | Un champ avec cette clé existe déjà avec un autre type |
409 | ATTRIBUTE_SLOTS_EXHAUSTED | Aucun emplacement libre pour ce type |
Autorisations
Corps
application/json
Request body for creating a custom contact field
Display name of the field. The key is derived from it: lowercase, accents removed, runs of non-alphanumeric characters replaced by _, truncated to 64 characters. Must contain at least one letter or digit and must not resolve to a built-in field key such as name, company or website.
Required string length:
1 - 255Exemple:
"Lead Source"
Value type of the field
Options disponibles:
TEXT, NUMBER, DATE, BOOLEAN Exemple:
"TEXT"
Réponse
The custom field that was created, or the existing one
Show child attributes
Show child attributes
Cette page vous a-t-elle été utile ?