---
title: "Create custom attribute"
method: POST
path: "/v1/attributes"
tags: ["Attributes"]
---

# Create custom attribute

`POST /v1/attributes`

## Request

- Base URL: `https://yourbaseurl.talon.one`
- URL: `https://yourbaseurl.talon.one/v1/attributes`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `Authorization`
- TypeScript: <https://skmtc.dev/talon/apis/management-api/docs/v1/attributes/post.ts> (a function with typed inputs; its response is checked against the schema)

> [!note] Management API endpoints are **not** meant to be used in real-time integrations that directly serve your end users. Rate limit: 3 requests per second.

Create a _custom attribute_ in this account.
[Custom attributes](https://docs.talon.one/docs/dev/concepts/attributes) allow you
to add data to Talon.One domain entities like campaigns, coupons,
customers and so on.

These attributes can then be given values when creating/updating these entities, and these values can be
used in your campaign rules.

For example, you could define a `zipCode` field for customer sessions,
and add a rule to your campaign that only allows certain ZIP codes.

These attributes are shared across all Applications in your account and are never required.

## Request body

- NewAttribute
  - `entity` 'Application' | 'Campaign' | 'CustomerProfile' | 'CustomerSession' | 'CartItem' | 'Coupon' | 'Event' | 'Giveaway' | 'LoyaltyCard' | 'Referral' | 'Store', required: The name of the entity that can have this attribute. When creating or updating the entities of a given type, you can include an `attributes` object with keys corresponding to the `name` of the custom attributes for that type.
  - `eventType` string
  - `name` string, required: The attribute name that will be used in API requests and Talang. E.g. if `name == "region"` then you would set the region attribute by including an `attributes.region` property in your request payload.
  - `title` string, required: The human-readable name for the attribute that will be shown in the Campaign Manager. Like `name`, the combination of entity and title must also be unique.
  - `type` 'string' | 'number' | 'boolean' | 'time' | '(list string)' | '(list number)' | '(list time)' | 'location' | '(list location)', required: The data type of the attribute, a `time` attribute must be sent as a string that conforms to the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) timestamp format.
  - `description` string, required: A description of this attribute.
  - `suggestions` string[], required: A list of suggestions for the attribute.
  - `hasAllowedList` boolean: Whether or not this attribute has an allowed list of values associated with it.
  - `restrictedBySuggestions` boolean: Whether or not this attribute's value is restricted by suggestions (`suggestions` property) or by an allowed list of value (`hasAllowedList` property).
  - `editable` boolean, required: Whether or not this attribute can be edited.
  - `subscribedApplicationsIds` integer[]: A list of the IDs of the applications where this attribute is available.
  - `subscribedCatalogsIds` integer[]: A list of the IDs of the catalogs where this attribute is available.
  - `allowedSubscriptions` string[]: A list of allowed subscription types for this attribute. **Note:** This only applies to attributes associated with the `CartItem` entity.

## Response `201`

Created

- Attribute
  - `id` integer, required: The internal ID of this entity.
  - `created` string, date-time, required: The time this entity was created.
  - `accountId` integer, required: The ID of the account that owns this entity.
  - `entity` 'Application' | 'Campaign' | 'CustomerProfile' | 'CustomerSession' | 'CartItem' | 'Coupon' | 'Event' | 'Giveaway' | 'LoyaltyCard' | 'Referral' | 'Store', required: The name of the entity that can have this attribute. When creating or updating the entities of a given type, you can include an `attributes` object with keys corresponding to the `name` of the custom attributes for that type.
  - `eventType` string
  - `name` string, required: The attribute name that will be used in API requests and Talang. E.g. if `name == "region"` then you would set the region attribute by including an `attributes.region` property in your request payload.
  - `title` string, required: The human-readable name for the attribute that will be shown in the Campaign Manager. Like `name`, the combination of entity and title must also be unique.
  - `type` 'string' | 'number' | 'boolean' | 'time' | '(list string)' | '(list number)' | '(list time)' | 'location' | '(list location)', required: The data type of the attribute, a `time` attribute must be sent as a string that conforms to the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) timestamp format.
  - `description` string, required: A description of this attribute.
  - `suggestions` string[], required: A list of suggestions for the attribute.
  - `hasAllowedList` boolean: Whether or not this attribute has an allowed list of values associated with it.
  - `restrictedBySuggestions` boolean: Whether or not this attribute's value is restricted by suggestions (`suggestions` property) or by an allowed list of value (`hasAllowedList` property).
  - `editable` boolean, required: Whether or not this attribute can be edited.
  - `subscribedApplicationsIds` integer[]: A list of the IDs of the applications where this attribute is available.
  - `subscribedCatalogsIds` integer[]: A list of the IDs of the catalogs where this attribute is available.
  - `allowedSubscriptions` string[]: A list of allowed subscription types for this attribute. **Note:** This only applies to attributes associated with the `CartItem` entity.
  - `eventTypeId` integer

---

[API](https://skmtc.dev/talon/apis/management-api.md) - [All operations](https://skmtc.dev/talon/apis/management-api/llms.txt) - [OpenAPI document](https://skmtc.dev/talon/apis/management-api/revisions/7ef1b9504c3a?raw)
