Create an object
curl --request POST \
--url https://api.attio.com/v2/objects \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"api_slug": "people",
"singular_noun": "Person",
"plural_noun": "People"
}
}
'import requests
url = "https://api.attio.com/v2/objects"
payload = { "data": {
"api_slug": "people",
"singular_noun": "Person",
"plural_noun": "People"
} }
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: {api_slug: 'people', singular_noun: 'Person', plural_noun: 'People'}})
};
fetch('https://api.attio.com/v2/objects', 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/objects",
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' => [
'api_slug' => 'people',
'singular_noun' => 'Person',
'plural_noun' => 'People'
]
]),
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/objects"
payload := strings.NewReader("{\n \"data\": {\n \"api_slug\": \"people\",\n \"singular_noun\": \"Person\",\n \"plural_noun\": \"People\"\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/objects")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"api_slug\": \"people\",\n \"singular_noun\": \"Person\",\n \"plural_noun\": \"People\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/objects")
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 \"api_slug\": \"people\",\n \"singular_noun\": \"Person\",\n \"plural_noun\": \"People\"\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"
},
"api_slug": "people",
"singular_noun": "Person",
"plural_noun": "People",
"created_at": "2022-11-21T13:22:49.061281000Z"
}
}{
"status_code": 400,
"type": "invalid_request_error",
"code": "quota_exceeded",
"message": "You have met your plan's object limit. Please upgrade your plan to create more objects."
}{
"status_code": 409,
"type": "invalid_request_error",
"code": "slug_conflict",
"message": "Failed to create object. Please ensure your api_slug and names are unique."
}Objects
Create an object
Creates a new custom object in your workspace.
Required scopes: object_configuration:read-write.
POST
/
v2
/
objects
Create an object
curl --request POST \
--url https://api.attio.com/v2/objects \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"api_slug": "people",
"singular_noun": "Person",
"plural_noun": "People"
}
}
'import requests
url = "https://api.attio.com/v2/objects"
payload = { "data": {
"api_slug": "people",
"singular_noun": "Person",
"plural_noun": "People"
} }
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: {api_slug: 'people', singular_noun: 'Person', plural_noun: 'People'}})
};
fetch('https://api.attio.com/v2/objects', 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/objects",
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' => [
'api_slug' => 'people',
'singular_noun' => 'Person',
'plural_noun' => 'People'
]
]),
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/objects"
payload := strings.NewReader("{\n \"data\": {\n \"api_slug\": \"people\",\n \"singular_noun\": \"Person\",\n \"plural_noun\": \"People\"\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/objects")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"api_slug\": \"people\",\n \"singular_noun\": \"Person\",\n \"plural_noun\": \"People\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/objects")
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 \"api_slug\": \"people\",\n \"singular_noun\": \"Person\",\n \"plural_noun\": \"People\"\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"
},
"api_slug": "people",
"singular_noun": "Person",
"plural_noun": "People",
"created_at": "2022-11-21T13:22:49.061281000Z"
}
}{
"status_code": 400,
"type": "invalid_request_error",
"code": "quota_exceeded",
"message": "You have met your plan's object limit. Please upgrade your plan to create more objects."
}{
"status_code": 409,
"type": "invalid_request_error",
"code": "slug_conflict",
"message": "Failed to create object. Please ensure your api_slug and names are unique."
}Was this page helpful?
⌘I