Create a computed trait
curl --request POST \
--url https://api.orbit.devotel.io/api/v1/cdp/traits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "orders_last_30d",
"definition": {
"event_type": "Order Completed",
"agg": "count",
"window_days": 30
},
"schedule_minutes": 1440,
"status": "active"
}
'import requests
url = "https://api.orbit.devotel.io/api/v1/cdp/traits"
payload = {
"name": "orders_last_30d",
"definition": {
"event_type": "Order Completed",
"agg": "count",
"window_days": 30
},
"schedule_minutes": 1440,
"status": "active"
}
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: 'orders_last_30d',
definition: {event_type: 'Order Completed', agg: 'count', window_days: 30},
schedule_minutes: 1440,
status: 'active'
})
};
fetch('https://api.orbit.devotel.io/api/v1/cdp/traits', 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.orbit.devotel.io/api/v1/cdp/traits",
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' => 'orders_last_30d',
'definition' => [
'event_type' => 'Order Completed',
'agg' => 'count',
'window_days' => 30
],
'schedule_minutes' => 1440,
'status' => 'active'
]),
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.orbit.devotel.io/api/v1/cdp/traits"
payload := strings.NewReader("{\n \"name\": \"orders_last_30d\",\n \"definition\": {\n \"event_type\": \"Order Completed\",\n \"agg\": \"count\",\n \"window_days\": 30\n },\n \"schedule_minutes\": 1440,\n \"status\": \"active\"\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.orbit.devotel.io/api/v1/cdp/traits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"orders_last_30d\",\n \"definition\": {\n \"event_type\": \"Order Completed\",\n \"agg\": \"count\",\n \"window_days\": 30\n },\n \"schedule_minutes\": 1440,\n \"status\": \"active\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.orbit.devotel.io/api/v1/cdp/traits")
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\": \"orders_last_30d\",\n \"definition\": {\n \"event_type\": \"Order Completed\",\n \"agg\": \"count\",\n \"window_days\": 30\n },\n \"schedule_minutes\": 1440,\n \"status\": \"active\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"definition": {
"event_type": "<string>",
"agg": "count",
"window_days": 1825,
"agg_field": "<string>",
"predicate": {}
},
"schedule_minutes": 123,
"last_run_at": "2023-11-07T05:31:56Z",
"status": "active",
"last_error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"docs_url": "<string>"
}
}CDP
Create a computed trait
Create a computed trait from a declarative definition — an aggregate (count/sum/avg/max/min) over events named event_type within a window_days lookback, optionally filtered by a predicate. The scheduled evaluator recomputes it every schedule_minutes and writes the result onto each contact’s traits. Trait names must be lowercase identifiers and unique per tenant. Owner / admin / developer only.
POST
/
api
/
v1
/
cdp
/
traits
Create a computed trait
curl --request POST \
--url https://api.orbit.devotel.io/api/v1/cdp/traits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "orders_last_30d",
"definition": {
"event_type": "Order Completed",
"agg": "count",
"window_days": 30
},
"schedule_minutes": 1440,
"status": "active"
}
'import requests
url = "https://api.orbit.devotel.io/api/v1/cdp/traits"
payload = {
"name": "orders_last_30d",
"definition": {
"event_type": "Order Completed",
"agg": "count",
"window_days": 30
},
"schedule_minutes": 1440,
"status": "active"
}
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: 'orders_last_30d',
definition: {event_type: 'Order Completed', agg: 'count', window_days: 30},
schedule_minutes: 1440,
status: 'active'
})
};
fetch('https://api.orbit.devotel.io/api/v1/cdp/traits', 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.orbit.devotel.io/api/v1/cdp/traits",
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' => 'orders_last_30d',
'definition' => [
'event_type' => 'Order Completed',
'agg' => 'count',
'window_days' => 30
],
'schedule_minutes' => 1440,
'status' => 'active'
]),
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.orbit.devotel.io/api/v1/cdp/traits"
payload := strings.NewReader("{\n \"name\": \"orders_last_30d\",\n \"definition\": {\n \"event_type\": \"Order Completed\",\n \"agg\": \"count\",\n \"window_days\": 30\n },\n \"schedule_minutes\": 1440,\n \"status\": \"active\"\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.orbit.devotel.io/api/v1/cdp/traits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"orders_last_30d\",\n \"definition\": {\n \"event_type\": \"Order Completed\",\n \"agg\": \"count\",\n \"window_days\": 30\n },\n \"schedule_minutes\": 1440,\n \"status\": \"active\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.orbit.devotel.io/api/v1/cdp/traits")
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\": \"orders_last_30d\",\n \"definition\": {\n \"event_type\": \"Order Completed\",\n \"agg\": \"count\",\n \"window_days\": 30\n },\n \"schedule_minutes\": 1440,\n \"status\": \"active\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"definition": {
"event_type": "<string>",
"agg": "count",
"window_days": 1825,
"agg_field": "<string>",
"predicate": {}
},
"schedule_minutes": 123,
"last_run_at": "2023-11-07T05:31:56Z",
"status": "active",
"last_error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"docs_url": "<string>"
}
}Authorizations
BearerApiKey
Dashboard JWT token from Clerk
Body
application/json
Lowercase identifier the value is written under (e.g. orders_last_30d).
The computed-trait DSL: an aggregate (agg) over events named event_type within a window_days lookback, optionally narrowed by an equality predicate map over event properties.
Show child attributes
Show child attributes
Recompute cadence in minutes; defaults to 1440 (daily).
Required range:
1 <= x <= 525600Available options:
active, paused ⌘I