/** * 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 { InlineResponse2001 } from '../samsara-models'; import { InlineResponse2002 } from '../samsara-models'; import { InlineResponse2003 } from '../samsara-models'; import { V1AssetLocationResponseInner } from '../samsara-models'; import { V1AssetReeferResponse } from '../samsara-models'; /** * AssetsApi - axios parameter creator * @export */ export declare const AssetsApiAxiosParamCreator: (configuration?: Configuration) => { /** * This endpoint is still on our legacy API. Fetch current locations of all assets. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List current location for all assets * @param {string} [startingAfter] Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'endingBefore\' parameter. * @param {string} [endingBefore] Pagination parameter indicating the cursor position to return results before. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'startingAfter\' parameter. * @param {number} [limit] Pagination parameter indicating the number of results to return in this request. Used in conjunction with either \'startingAfter\' or \'endingBefore\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAllAssetCurrentLocations: (startingAfter?: string, endingBefore?: string, limit?: number, options?: RawAxiosRequestConfig) => Promise; /** * This endpoint is still on our legacy API. Fetch all of the assets. **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. To use this endpoint, select **Read Equipment** under the Equipment category when creating or editing an API token. Learn More. * @summary List all assets * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAllAssets: (options?: RawAxiosRequestConfig) => Promise; /** * This endpoint is still on our legacy API. List historical locations for a given asset. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List historical locations for a given asset * @param {number} assetId ID of the asset. Must contain only digits 0-9. * @param {number} startMs Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @param {number} endMs Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetLocation: (assetId: number, startMs: number, endMs: number, options?: RawAxiosRequestConfig) => Promise; /** * This endpoint is still on our legacy API. Fetch the reefer-specific stats of an asset. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for a given reefer * @param {number} assetId ID of the asset. Must contain only digits 0-9. * @param {number} startMs Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @param {number} endMs Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetReefer: (assetId: number, startMs: number, endMs: number, options?: RawAxiosRequestConfig) => Promise; /** * This endpoint is still on our legacy API. Fetches all reefers and reefer-specific stats. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for all reefers * @param {number} startMs Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @param {number} endMs Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @param {string} [startingAfter] Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'endingBefore\' parameter. * @param {string} [endingBefore] Pagination parameter indicating the cursor position to return results before. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'startingAfter\' parameter. * @param {number} [limit] Pagination parameter indicating the number of results to return in this request. Used in conjunction with either \'startingAfter\' or \'endingBefore\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetsReefers: (startMs: number, endMs: number, startingAfter?: string, endingBefore?: string, limit?: number, options?: RawAxiosRequestConfig) => Promise; }; /** * AssetsApi - functional programming interface * @export */ export declare const AssetsApiFp: (configuration?: Configuration) => { /** * This endpoint is still on our legacy API. Fetch current locations of all assets. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List current location for all assets * @param {string} [startingAfter] Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'endingBefore\' parameter. * @param {string} [endingBefore] Pagination parameter indicating the cursor position to return results before. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'startingAfter\' parameter. * @param {number} [limit] Pagination parameter indicating the number of results to return in this request. Used in conjunction with either \'startingAfter\' or \'endingBefore\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAllAssetCurrentLocations(startingAfter?: string, endingBefore?: string, limit?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; /** * This endpoint is still on our legacy API. Fetch all of the assets. **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. To use this endpoint, select **Read Equipment** under the Equipment category when creating or editing an API token. Learn More. * @summary List all assets * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAllAssets(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; /** * This endpoint is still on our legacy API. List historical locations for a given asset. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List historical locations for a given asset * @param {number} assetId ID of the asset. Must contain only digits 0-9. * @param {number} startMs Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @param {number} endMs Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetLocation(assetId: number, startMs: number, endMs: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>>; /** * This endpoint is still on our legacy API. Fetch the reefer-specific stats of an asset. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for a given reefer * @param {number} assetId ID of the asset. Must contain only digits 0-9. * @param {number} startMs Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @param {number} endMs Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetReefer(assetId: number, startMs: number, endMs: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; /** * This endpoint is still on our legacy API. Fetches all reefers and reefer-specific stats. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for all reefers * @param {number} startMs Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @param {number} endMs Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @param {string} [startingAfter] Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'endingBefore\' parameter. * @param {string} [endingBefore] Pagination parameter indicating the cursor position to return results before. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'startingAfter\' parameter. * @param {number} [limit] Pagination parameter indicating the number of results to return in this request. Used in conjunction with either \'startingAfter\' or \'endingBefore\'. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetsReefers(startMs: number, endMs: number, startingAfter?: string, endingBefore?: string, limit?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; }; /** * AssetsApi - factory interface * @export */ export declare const AssetsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => { /** * This endpoint is still on our legacy API. Fetch current locations of all assets. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List current location for all assets * @param {AssetsApiV1getAllAssetCurrentLocationsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAllAssetCurrentLocations(requestParameters?: AssetsApiV1getAllAssetCurrentLocationsRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * This endpoint is still on our legacy API. Fetch all of the assets. **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. To use this endpoint, select **Read Equipment** under the Equipment category when creating or editing an API token. Learn More. * @summary List all assets * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAllAssets(options?: RawAxiosRequestConfig): AxiosPromise; /** * This endpoint is still on our legacy API. List historical locations for a given asset. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List historical locations for a given asset * @param {AssetsApiV1getAssetLocationRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetLocation(requestParameters: AssetsApiV1getAssetLocationRequest, options?: RawAxiosRequestConfig): AxiosPromise>; /** * This endpoint is still on our legacy API. Fetch the reefer-specific stats of an asset. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for a given reefer * @param {AssetsApiV1getAssetReeferRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetReefer(requestParameters: AssetsApiV1getAssetReeferRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * This endpoint is still on our legacy API. Fetches all reefers and reefer-specific stats. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for all reefers * @param {AssetsApiV1getAssetsReefersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ v1getAssetsReefers(requestParameters: AssetsApiV1getAssetsReefersRequest, options?: RawAxiosRequestConfig): AxiosPromise; }; /** * Request parameters for v1getAllAssetCurrentLocations operation in AssetsApi. * @export * @interface AssetsApiV1getAllAssetCurrentLocationsRequest */ export interface AssetsApiV1getAllAssetCurrentLocationsRequest { /** * Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'endingBefore\' parameter. * @type {string} * @memberof AssetsApiV1getAllAssetCurrentLocations */ readonly startingAfter?: string; /** * Pagination parameter indicating the cursor position to return results before. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'startingAfter\' parameter. * @type {string} * @memberof AssetsApiV1getAllAssetCurrentLocations */ readonly endingBefore?: string; /** * Pagination parameter indicating the number of results to return in this request. Used in conjunction with either \'startingAfter\' or \'endingBefore\'. * @type {number} * @memberof AssetsApiV1getAllAssetCurrentLocations */ readonly limit?: number; } /** * Request parameters for v1getAssetLocation operation in AssetsApi. * @export * @interface AssetsApiV1getAssetLocationRequest */ export interface AssetsApiV1getAssetLocationRequest { /** * ID of the asset. Must contain only digits 0-9. * @type {number} * @memberof AssetsApiV1getAssetLocation */ readonly assetId: number; /** * Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @type {number} * @memberof AssetsApiV1getAssetLocation */ readonly startMs: number; /** * Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @type {number} * @memberof AssetsApiV1getAssetLocation */ readonly endMs: number; } /** * Request parameters for v1getAssetReefer operation in AssetsApi. * @export * @interface AssetsApiV1getAssetReeferRequest */ export interface AssetsApiV1getAssetReeferRequest { /** * ID of the asset. Must contain only digits 0-9. * @type {number} * @memberof AssetsApiV1getAssetReefer */ readonly assetId: number; /** * Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @type {number} * @memberof AssetsApiV1getAssetReefer */ readonly startMs: number; /** * Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @type {number} * @memberof AssetsApiV1getAssetReefer */ readonly endMs: number; } /** * Request parameters for v1getAssetsReefers operation in AssetsApi. * @export * @interface AssetsApiV1getAssetsReefersRequest */ export interface AssetsApiV1getAssetsReefersRequest { /** * Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. * @type {number} * @memberof AssetsApiV1getAssetsReefers */ readonly startMs: number; /** * Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. * @type {number} * @memberof AssetsApiV1getAssetsReefers */ readonly endMs: number; /** * Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'endingBefore\' parameter. * @type {string} * @memberof AssetsApiV1getAssetsReefers */ readonly startingAfter?: string; /** * Pagination parameter indicating the cursor position to return results before. Used in conjunction with the \'limit\' parameter. Mutually exclusive with \'startingAfter\' parameter. * @type {string} * @memberof AssetsApiV1getAssetsReefers */ readonly endingBefore?: string; /** * Pagination parameter indicating the number of results to return in this request. Used in conjunction with either \'startingAfter\' or \'endingBefore\'. * @type {number} * @memberof AssetsApiV1getAssetsReefers */ readonly limit?: number; } /** * AssetsApi - object-oriented interface * @export * @class AssetsApi * @extends {BaseAPI} */ export declare class AssetsApi extends BaseAPI { /** * This endpoint is still on our legacy API. Fetch current locations of all assets. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List current location for all assets * @param {AssetsApiV1getAllAssetCurrentLocationsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ v1getAllAssetCurrentLocations(requestParameters?: AssetsApiV1getAllAssetCurrentLocationsRequest, options?: RawAxiosRequestConfig): Promise>; /** * This endpoint is still on our legacy API. Fetch all of the assets. **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. To use this endpoint, select **Read Equipment** under the Equipment category when creating or editing an API token. Learn More. * @summary List all assets * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ v1getAllAssets(options?: RawAxiosRequestConfig): Promise>; /** * This endpoint is still on our legacy API. List historical locations for a given asset. **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. To use this endpoint, select **Read Equipment Statistics** under the Equipment category when creating or editing an API token. Learn More. * @summary List historical locations for a given asset * @param {AssetsApiV1getAssetLocationRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ v1getAssetLocation(requestParameters: AssetsApiV1getAssetLocationRequest, options?: RawAxiosRequestConfig): Promise>; /** * This endpoint is still on our legacy API. Fetch the reefer-specific stats of an asset. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for a given reefer * @param {AssetsApiV1getAssetReeferRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ v1getAssetReefer(requestParameters: AssetsApiV1getAssetReeferRequest, options?: RawAxiosRequestConfig): Promise>; /** * This endpoint is still on our legacy API. Fetches all reefers and reefer-specific stats. **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. To use this endpoint, select **Read Trailers** under the Trailers category when creating or editing an API token. Learn More. * @summary List stats for all reefers * @param {AssetsApiV1getAssetsReefersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ v1getAssetsReefers(requestParameters: AssetsApiV1getAssetsReefersRequest, options?: RawAxiosRequestConfig): Promise>; }