Documents

Create document

Creates a single document. The legacy version of this endpoint can be found at samsara.com/api-legacy.

<b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

To use this endpoint, select Write Documents under the Driver Workflow 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>

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.

post/fleet/documents

Request

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

Request body

documentTypeIdstring required

ID for the document type.

driverIdstring required

ID of the driver. Can be either unique Samsara ID or an external ID for the driver.

namestring

Name of the document.

notesstring

Notes on the document.

routeStopIdstring

ID of the route stop. Can be either unique Samsara ID or an external ID for the route stop.

state'submitted' | 'required'

The condition of the document created for the driver. Can be either required or submitted, if no value is specified, state defaults to required. required documents are pre-populated documents for the Driver to fill out in the Driver App. Valid values: submitted, required

vehicleIdstring

ID of the vehicle. Can be either unique Samsara ID or an external ID for the vehicle.

Example request

{
  "documentTypeId": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
  "driverId": "45646",
  "fields": [
    {
      "label": "Load weight",
      "type": "photo",
      "value": {
        "barcodeValue": [
          {
            "barcodeType": "org.gs1.EAN-13",
            "barcodeValue": "0853883003114"
          }
        ],
        "dateTimeValue": {
          "dateTime": "1992-09-06T22:50:20Z"
        },
        "multipleChoiceValue": [
          {
            "value": "Yes"
          }
        ],
        "numberValue": 123.456,
        "photoValue": [
          {
            "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
            "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
          }
        ],
        "scannedDocumentValue": [
          {
            "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
            "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
          }
        ],
        "signatureValue": {
          "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
          "name": "John Smith",
          "signedAtTime": "1985-08-03T18:38:16Z",
          "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
        },
        "stringValue": "Red Truck"
      }
    }
  ],
  "name": "Dropoff Slip 123",
  "notes": "Missing a crate",
  "routeStopId": "45646",
  "state": "submitted",
  "vehicleId": "45646"
}

Response

OK response.

Example response

{
  "data": {
    "conditionalFieldSections": [
      {
        "conditionalFieldFirstIndex": 8217465358527716000,
        "conditionalFieldLastIndex": 1543582388420605000,
        "triggeringFieldIndex": 7540159348423735000,
        "triggeringFieldValue": "Optiona 1"
      }
    ],
    "createdAtTime": "2015-09-08T06:33:15Z",
    "documentType": {
      "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
      "name": "Fleet Truck List"
    },
    "driver": {
      "id": "45646",
      "name": "Driver Bob"
    },
    "fields": [
      {
        "label": "Load weight",
        "type": "photo",
        "value": {
          "barcodeValue": [
            {
              "barcodeType": "org.gs1.EAN-13",
              "barcodeValue": "0853883003114"
            }
          ],
          "dateTimeValue": {
            "dateTime": "1973-12-20T17:06:49Z"
          },
          "multipleChoiceValue": [
            {
              "value": "Yes"
            }
          ],
          "numberValue": 123.456,
          "photoValue": [
            {
              "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
              "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
            }
          ],
          "scannedDocumentValue": [
            {
              "id": "f5271458-21f9-4a9f-a290-780c6d8840ff",
              "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
            }
          ],
          "signatureValue": {
            "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
            "name": "John Smith",
            "signedAtTime": "1989-09-25T02:38:09Z",
            "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456"
          },
          "stringValue": "Red Truck"
        }
      }
    ],
    "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7",
    "name": "Dropoff Slip 123",
    "notes": "Missing a crate",
    "route": {
      "id": "131313",
      "name": "Pineapple delivery"
    },
    "routeStop": {
      "id": "494123",
      "name": "Company Warehouse #1"
    },
    "state": "submitted",
    "updatedAtTime": "1975-05-20T03:23:39Z",
    "vehicle": {
      "id": "494123",
      "name": "Fleet Truck #1"
    }
  }
}

Changes

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