Create a custom field
curl --request POST \
--url https://app.alvahq.com/api/v1/custom-fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityType": "company",
"label": "Account Tier",
"fieldType": "select",
"options": [
"Bronze",
"Silver",
"Gold"
],
"required": false,
"helpText": ""
}
'import requests
url = "https://app.alvahq.com/api/v1/custom-fields"
payload = {
"entityType": "company",
"label": "Account Tier",
"fieldType": "select",
"options": ["Bronze", "Silver", "Gold"],
"required": False,
"helpText": ""
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entityType: 'company',
label: 'Account Tier',
fieldType: 'select',
options: ['Bronze', 'Silver', 'Gold'],
required: false,
helpText: ''
})
};
fetch('https://app.alvahq.com/api/v1/custom-fields', 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.alvahq.com/api/v1/custom-fields",
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([
'entityType' => 'company',
'label' => 'Account Tier',
'fieldType' => 'select',
'options' => [
'Bronze',
'Silver',
'Gold'
],
'required' => false,
'helpText' => ''
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.alvahq.com/api/v1/custom-fields"
payload := strings.NewReader("{\n \"entityType\": \"company\",\n \"label\": \"Account Tier\",\n \"fieldType\": \"select\",\n \"options\": [\n \"Bronze\",\n \"Silver\",\n \"Gold\"\n ],\n \"required\": false,\n \"helpText\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.alvahq.com/api/v1/custom-fields")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityType\": \"company\",\n \"label\": \"Account Tier\",\n \"fieldType\": \"select\",\n \"options\": [\n \"Bronze\",\n \"Silver\",\n \"Gold\"\n ],\n \"required\": false,\n \"helpText\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.alvahq.com/api/v1/custom-fields")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entityType\": \"company\",\n \"label\": \"Account Tier\",\n \"fieldType\": \"select\",\n \"options\": [\n \"Bronze\",\n \"Silver\",\n \"Gold\"\n ],\n \"required\": false,\n \"helpText\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entityType": "company",
"key": "account_tier",
"label": "Account Tier",
"fieldType": "text",
"options": [
"<string>"
],
"required": true,
"defaultValue": "<unknown>",
"helpText": "<string>",
"sortOrder": 123,
"isArchived": true
},
"resource": "<string>"
}{
"error": "Unauthorised",
"message": "Invalid or revoked API key"
}{
"error": "Unprocessable Entity",
"message": "Validation failed",
"details": {
"name": [
"Name is required"
]
}
}Custom Fields
Create a custom field
Define a new custom field on companies or contacts. The key is auto-derived from the label when omitted and is immutable afterwards.
POST
/
api
/
v1
/
custom-fields
Create a custom field
curl --request POST \
--url https://app.alvahq.com/api/v1/custom-fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityType": "company",
"label": "Account Tier",
"fieldType": "select",
"options": [
"Bronze",
"Silver",
"Gold"
],
"required": false,
"helpText": ""
}
'import requests
url = "https://app.alvahq.com/api/v1/custom-fields"
payload = {
"entityType": "company",
"label": "Account Tier",
"fieldType": "select",
"options": ["Bronze", "Silver", "Gold"],
"required": False,
"helpText": ""
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entityType: 'company',
label: 'Account Tier',
fieldType: 'select',
options: ['Bronze', 'Silver', 'Gold'],
required: false,
helpText: ''
})
};
fetch('https://app.alvahq.com/api/v1/custom-fields', 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.alvahq.com/api/v1/custom-fields",
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([
'entityType' => 'company',
'label' => 'Account Tier',
'fieldType' => 'select',
'options' => [
'Bronze',
'Silver',
'Gold'
],
'required' => false,
'helpText' => ''
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.alvahq.com/api/v1/custom-fields"
payload := strings.NewReader("{\n \"entityType\": \"company\",\n \"label\": \"Account Tier\",\n \"fieldType\": \"select\",\n \"options\": [\n \"Bronze\",\n \"Silver\",\n \"Gold\"\n ],\n \"required\": false,\n \"helpText\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.alvahq.com/api/v1/custom-fields")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityType\": \"company\",\n \"label\": \"Account Tier\",\n \"fieldType\": \"select\",\n \"options\": [\n \"Bronze\",\n \"Silver\",\n \"Gold\"\n ],\n \"required\": false,\n \"helpText\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.alvahq.com/api/v1/custom-fields")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entityType\": \"company\",\n \"label\": \"Account Tier\",\n \"fieldType\": \"select\",\n \"options\": [\n \"Bronze\",\n \"Silver\",\n \"Gold\"\n ],\n \"required\": false,\n \"helpText\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entityType": "company",
"key": "account_tier",
"label": "Account Tier",
"fieldType": "text",
"options": [
"<string>"
],
"required": true,
"defaultValue": "<unknown>",
"helpText": "<string>",
"sortOrder": 123,
"isArchived": true
},
"resource": "<string>"
}{
"error": "Unauthorised",
"message": "Invalid or revoked API key"
}{
"error": "Unprocessable Entity",
"message": "Validation failed",
"details": {
"name": [
"Name is required"
]
}
}Authorizations
API key from Settings > Developer. Format: alva_sk_...
Body
application/json
Available options:
company, contact Available options:
text, textarea, number, boolean, date, datetime, select, multi_select, url, email, phone, currency Optional. Auto-derived from label when omitted; immutable afterwards.
Required for select / multi_select