Register a custom-attribute definition
Registers a new managed attribute definition — the typed schema a Segment's
SendQL predicate can then reference as attr.<name>. enum_values is
required when type is enum and rejected otherwise. An invalid name or
type returns 422 validation_failed.
This endpoint creates: a name that already exists returns 409 conflict. To provision a schema repeatedly — "make sure these attributes
exist" on every deploy — use PUT /v1/attributes/by-name/{name}, which is
idempotent and returns 200 when the definition is already present.
Request body
Content type: application/json
name string required Lowercase identifier (letters, digits, underscore), referenced in SendQL as attr.<name>.
type string enum optional Required for an ordinary attribute; ignored when formula is set (the derived type is inferred).
One of: string, number, bool, datetime, enum
enum_values array<string> optional Required when type is enum; must be empty/omitted otherwise.
description string optional formula string optional Creates a derived attribute (SND-1067) whose value SendOps computes and
maintains from the contact's event/activity stream. One aggregate over one
source: exists, count, first, or last of a SES event name (send,
open, click, …) or activity.<name> — e.g. exists(send),
count(activity.order). The value type is inferred; type/enum_values
are ignored. Derived attributes are managed-only (not promotable) and their
formula is immutable (change = delete + recreate). Create-only.
Responses
Errors follow the RFC 7807 problem format — see the error reference.
id string<uuid> required name string required Lowercase identifier; referenced in SendQL as attr.<name>.
type string enum required One of: string, number, bool, datetime, enum
enum_values array<string> optional Allowed values when type is enum; omitted otherwise.
description string required formula string optional For a derived attribute (SND-1067): the aggregate expression SendOps
computes over the contact's event/activity stream, e.g. exists(send),
count(activity.order), last(open). Present only for derived attributes;
their value is maintained by SendOps (read-only) and type is inferred
(exists→bool, count→number, first/last→datetime).
origin string enum optional Where the attribute is authored: managed (via the API/dashboard) or
git (synced from a connected repo and read-only via the API).
One of: managed, git
source_path string optional Repo-relative source file, for git-backed attributes only.
last_synced_at string<date-time> optional Time of the last git sync, for git-backed attributes only.
created_at string<date-time> required updated_at string<date-time> required code is conflict.
application/problem+json code is internal_error. The
request_id field can be quoted to SendOps support to investigate.
application/problem+json