Skip to content
Optima docs
Reference

Attribute types

The seven value types an attribute can have, what each accepts, and what happens to a value of the wrong type.

Every attribute on a profile, on an event, in a custom dataset or on a computed attribute has a type. The type decides what values are accepted, how the value is stored, which conditions the filter builder offers for it, and how it behaves in personalization and expressions.

You declare types on the Schema screen: under Entities for profiles, under Event types for events (the Type column of the attribute table), in custom datasets as Attribute types, and as the Value type of a computed attribute. See Profiles and entities and Attributes and computed attributes.

The seven types

TypeHoldsWhat you send (JSON)Notes
stringText"gold"Only text is accepted. A number sent to a string attribute is refused.
integerA whole number42Must be a JSON number. A fractional number is cut to its whole part (3.9 is stored as 3). Text such as "42" is refused.
decimalA number with a fractional part19.9Must be a JSON number.
booleanTrue or falsetrueOnly true or false, not "true" or 1.
datetimeA moment in time"2026-10-15T09:30:00Z"See Datetime values.
jsonA structured object{"city": "Bratislava"}Must be a JSON object. A list is not accepted. Stored as given.
array_stringA list of text values["vip", "newsletter"]Must be a JSON list. Every entry is converted to text, so [1, 2] is stored as "1" and "2".

A value of the wrong shape is refused when you send the data, with a message that names the attribute, for example:

attribute 'age': expected number for integer, got string
attribute 'tags': expected array for array_string, got string

For a batch call the message is prefixed with the position of the item (profiles[3]: …), and nothing in the batch is stored. A data contract can change this: it can coerce, warn or reject on a mismatch.

Datetime values

A datetime attribute accepts text in any of these forms:

FormExampleNotes
Date and time with a zone2026-10-15T09:30:00Z, 2026-10-15T11:30:00+02:00Fractions of a second are accepted.
Date and time without a zone2026-10-15T09:30:00Taken as UTC.
Date only2026-10-15Midnight UTC.
Unix time1792042200A JSON number of seconds since 1 January 1970, UTC.

Anything else is refused with cannot parse "…" as datetime. Dates are stored and shown in UTC. For imports through a connector, a date-time written as 2026-10-15 09:30:00 is also understood.

Undeclared attributes

An attribute that is not declared in the schema is accepted unless the entity or event type is set to Strict (reject unknown attributes); in strict mode a profile or event carrying an undeclared key is refused with status 422. In the default, lenient mode the type is worked out from the value:

You sendStored as
Textstring
A numberdecimal
true or falseboolean
A listarray_string
An objectjson
nullRefused: attribute value is null

Declare the types of attributes you filter or report on. A number that arrives undeclared is a decimal, which is not the same as a declared integer when you later compare or group by it.

Types in other places

  • Filters. The filter builder offers number comparison and between for integer and decimal, date comparison for datetime, a checkbox for boolean, and text operators for the rest. See Query filters.
  • Personalization. In message copy, numbers behave as decimal numbers (compare with 2.0, not 2), dates are formatted with date, and lists are looped with range. See Personalization syntax.
  • Imports. A connector mapping gives each field a type; a text cell that cannot be read as that type is a row error. For boolean, true, 1 and yes are true and false, 0, no and an empty cell are false. For array_string, a cell with comma-separated values becomes a list.
  • Journeys. A journey node that writes an attribute renders its value as text and then converts it to the attribute's type. For array_string a text starting with [ is read as a JSON list, and any other text is split at commas. For json, the text must be a JSON object.
  • PII level. Each attribute also carries a PII sensitivity level (0 means not sensitive). It is independent of the type and controls who sees the value; see Consent and purposes.

On this page