/** * Samsara API * # Overview Something new! Welcome Samsara\'s new and improved API. Check out our FAQ [here](https://developers.samsara.com/docs/introducing-our-next-generation-api) to see what\'s changed and learn how to get started.

Want to access the legacy API docs? You can find them [here](https://www.samsara.com/api-legacy).

*Note: Because this is a new set of APIs, we have not transitioned all endpoints over to this standard. Endpoints that still use the legacy standards are indicated in the reference documentation. If you can\'t find an API that you\'re looking for, we encourage you to look for it in our [legacy API docs](https://www.samsara.com/api-legacy) as we continue to transition all endpoints over. Check back here for updates!*

Submit your feedback [here](https://forms.gle/r4bs6HQshQAvBuwv6)!
Samsara provides API endpoints so that you can build powerful applications and custom solutions with sensor data. Samsara has endpoints available to track and analyze sensors, vehicles, and entire fleets. The Samsara API is a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer). It uses standard [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) authentication, verbs, and response codes, and it returns [JSON](http://www.json.org/) response bodies. If you\'re familiar with what you can build with a REST API, then this will be your go-to API reference. Visit [developers.samsara.com](https://developers.samsara.com) to find getting started guides and an API overview. If you have any questions, please visit https://samsara.com/help. ## Endpoints All our APIs can be accessed through HTTP requests to URLs like: ``` https://api.samsara.com/ ``` For EU customers, this URL will be: ``` https://api.eu.samsara.com/ ``` Note Legacy endpoints will have the URL: `https://api.samsara.com/v1/` or `https://api.eu.samsara.com/v1/` ## Authentication To authenticate your API request you will need to include your secret token. You can manage your API tokens in the [Dashboard](https://cloud.samsara.com). They are visible under `Settings->Organization->API Tokens`. Your API tokens carry many privileges, so be sure to keep them secure. Do not share your secret API tokens in publicly accessible areas such as GitHub, client-side code, and so on. Authentication to the API is performed via Bearer Token in the HTTP Authorization header. Provide your API token as the `access_token` value in an `Authorization: Bearer` header. You do not need to provide a password: ```curl Authorization: Bearer {access_token} ``` All API requests must be made over [HTTPS](https://en.wikipedia.org/wiki/HTTPS). Calls made over plain HTTP or without authentication will fail. ### OAuth2 If building an application for our marketplace, our API is accessible via. OAuth2 as well. | Type | Value | | ------------- |:-------------:| | Security scheme | OAuth2 | | OAuth2 Flow | accessCode | | Authorization URL | https://api.samsara.com/oauth2/authorize | | Token URL | https://api.samsara.com/oauth2/token | ## Common Patterns You can find more info about request methods, response codes, error codes, versioning, pagination, timestamps, and mini-objects [here](https://developers.samsara.com/docs/common-structures). * * The version of the OpenAPI document: 2024-11-18 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import { RequestArgs, BaseAPI } from '../base'; import { CoachingSessionsGetCoachingSessionsResponseBody } from '../samsara-models'; import { DriverCoachAssignmentsGetDriverCoachAssignmentResponseBody } from '../samsara-models'; import { DriverCoachAssignmentsPutDriverCoachAssignmentResponseBody } from '../samsara-models'; /** * CoachingApi - axios parameter creator * @export */ export declare const CoachingApiAxiosParamCreator: (configuration?: Configuration) => { /** * This endpoint will return coaching sessions for your organization based on the time parameters passed in. Results are paginated by sessions. If you include an endTime, the endpoint will return data up until that point. If you don’t include an endTime, you can continue to poll the API real-time with the pagination cursor that gets returned on every call. Rate limit: 5 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get coaching sessions. * @param {string} startTime Required RFC 3339 timestamp that indicates when to begin receiving data. Value is compared against `updatedAtTime` * @param {Array} [driverIds] Optional string of comma separated driver IDs. If driver ID is present, sessions for the specified driver(s) will be returned. * @param {Array} [coachIds] Optional string of comma separated user IDs. If coach ID is present, sessions for the specified coach(s) will be returned for either assignedCoach or completedCoach. If both driverId(s) and coachId(s) are present, sessions with specified driver(s) and coach(es) will be returned. * @param {Array} [sessionStatuses] Optional string of comma separated statuses. Valid values: “upcoming”, “completed”, “deleted”. * @param {boolean} [includeCoachableEvents] Optional boolean to control whether behaviors will include coachableEvents in the response. Defaults to false. * @param {string} [endTime] Optional RFC 3339 timestamp. If not provided then the endpoint behaves as an unending feed of changes. If endTime is set the same as startTime, the most recent data point before that time will be returned per asset. Value is compared against `updatedAtTime` * @param {string} [after] If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. * @param {boolean} [includeExternalIds] Optional boolean indicating whether to return external IDs on supported entities * @param {*} [options] Override http request option. * @throws {RequiredError} */ getCoachingSessions: (startTime: string, driverIds?: Array, coachIds?: Array, sessionStatuses?: Array, includeCoachableEvents?: boolean, endTime?: string, after?: string, includeExternalIds?: boolean, options?: RawAxiosRequestConfig) => Promise; /** * This endpoint will return coach assignments for your organization based on the parameters passed in. Results are paginated. Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get driver coach assignments. * @param {Array} [driverIds] Optional string of comma separated IDs of the drivers. This can be either a unique Samsara driver ID or an external ID for the driver. * @param {Array} [coachIds] Optional string of comma separated IDs of the coaches. * @param {boolean} [includeExternalIds] Optional boolean indicating whether to return external IDs on supported entities * @param {string} [after] If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDriverCoachAssignment: (driverIds?: Array, coachIds?: Array, includeExternalIds?: boolean, after?: string, options?: RawAxiosRequestConfig) => Promise; /** * This endpoint will update an existing or create a new coach-to-driver assignment for your organization based on the parameters passed in. This endpoint should only be used for existing Coach to Driver assignments. In order to remove a driver-coach-assignment for a given driver, set coachId to null Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Write Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Put driver coach assignments. * @param {string} driverId Required string ID of the driver. This is a unique Samsara ID of a driver. * @param {string} [coachId] Optional string ID of the coach. This is a unique Samsara user ID. If not provided, existing coach assignment will be removed. * @param {*} [options] Override http request option. * @throws {RequiredError} */ putDriverCoachAssignment: (driverId: string, coachId?: string, options?: RawAxiosRequestConfig) => Promise; }; /** * CoachingApi - functional programming interface * @export */ export declare const CoachingApiFp: (configuration?: Configuration) => { /** * This endpoint will return coaching sessions for your organization based on the time parameters passed in. Results are paginated by sessions. If you include an endTime, the endpoint will return data up until that point. If you don’t include an endTime, you can continue to poll the API real-time with the pagination cursor that gets returned on every call. Rate limit: 5 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get coaching sessions. * @param {string} startTime Required RFC 3339 timestamp that indicates when to begin receiving data. Value is compared against `updatedAtTime` * @param {Array} [driverIds] Optional string of comma separated driver IDs. If driver ID is present, sessions for the specified driver(s) will be returned. * @param {Array} [coachIds] Optional string of comma separated user IDs. If coach ID is present, sessions for the specified coach(s) will be returned for either assignedCoach or completedCoach. If both driverId(s) and coachId(s) are present, sessions with specified driver(s) and coach(es) will be returned. * @param {Array} [sessionStatuses] Optional string of comma separated statuses. Valid values: “upcoming”, “completed”, “deleted”. * @param {boolean} [includeCoachableEvents] Optional boolean to control whether behaviors will include coachableEvents in the response. Defaults to false. * @param {string} [endTime] Optional RFC 3339 timestamp. If not provided then the endpoint behaves as an unending feed of changes. If endTime is set the same as startTime, the most recent data point before that time will be returned per asset. Value is compared against `updatedAtTime` * @param {string} [after] If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. * @param {boolean} [includeExternalIds] Optional boolean indicating whether to return external IDs on supported entities * @param {*} [options] Override http request option. * @throws {RequiredError} */ getCoachingSessions(startTime: string, driverIds?: Array, coachIds?: Array, sessionStatuses?: Array, includeCoachableEvents?: boolean, endTime?: string, after?: string, includeExternalIds?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; /** * This endpoint will return coach assignments for your organization based on the parameters passed in. Results are paginated. Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get driver coach assignments. * @param {Array} [driverIds] Optional string of comma separated IDs of the drivers. This can be either a unique Samsara driver ID or an external ID for the driver. * @param {Array} [coachIds] Optional string of comma separated IDs of the coaches. * @param {boolean} [includeExternalIds] Optional boolean indicating whether to return external IDs on supported entities * @param {string} [after] If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDriverCoachAssignment(driverIds?: Array, coachIds?: Array, includeExternalIds?: boolean, after?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; /** * This endpoint will update an existing or create a new coach-to-driver assignment for your organization based on the parameters passed in. This endpoint should only be used for existing Coach to Driver assignments. In order to remove a driver-coach-assignment for a given driver, set coachId to null Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Write Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Put driver coach assignments. * @param {string} driverId Required string ID of the driver. This is a unique Samsara ID of a driver. * @param {string} [coachId] Optional string ID of the coach. This is a unique Samsara user ID. If not provided, existing coach assignment will be removed. * @param {*} [options] Override http request option. * @throws {RequiredError} */ putDriverCoachAssignment(driverId: string, coachId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; }; /** * CoachingApi - factory interface * @export */ export declare const CoachingApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => { /** * This endpoint will return coaching sessions for your organization based on the time parameters passed in. Results are paginated by sessions. If you include an endTime, the endpoint will return data up until that point. If you don’t include an endTime, you can continue to poll the API real-time with the pagination cursor that gets returned on every call. Rate limit: 5 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get coaching sessions. * @param {CoachingApiGetCoachingSessionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getCoachingSessions(requestParameters: CoachingApiGetCoachingSessionsRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * This endpoint will return coach assignments for your organization based on the parameters passed in. Results are paginated. Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get driver coach assignments. * @param {CoachingApiGetDriverCoachAssignmentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDriverCoachAssignment(requestParameters?: CoachingApiGetDriverCoachAssignmentRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * This endpoint will update an existing or create a new coach-to-driver assignment for your organization based on the parameters passed in. This endpoint should only be used for existing Coach to Driver assignments. In order to remove a driver-coach-assignment for a given driver, set coachId to null Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Write Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Put driver coach assignments. * @param {CoachingApiPutDriverCoachAssignmentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ putDriverCoachAssignment(requestParameters: CoachingApiPutDriverCoachAssignmentRequest, options?: RawAxiosRequestConfig): AxiosPromise; }; /** * Request parameters for getCoachingSessions operation in CoachingApi. * @export * @interface CoachingApiGetCoachingSessionsRequest */ export interface CoachingApiGetCoachingSessionsRequest { /** * Required RFC 3339 timestamp that indicates when to begin receiving data. Value is compared against `updatedAtTime` * @type {string} * @memberof CoachingApiGetCoachingSessions */ readonly startTime: string; /** * Optional string of comma separated driver IDs. If driver ID is present, sessions for the specified driver(s) will be returned. * @type {Array} * @memberof CoachingApiGetCoachingSessions */ readonly driverIds?: Array; /** * Optional string of comma separated user IDs. If coach ID is present, sessions for the specified coach(s) will be returned for either assignedCoach or completedCoach. If both driverId(s) and coachId(s) are present, sessions with specified driver(s) and coach(es) will be returned. * @type {Array} * @memberof CoachingApiGetCoachingSessions */ readonly coachIds?: Array; /** * Optional string of comma separated statuses. Valid values: “upcoming”, “completed”, “deleted”. * @type {Array} * @memberof CoachingApiGetCoachingSessions */ readonly sessionStatuses?: Array; /** * Optional boolean to control whether behaviors will include coachableEvents in the response. Defaults to false. * @type {boolean} * @memberof CoachingApiGetCoachingSessions */ readonly includeCoachableEvents?: boolean; /** * Optional RFC 3339 timestamp. If not provided then the endpoint behaves as an unending feed of changes. If endTime is set the same as startTime, the most recent data point before that time will be returned per asset. Value is compared against `updatedAtTime` * @type {string} * @memberof CoachingApiGetCoachingSessions */ readonly endTime?: string; /** * If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. * @type {string} * @memberof CoachingApiGetCoachingSessions */ readonly after?: string; /** * Optional boolean indicating whether to return external IDs on supported entities * @type {boolean} * @memberof CoachingApiGetCoachingSessions */ readonly includeExternalIds?: boolean; } /** * Request parameters for getDriverCoachAssignment operation in CoachingApi. * @export * @interface CoachingApiGetDriverCoachAssignmentRequest */ export interface CoachingApiGetDriverCoachAssignmentRequest { /** * Optional string of comma separated IDs of the drivers. This can be either a unique Samsara driver ID or an external ID for the driver. * @type {Array} * @memberof CoachingApiGetDriverCoachAssignment */ readonly driverIds?: Array; /** * Optional string of comma separated IDs of the coaches. * @type {Array} * @memberof CoachingApiGetDriverCoachAssignment */ readonly coachIds?: Array; /** * Optional boolean indicating whether to return external IDs on supported entities * @type {boolean} * @memberof CoachingApiGetDriverCoachAssignment */ readonly includeExternalIds?: boolean; /** * If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. * @type {string} * @memberof CoachingApiGetDriverCoachAssignment */ readonly after?: string; } /** * Request parameters for putDriverCoachAssignment operation in CoachingApi. * @export * @interface CoachingApiPutDriverCoachAssignmentRequest */ export interface CoachingApiPutDriverCoachAssignmentRequest { /** * Required string ID of the driver. This is a unique Samsara ID of a driver. * @type {string} * @memberof CoachingApiPutDriverCoachAssignment */ readonly driverId: string; /** * Optional string ID of the coach. This is a unique Samsara user ID. If not provided, existing coach assignment will be removed. * @type {string} * @memberof CoachingApiPutDriverCoachAssignment */ readonly coachId?: string; } /** * CoachingApi - object-oriented interface * @export * @class CoachingApi * @extends {BaseAPI} */ export declare class CoachingApi extends BaseAPI { /** * This endpoint will return coaching sessions for your organization based on the time parameters passed in. Results are paginated by sessions. If you include an endTime, the endpoint will return data up until that point. If you don’t include an endTime, you can continue to poll the API real-time with the pagination cursor that gets returned on every call. Rate limit: 5 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get coaching sessions. * @param {CoachingApiGetCoachingSessionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CoachingApi */ getCoachingSessions(requestParameters: CoachingApiGetCoachingSessionsRequest, options?: RawAxiosRequestConfig): Promise>; /** * This endpoint will return coach assignments for your organization based on the parameters passed in. Results are paginated. Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Read Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Get driver coach assignments. * @param {CoachingApiGetDriverCoachAssignmentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CoachingApi */ getDriverCoachAssignment(requestParameters?: CoachingApiGetDriverCoachAssignmentRequest, options?: RawAxiosRequestConfig): Promise>; /** * This endpoint will update an existing or create a new coach-to-driver assignment for your organization based on the parameters passed in. This endpoint should only be used for existing Coach to Driver assignments. In order to remove a driver-coach-assignment for a given driver, set coachId to null Rate limit: 10 requests/sec (learn more about rate limits here). To use this endpoint, select **Write Coaching** under the Coaching category when creating or editing an API token. Learn More. **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * @summary Put driver coach assignments. * @param {CoachingApiPutDriverCoachAssignmentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CoachingApi */ putDriverCoachAssignment(requestParameters: CoachingApiPutDriverCoachAssignmentRequest, options?: RawAxiosRequestConfig): Promise>; }