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

# Create an attribute

`POST /attributes`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/attributes`
- Auth: HTTP bearer

Creates a new attribute in the organization. 

 **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

To use this endpoint, select **Write Attributes** under the Setup & Administration category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

## Request body

- CreateAttributeRequest: A request body to create an Attribute.
  - `attributeType` 'single-select' | 'multi-select' | 'text' | 'freeform-multi-select' | 'number' | 'date', required: Denotes the data type of the attribute's values. Valid values: `single-select`, `multi-select`, `text`, `freeform-multi-select`, `number`, `date`.
  - `entities` CreateAttributeRequestEntities[]: Entities that will be applied to this attribute
    - `dateValues` string[]: Date values that can be associated with this attribute in RFC 3339 full-date format (YYYY-MM-DD)
    - `entityId` string: Entity id, based on the entity type.
    - `externalIds` object: The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.
    - `numberValues` number[]: Number values that can be associated with this attribute
    - `stringValues` string[]: String values that can be associated with this attribute
  - `entityType` 'driver' | 'asset' | 'workOrder', required: Denotes the type of entity, driver, asset, or workOrder. `workOrder` requires work order attributes to be enabled for the organization. Work order attributes are created without `entities`; set attribute values on work orders through the work orders API.
  - `name` string, required: Name
  - `numberValues` number[]: Number values that can be associated with this attribute
  - `stringValues` string[]: String values that can be associated with this attribute
  - `unit` 'NO_UNIT' | 'METER' | 'POUND' | 'TON' | 'KILOGRAM' | 'INCH' | 'FOOT' | 'GALLON' | 'LITER' | 'BARREL' | 'POUND_PER_SQUARE_INCH' | 'BAR' | 'KILOPASCAL' | 'FAHRENHEIT' | 'CELSIUS' | 'USD' | 'CAD' | 'EUR' | 'GBP' | 'MXN' | 'HOUR' | 'MINUTE' | 'DAY' | 'MILE_PER_HOUR' | 'KILOMETER_PER_HOUR' | 'HORSEPOWER' | 'KILOWATT' | 'BTU_PER_HOUR' | 'KILOWATT_HOUR' | 'BTU' | 'HERTZ' | 'REVOLUTION_PER_MINUTE' | 'DECIBEL': Unit of the attribute (only for Number attributes).

## Response `200`

Newly created attribute object with ID.

- AttributeExpandedResponse
  - `data` AttributeExpanded
    - `attributeType` 'single-select' | 'multi-select' | 'text' | 'freeform-multi-select' | 'number' | 'date': Denotes the data type of the attribute's values. Valid values: `single-select`, `multi-select`, `text`, `freeform-multi-select`, `number`, `date`.
    - `entityType` 'driver' | 'asset' | 'workOrder': Denotes the type of entity, driver, asset, or workOrder. Valid values: `driver`, `asset`, `workOrder`.
    - `id` string: The samsara id of the attribute object.
    - `name` string: Name of attribute.
    - `numberValues` number[]: Number values that can be associated with this attribute. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`
    - `stringValues` string[]: String values that can be associated with this attribute. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`
    - `unit` 'NO_UNIT' | 'METER' | 'POUND' | 'TON' | 'KILOGRAM' | 'INCH' | 'FOOT' | 'GALLON' | 'LITER' | 'BARREL' | 'POUND_PER_SQUARE_INCH' | 'BAR' | 'KILOPASCAL' | 'FAHRENHEIT' | 'CELSIUS' | 'USD' | 'CAD' | 'EUR' | 'GBP' | 'MXN' | 'HOUR' | 'MINUTE' | 'DAY' | 'MILE_PER_HOUR' | 'KILOMETER_PER_HOUR' | 'HORSEPOWER' | 'KILOWATT' | 'BTU_PER_HOUR' | 'KILOWATT_HOUR' | 'BTU' | 'HERTZ' | 'REVOLUTION_PER_MINUTE' | 'DECIBEL': Unit of the attribute (only for Number attributes).
    - `values` AttributeValueTiny[]: Representation of values that includes ids. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`
      - `id` string: The samsara id of this value object.
      - `stringValue` string: The human-readable string for this value.
    - `entities` AttributeEntity[], required: Entities that this attribute is applied onto
      - `dateValues` string[]: Date values that are associated with this attribute (RFC 3339 date format: YYYY-MM-DD).
      - `entityId` integer
      - `externalIds` object: The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.
      - `name` string
      - `numberValues` number[]: Number values that are associated with this attribute. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`
      - `stringValues` string[]: String values that are associated with this attribute. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`
      - `values` AttributeValueTiny[]: Representation of values that includes ids. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`
        - `id` string: The samsara id of this value object.
        - `stringValue` string: The human-readable string for this value.

## Other responses

- `default`: Error response

---

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