curl --request POST \
--url https://api.attio.com/v2/{target}/{identifier}/attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"title": "Your Attribute",
"description": "Lorem ipsum",
"api_slug": "my-attribute",
"type": "text",
"is_required": true,
"is_unique": true,
"is_multiselect": true,
"config": {},
"default_value": {
"type": "static",
"template": [
{
"value": 5
}
]
},
"relationship": {
"object": "companies",
"title": "Team members",
"api_slug": "team_members",
"is_multiselect": false
}
}
}
'import requests
url = "https://api.attio.com/v2/{target}/{identifier}/attributes"
payload = { "data": {
"title": "Your Attribute",
"description": "Lorem ipsum",
"api_slug": "my-attribute",
"type": "text",
"is_required": True,
"is_unique": True,
"is_multiselect": True,
"config": {},
"default_value": {
"type": "static",
"template": [{ "value": 5 }]
},
"relationship": {
"object": "companies",
"title": "Team members",
"api_slug": "team_members",
"is_multiselect": False
}
} }
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({
data: {
title: 'Your Attribute',
description: 'Lorem ipsum',
api_slug: 'my-attribute',
type: 'text',
is_required: true,
is_unique: true,
is_multiselect: true,
config: {},
default_value: {type: 'static', template: [{value: 5}]},
relationship: {
object: 'companies',
title: 'Team members',
api_slug: 'team_members',
is_multiselect: false
}
}
})
};
fetch('https://api.attio.com/v2/{target}/{identifier}/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.attio.com/v2/{target}/{identifier}/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([
'data' => [
'title' => 'Your Attribute',
'description' => 'Lorem ipsum',
'api_slug' => 'my-attribute',
'type' => 'text',
'is_required' => true,
'is_unique' => true,
'is_multiselect' => true,
'config' => [
],
'default_value' => [
'type' => 'static',
'template' => [
[
'value' => 5
]
]
],
'relationship' => [
'object' => 'companies',
'title' => 'Team members',
'api_slug' => 'team_members',
'is_multiselect' => false
]
]
]),
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.attio.com/v2/{target}/{identifier}/attributes"
payload := strings.NewReader("{\n \"data\": {\n \"title\": \"Your Attribute\",\n \"description\": \"Lorem ipsum\",\n \"api_slug\": \"my-attribute\",\n \"type\": \"text\",\n \"is_required\": true,\n \"is_unique\": true,\n \"is_multiselect\": true,\n \"config\": {},\n \"default_value\": {\n \"type\": \"static\",\n \"template\": [\n {\n \"value\": 5\n }\n ]\n },\n \"relationship\": {\n \"object\": \"companies\",\n \"title\": \"Team members\",\n \"api_slug\": \"team_members\",\n \"is_multiselect\": false\n }\n }\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.attio.com/v2/{target}/{identifier}/attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"title\": \"Your Attribute\",\n \"description\": \"Lorem ipsum\",\n \"api_slug\": \"my-attribute\",\n \"type\": \"text\",\n \"is_required\": true,\n \"is_unique\": true,\n \"is_multiselect\": true,\n \"config\": {},\n \"default_value\": {\n \"type\": \"static\",\n \"template\": [\n {\n \"value\": 5\n }\n ]\n },\n \"relationship\": {\n \"object\": \"companies\",\n \"title\": \"Team members\",\n \"api_slug\": \"team_members\",\n \"is_multiselect\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/{target}/{identifier}/attributes")
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 \"data\": {\n \"title\": \"Your Attribute\",\n \"description\": \"Lorem ipsum\",\n \"api_slug\": \"my-attribute\",\n \"type\": \"text\",\n \"is_required\": true,\n \"is_unique\": true,\n \"is_multiselect\": true,\n \"config\": {},\n \"default_value\": {\n \"type\": \"static\",\n \"template\": [\n {\n \"value\": 5\n }\n ]\n },\n \"relationship\": {\n \"object\": \"companies\",\n \"title\": \"Team members\",\n \"api_slug\": \"team_members\",\n \"is_multiselect\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"attribute_id": "41252299-f8c7-4b5e-99c9-4ff8321d2f96"
},
"title": "Company",
"description": "A company attribute",
"api_slug": "company",
"type": "record-reference",
"is_system_attribute": false,
"is_writable": true,
"is_required": false,
"is_unique": false,
"is_multiselect": false,
"is_default_value_enabled": false,
"is_archived": false,
"default_value": null,
"relationship": {
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"attribute_id": "41252299-f8c7-4b5e-99c9-4ff8321d2f96"
},
"object_slug": "companies",
"title": "Team members",
"api_slug": "team_members",
"is_multiselect": true
},
"created_at": "2021-11-21T13:22:49.061Z",
"config": {
"currency": {
"default_currency_code": null,
"display_type": null
},
"record_reference": {
"allowed_object_ids": [
"companies"
]
}
}
}
}{
"status_code": 400,
"type": "invalid_request_error",
"code": "validation_type",
"message": "Could not find an object with slug \"people\" for default value."
}{
"status_code": 404,
"type": "invalid_request_error",
"code": "not_found",
"message": "List with slug/ID \"33ebdbe9-e529-47c9-b894-0ba25e9c15c0\" not found."
}{
"status_code": 409,
"type": "invalid_request_error",
"code": "slug_conflict",
"message": "An attribute with the same API slug already exists on this list. Please choose a different API slug."
}Create an attribute
Creates a new attribute on either an object or a list.
For record-reference attributes, you can optionally create a bidirectional relationship by providing a relationship object. This will create two entangled attributes: one on the specified object and a reverse attribute on the related object.
To create an attribute on an object, you must also have the object_configuration:read-write scope.
To create an attribute on a list, you must also have the list_configuration:read-write scope.
curl --request POST \
--url https://api.attio.com/v2/{target}/{identifier}/attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"title": "Your Attribute",
"description": "Lorem ipsum",
"api_slug": "my-attribute",
"type": "text",
"is_required": true,
"is_unique": true,
"is_multiselect": true,
"config": {},
"default_value": {
"type": "static",
"template": [
{
"value": 5
}
]
},
"relationship": {
"object": "companies",
"title": "Team members",
"api_slug": "team_members",
"is_multiselect": false
}
}
}
'import requests
url = "https://api.attio.com/v2/{target}/{identifier}/attributes"
payload = { "data": {
"title": "Your Attribute",
"description": "Lorem ipsum",
"api_slug": "my-attribute",
"type": "text",
"is_required": True,
"is_unique": True,
"is_multiselect": True,
"config": {},
"default_value": {
"type": "static",
"template": [{ "value": 5 }]
},
"relationship": {
"object": "companies",
"title": "Team members",
"api_slug": "team_members",
"is_multiselect": False
}
} }
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({
data: {
title: 'Your Attribute',
description: 'Lorem ipsum',
api_slug: 'my-attribute',
type: 'text',
is_required: true,
is_unique: true,
is_multiselect: true,
config: {},
default_value: {type: 'static', template: [{value: 5}]},
relationship: {
object: 'companies',
title: 'Team members',
api_slug: 'team_members',
is_multiselect: false
}
}
})
};
fetch('https://api.attio.com/v2/{target}/{identifier}/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.attio.com/v2/{target}/{identifier}/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([
'data' => [
'title' => 'Your Attribute',
'description' => 'Lorem ipsum',
'api_slug' => 'my-attribute',
'type' => 'text',
'is_required' => true,
'is_unique' => true,
'is_multiselect' => true,
'config' => [
],
'default_value' => [
'type' => 'static',
'template' => [
[
'value' => 5
]
]
],
'relationship' => [
'object' => 'companies',
'title' => 'Team members',
'api_slug' => 'team_members',
'is_multiselect' => false
]
]
]),
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.attio.com/v2/{target}/{identifier}/attributes"
payload := strings.NewReader("{\n \"data\": {\n \"title\": \"Your Attribute\",\n \"description\": \"Lorem ipsum\",\n \"api_slug\": \"my-attribute\",\n \"type\": \"text\",\n \"is_required\": true,\n \"is_unique\": true,\n \"is_multiselect\": true,\n \"config\": {},\n \"default_value\": {\n \"type\": \"static\",\n \"template\": [\n {\n \"value\": 5\n }\n ]\n },\n \"relationship\": {\n \"object\": \"companies\",\n \"title\": \"Team members\",\n \"api_slug\": \"team_members\",\n \"is_multiselect\": false\n }\n }\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.attio.com/v2/{target}/{identifier}/attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"title\": \"Your Attribute\",\n \"description\": \"Lorem ipsum\",\n \"api_slug\": \"my-attribute\",\n \"type\": \"text\",\n \"is_required\": true,\n \"is_unique\": true,\n \"is_multiselect\": true,\n \"config\": {},\n \"default_value\": {\n \"type\": \"static\",\n \"template\": [\n {\n \"value\": 5\n }\n ]\n },\n \"relationship\": {\n \"object\": \"companies\",\n \"title\": \"Team members\",\n \"api_slug\": \"team_members\",\n \"is_multiselect\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/{target}/{identifier}/attributes")
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 \"data\": {\n \"title\": \"Your Attribute\",\n \"description\": \"Lorem ipsum\",\n \"api_slug\": \"my-attribute\",\n \"type\": \"text\",\n \"is_required\": true,\n \"is_unique\": true,\n \"is_multiselect\": true,\n \"config\": {},\n \"default_value\": {\n \"type\": \"static\",\n \"template\": [\n {\n \"value\": 5\n }\n ]\n },\n \"relationship\": {\n \"object\": \"companies\",\n \"title\": \"Team members\",\n \"api_slug\": \"team_members\",\n \"is_multiselect\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"attribute_id": "41252299-f8c7-4b5e-99c9-4ff8321d2f96"
},
"title": "Company",
"description": "A company attribute",
"api_slug": "company",
"type": "record-reference",
"is_system_attribute": false,
"is_writable": true,
"is_required": false,
"is_unique": false,
"is_multiselect": false,
"is_default_value_enabled": false,
"is_archived": false,
"default_value": null,
"relationship": {
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"attribute_id": "41252299-f8c7-4b5e-99c9-4ff8321d2f96"
},
"object_slug": "companies",
"title": "Team members",
"api_slug": "team_members",
"is_multiselect": true
},
"created_at": "2021-11-21T13:22:49.061Z",
"config": {
"currency": {
"default_currency_code": null,
"display_type": null
},
"record_reference": {
"allowed_object_ids": [
"companies"
]
}
}
}
}{
"status_code": 400,
"type": "invalid_request_error",
"code": "validation_type",
"message": "Could not find an object with slug \"people\" for default value."
}{
"status_code": 404,
"type": "invalid_request_error",
"code": "not_found",
"message": "List with slug/ID \"33ebdbe9-e529-47c9-b894-0ba25e9c15c0\" not found."
}{
"status_code": 409,
"type": "invalid_request_error",
"code": "slug_conflict",
"message": "An attribute with the same API slug already exists on this list. Please choose a different API slug."
}Authorizations
This API uses OAuth 2.0 with the authorization code grant flow.
Path Parameters
Whether the attribute is to be created on an object or a list.
objects, lists "lists"
A UUID or slug to identify the object or list the attribute belongs to.
"97052eb9-e65e-443f-a297-f2d9a4a7f795"
Body
Show child attributes
Show child attributes
Response
Success
Success
Show child attributes
Show child attributes
{
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"attribute_id": "41252299-f8c7-4b5e-99c9-4ff8321d2f96"
},
"title": "Company",
"description": "A company attribute",
"api_slug": "company",
"type": "record-reference",
"is_system_attribute": false,
"is_writable": true,
"is_required": false,
"is_unique": false,
"is_multiselect": false,
"is_default_value_enabled": false,
"is_archived": false,
"default_value": null,
"relationship": {
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"attribute_id": "41252299-f8c7-4b5e-99c9-4ff8321d2f96"
},
"object_slug": "companies",
"title": "Team members",
"api_slug": "team_members",
"is_multiselect": true
},
"created_at": "2021-11-21T13:22:49.061Z",
"config": {
"currency": {
"default_currency_code": null,
"display_type": null
},
"record_reference": { "allowed_object_ids": ["companies"] }
}
}
Was this page helpful?