Attributes

Create an attribute

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>

post/attributes

Request

  • Base URL
    https://api.samsara.com
  • Auth
    HTTP bearer

Request body

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.

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.

namestring required

Name

numberValuesnumber[]

Number values that can be associated with this attribute

stringValuesstring[]

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).

Example request

{
  "attributeType": "single-select",
  "entities": [
    {
      "externalIds": {
        "maintenanceId": "250020",
        "payrollId": "ABFS18600"
      }
    }
  ],
  "entityType": "asset",
  "name": "License Certifications",
  "unit": "METER"
}

Response

Newly created attribute object with ID.

Example response

{
  "data": {
    "attributeType": "single-select",
    "entityType": "asset",
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "License Certifications",
    "unit": "METER",
    "values": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "stringValue": "CDL"
      }
    ],
    "entities": [
      {
        "externalIds": {
          "maintenanceId": "250020",
          "payrollId": "ABFS18600"
        },
        "values": [
          {
            "id": "123e4567-e89b-12d3-a456-426614174000",
            "stringValue": "CDL"
          }
        ]
      }
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.