curl --request POST \
--url https://api.affinity.co/v2/companies/fields/{fieldId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Investment Thesis",
"isRequired": true
}
'import requests
url = "https://api.affinity.co/v2/companies/fields/{fieldId}"
payload = {
"name": "Investment Thesis",
"isRequired": True
}
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({name: 'Investment Thesis', isRequired: true})
};
fetch('https://api.affinity.co/v2/companies/fields/{fieldId}', 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.affinity.co/v2/companies/fields/{fieldId}",
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([
'name' => 'Investment Thesis',
'isRequired' => true
]),
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://api.affinity.co/v2/companies/fields/{fieldId}"
payload := strings.NewReader("{\n \"name\": \"Investment Thesis\",\n \"isRequired\": true\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://api.affinity.co/v2/companies/fields/{fieldId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Investment Thesis\",\n \"isRequired\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/companies/fields/{fieldId}")
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 \"name\": \"Investment Thesis\",\n \"isRequired\": true\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Update a Company Field
| ⚠️ This endpoint is currently in BETA |
|---|
Updates a Company Field. Only the provided properties are updated.
Requires the Manage global fields permission. Accepts the Field ID of a custom field (field-<number>), of an enriched field (for example, affinity-data-location), or of a native field (for example, source-of-introduction). An enriched or native field by its field-<number> ID returns 404. A field from a restricted data partner (see Partner Data Restrictions) returns 404. On native and enriched fields, only isRequired can be updated. Fields that are computed by Affinity, such as first-email, return 404.
curl --request POST \
--url https://api.affinity.co/v2/companies/fields/{fieldId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Investment Thesis",
"isRequired": true
}
'import requests
url = "https://api.affinity.co/v2/companies/fields/{fieldId}"
payload = {
"name": "Investment Thesis",
"isRequired": True
}
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({name: 'Investment Thesis', isRequired: true})
};
fetch('https://api.affinity.co/v2/companies/fields/{fieldId}', 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.affinity.co/v2/companies/fields/{fieldId}",
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([
'name' => 'Investment Thesis',
'isRequired' => true
]),
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://api.affinity.co/v2/companies/fields/{fieldId}"
payload := strings.NewReader("{\n \"name\": \"Investment Thesis\",\n \"isRequired\": true\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://api.affinity.co/v2/companies/fields/{fieldId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Investment Thesis\",\n \"isRequired\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/companies/fields/{fieldId}")
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 \"name\": \"Investment Thesis\",\n \"isRequired\": true\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
A static Affinity API key, presented as a bearer token.
Path Parameters
Field ID
"field-1234"
Body
The properties that can be updated on a Field. Only provided properties are updated.
The field's new name. Must be unique among the fields of the same entity type that are available in the same context.
1 - 255"Sourced By"
A description of the field's purpose. Pass null to clear an existing description.
255"Where this company is headquartered"
Whether a value for this field is required when creating an entity or List Entry.
true
Response
No Content
Was this page helpful?