---
title: "[legacy] Get all defects"
method: GET
path: "/fleet/defects/history"
tags: ["Legacy APIs"]
---

# \[legacy\] Get all defects

`GET /fleet/defects/history`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/fleet/defects/history`
- Auth: HTTP bearer

**Note: This is a legacy endpoint, consider using [this endpoint](https://developers.samsara.com/reference/streamdefects) instead. The endpoint will continue to function as documented.** 

Returns a list of DVIR defects in an organization, filtered by creation time. The maximum time period you can query for is 30 days. 

 **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 **Read Defects** under the Maintenance 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>

## Query parameters

- `limit` integer
- `after` string
- `startTime` string, required
- `endTime` string, required
- `isResolved` boolean

## Response `200`

List of all DVIR defects in the organization

- DefectsResponse: A list of defects.
  - `data` Defect[]
    - `comment` string: Comment on the defect.
    - `createdAtTime` string: Time when the defect was created. UTC timestamp in RFC 3339 format. Example: `2020-01-27T07:06:25Z`.
    - `defectType` string: The type of DVIR defect.
    - `id` string, required: ID of the defect.
    - `isResolved` boolean, required: Signifies if this defect is resolved.
    - `mechanicNotes` string: The mechanics notes on the defect.
    - `mechanicNotesUpdatedAtTime` string: Time when mechanic notes were last updated. UTC timestamp in RFC 3339 format. Example: `2020-01-27T07:06:25Z`.
    - `resolvedAtTime` string: Time when this defect was resolved. Will not be returned if the defect is unresolved. UTC timestamp in RFC 3339 format. Example: `2020-01-27T07:06:25Z`.
    - `resolvedBy` DefectResolvedBy: The person who resolved this defect. Will not be returned if the defect is unresolved.
      - `id` string: ID of the entity that resolved this defect. If the defect was resolved by a driver, this will be a Samsara Driver ID. If the defect was resolved by a mechanic, this will be the Samsara Dashboard User ID of the mechanic.
      - `name` string: Name of the person who resolved this defect.
      - `type` 'driver' | 'mechanic': Indicates whether this defect was resolved by a `driver` or a `mechanic`.
    - `trailer` object: A minified trailer object.
      - `id` string: ID of the trailer.
      - `name` string: Name of the trailer.
    - `vehicle` object: A minified vehicle object.
      - `ExternalIds` object: The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.
      - `id` string: ID of the vehicle.
      - `name` string: Name of the vehicle.
  - `pagination` PaginationResponse: Pagination parameters.
    - `endCursor` string, string, required: Cursor identifier representing the last element in the response. This value should be used in conjunction with a subsequent request's 'after' query parameter. This may be an empty string if there are no more pages left to view.
    - `hasNextPage` boolean, required: True if there are more pages of results immediately available after this endCursor.

## Other responses

- `default`: Error response

---

[API](https://skmtc.dev/samsara/apis/samsara-api.md) - [All operations](https://skmtc.dev/samsara/apis/samsara-api/llms.txt) - [OpenAPI document](https://skmtc.dev/samsara/apis/samsara-api/revisions/a9e35d4999be?raw)
