Segment data model

Updated:

View field support, webhooks, and list parameters for each integration on the Supported Integrations page.

FieldTypeRequiredDescription
idstringNoUnique identifier for this segment object
created_atstring (date-time)NoThe date that this segment object was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
updated_atstring (date-time)NoThe last date that this segment object was updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
namestringNoThe name of the segment/audience
slugstringNoThe data-plane handle/key used to identify segment membership in profiles and destinations
descriptionstringNoThe description of the segment/audience
definitionstringNoThe membership rule/query that defines the segment
typeenumNoThe type of entity the segment targets (USERS, ACCOUNTS, LINKED) Values: USERS, ACCOUNTS, LINKED
compute_modeenumNoHow the segment membership is computed (REALTIME or BATCH) Values: REALTIME, BATCH
sizenumberNoThe number of profiles currently in the segment
is_activebooleanNoWhether the segment is active/enabled
source_idstringNoThe cdp_source this segment originated from; points to CdpSource
metadataCdpMetadata[]No
metadata[].idstringNo
metadata[].slugstringNoThe attribute/trait key (eg. lifetime_value)
metadata[].valueobjectNoThe attribute/trait value
metadata[].namespacestringNoThe scope or origin of the attribute (eg. computed, event, visitor)
metadata[].formatenumNoThe data type of the attribute value Values: TEXT, NUMBER, DATE, BOOLEAN, ARRAY, OBJECT
metadata[].extra_dataobjectNo

TypeScript

TypeScript
export type CdpSegment = {
	id?: string; // Unique identifier for this segment object
	created_at?: string-time; // The date that this segment object was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	updated_at?: string-time; // The last date that this segment object was updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	name?: string; // The name of the segment/audience
	slug?: string; // The data-plane handle/key used to identify segment membership in profiles and destinations
	description?: string; // The description of the segment/audience
	definition?: string; // The membership rule/query that defines the segment
	type?: 'USERS' | 'ACCOUNTS' | 'LINKED'; // The type of entity the segment targets (USERS, ACCOUNTS, LINKED)
	compute_mode?: 'REALTIME' | 'BATCH'; // How the segment membership is computed (REALTIME or BATCH)
	size?: number; // The number of profiles currently in the segment
	is_active?: boolean; // Whether the segment is active/enabled
	source_id?: string; // The cdp_source this segment originated from; points to CdpSource
	metadata?: [];
	raw?: any; // The raw data returned by the integration for this segment
} 

Zod

Zod
import { z } from 'zod';

export const ZodCdpSegment = z.object({
	id: z.string().optional().describe("Unique identifier for this segment object"),
	created_at: z.string-time().optional().describe("The date that this segment object was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	updated_at: z.string-time().optional().describe("The last date that this segment object was updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	name: z.string().optional().describe("The name of the segment/audience"),
	slug: z.string().optional().describe("The data-plane handle/key used to identify segment membership in profiles and destinations"),
	description: z.string().optional().describe("The description of the segment/audience"),
	definition: z.string().optional().describe("The membership rule/query that defines the segment"),
	type: z.enum("USERS", "ACCOUNTS", "LINKED").optional().describe("The type of entity the segment targets (USERS, ACCOUNTS, LINKED)"),
	compute_mode: z.enum("REALTIME", "BATCH").optional().describe("How the segment membership is computed (REALTIME or BATCH)"),
	size: z.number().optional().describe("The number of profiles currently in the segment"),
	is_active: z.boolean().optional().describe("Whether the segment is active/enabled"),
	source_id: z.string().optional().describe("The cdp_source this segment originated from; points to CdpSource"),
	metadata: z.array().optional(),

});

Python

Python
import dataclasses

@dataclasses.dataclass
class CdpSegmentType(str, Enum):
	USERS = 'USERS'
	ACCOUNTS = 'ACCOUNTS'
	LINKED = 'LINKED'

@dataclasses.dataclass
class CdpSegmentCompute_mode(str, Enum):
	REALTIME = 'REALTIME'
	BATCH = 'BATCH'

@dataclasses.dataclass
class CdpSegment:
	"""Unique identifier for this segment object"""
	id: Optional[str]
	"""The date that this segment object was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	created_at: Optional[str]
	"""The last date that this segment object was updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	updated_at: Optional[str]
	"""The name of the segment/audience"""
	name: Optional[str]
	"""The data-plane handle/key used to identify segment membership in profiles and destinations"""
	slug: Optional[str]
	"""The description of the segment/audience"""
	description: Optional[str]
	"""The membership rule/query that defines the segment"""
	definition: Optional[str]
	"""The type of entity the segment targets (USERS, ACCOUNTS, LINKED)"""
	type: Optional[CdpSegmentType]
	"""How the segment membership is computed (REALTIME or BATCH)"""
	compute_mode: Optional[CdpSegmentCompute_mode]
	"""The number of profiles currently in the segment"""
	size: Optional[int]
	"""Whether the segment is active/enabled"""
	is_active: Optional[bool]
	"""The cdp_source this segment originated from; points to CdpSource"""
	source_id: Optional[str]
	metadata: Optional[PropertyCdpSegmentMetadata]
Are we missing anything? Let us know
Was this page helpful?