Skip to main content
POST
/
attributes
Create an attribute
curl --request POST \
  --url https://api.samsara.com/attributes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "attributeType": "single-select",
  "entityType": "asset",
  "name": "License Certifications",
  "entities": [
    {
      "dateValues": [
        "2023-12-25"
      ],
      "entityId": "<string>",
      "externalIds": {
        "maintenanceId": "250020",
        "payrollId": "ABFS18600"
      },
      "numberValues": [
        123
      ],
      "stringValues": [
        "<string>"
      ]
    }
  ],
  "numberValues": [
    123
  ],
  "stringValues": [
    "<string>"
  ],
  "unit": "METER"
}
'
{
  "data": {
    "entities": [
      {
        "dateValues": [
          "<string>"
        ],
        "entityId": 123,
        "externalIds": {
          "maintenanceId": "250020",
          "payrollId": "ABFS18600"
        },
        "name": "<string>",
        "numberValues": [
          123
        ],
        "stringValues": [
          "<string>"
        ],
        "values": [
          {
            "id": "123e4567-e89b-12d3-a456-426614174000",
            "stringValue": "CDL"
          }
        ]
      }
    ],
    "attributeType": "single-select",
    "entityType": "asset",
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "License Certifications",
    "numberValues": [
      123
    ],
    "stringValues": [
      "<string>"
    ],
    "unit": "METER",
    "values": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "stringValue": "CDL"
      }
    ]
  }
}

Documentation Index

Fetch the complete documentation index at: https://samsara-showcase.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The attribute to create.

A request body to create an Attribute.

attributeType
enum<string>
default:multi-select
required

Denotes the data type of the attribute's values. Valid values: single-select, multi-select, text, freeform-multi-select, number, date.

Available options:
single-select,
multi-select,
text,
freeform-multi-select,
number,
date
Example:

"single-select"

entityType
enum<string>
required

Denotes the type of entity, driver or asset.

Available options:
driver,
asset
Example:

"asset"

name
string
required

Name

Example:

"License Certifications"

entities
object[]

Entities that will be applied to this attribute

numberValues
number<double>[]

Number values that can be associated with this attribute

stringValues
string[]

String values that can be associated with this attribute

unit
enum<string>
default:NO_UNIT

Unit of the attribute (only for Number attributes).

Available options:
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
Example:

"METER"

Response

Newly created attribute object with ID.

data
object