List Custom Field Keys
curl --request GET \
--url https://app.tuco.ai/api/leads/custom-field-keys \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.tuco.ai/api/leads/custom-field-keys"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.tuco.ai/api/leads/custom-field-keys', 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://app.tuco.ai/api/leads/custom-field-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.tuco.ai/api/leads/custom-field-keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.tuco.ai/api/leads/custom-field-keys")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/leads/custom-field-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"keys": [
{
"name": "<string>",
"count": 123
}
]
}Lines & Leads
List Custom Field Keys
Discover the customFields keys actually in use on your Tuco leads, so you can write the right ones in PATCH /api/leads/ and in campaign variables.
GET
/
api
/
leads
/
custom-field-keys
List Custom Field Keys
curl --request GET \
--url https://app.tuco.ai/api/leads/custom-field-keys \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.tuco.ai/api/leads/custom-field-keys"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.tuco.ai/api/leads/custom-field-keys', 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://app.tuco.ai/api/leads/custom-field-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.tuco.ai/api/leads/custom-field-keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.tuco.ai/api/leads/custom-field-keys")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/leads/custom-field-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"keys": [
{
"name": "<string>",
"count": 123
}
]
}customFields is free-form, so nothing tells you which keys a workspace already uses. This returns
the ones in use with a count, so you can write the right key in
PATCH /api/leads/{id} instead of guessing and creating a
near-duplicate.Authentication
Pass your workspace API key as a Bearer token, or use a Clerk session token.Authorization: Bearer tuco_xxxxxxxxxxxxx
Example
curl "https://app.tuco.ai/api/leads/custom-field-keys" \
-H "Authorization: Bearer tuco_xxxxxxxxxxxxx"
Success (200 OK)
{
"keys": [
{ "name": "Industry", "count": 6 },
{ "name": "Contract Value", "count": 3 },
{ "name": "close_owner_id", "count": 8 }
]
}
This is a sample, not an exhaustive index. The scan is bounded to keep it cheap on large
workspaces: at most 2,000 lead documents are inspected and at most 200 keys returned. A rarely-used
key may be missing from the list — and it still works.
customFields accepts any key, and
{cf:Anything} resolves at send time whether or not it appears here.Response
object[]
On an internal error this endpoint returns
200 with { "keys": [] } rather than failing — it is
a discovery aid, and an empty list must not break a page that calls it.Errors
| Status | When | Body |
|---|---|---|
400 | Key has no active workspace | { "error": "No active workspace" } |
401 | Missing or invalid API key | { "error": "Unauthorized" } |