---
title: "Create a job to generate csv files of IFTA mileage segments."
method: POST
path: "/ifta-detail/csv"
tags: ["IFTA"]
---

# Create a job to generate csv files of IFTA mileage segments.

`POST /ifta-detail/csv`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/ifta-detail/csv`
- Auth: HTTP bearer

Create a job to generate csv files of IFTA mileage segments.

 <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 IFTA (US)** under the Compliance 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.

## Request body

- IFTACreateIftaDetailJobRequestBody: The payload to create a new IftaDetailJob.
  - `endHour` string, required: An end time in RFC 3339 format. Hour precision and timezones are supported. Any minutes or seconds will be truncated down to the nearest hour. Note that the most recent 72 hours of data may still be processing and is subject to change and latency, so it is not recommended to request data for the most recent 72 hours. The maximum request duration is 1 month. Limit the number of vehicles to 1000 when requesting more than 24 hours of data. (Examples: 2019-06-13T19:00:00Z, 2019-06-13T19:00:00.000Z, OR 2015-09-15T14:00:00-04:00).
  - `startHour` string, required: A start time in RFC 3339 format. Hour precision and timezones are supported. Any minutes or seconds will be truncated down to the nearest hour. Note that the most recent 72 hours of data may still be processing and is subject to change and latency, so it is not recommended to request data for the most recent 72 hours. The maximum request duration is 1 month. Limit the number of vehicles to 1000 when requesting more than 24 hours of data. (Examples: 2019-06-13T19:00:00Z, 2019-06-13T19:00:00.000Z, OR 2015-09-15T14:00:00-04:00).
  - `vehicleIds` string: A filter on the data based on this comma-separated list of vehicle IDs and external IDs. The number of vehicles requested per job shouldn't exceed 5000. Example: `vehicleIds: '1234,5678,samsara.vin:1HGBH41JXMN109186'`
  - `vehicleParentTagIds` string: A filter on the data based on this comma-separated list of vehicle parent tag IDs. The number of vehicles requested per job shouldn't exceed 5000. Example: `vehicleParentTagIds: '1234,5678'`
  - `vehicleTagIds` string: A filter on the data based on this comma-separated list of vehicle tag IDs. The number of vehicles requested per job shouldn't exceed 5000. Example: `vehicleTagIds: '1234,5678'`

## Response `201`

Created response.

- IFTACreateIftaDetailJobResponseBody
  - `data` IftaDetailJobResponseBody, required: A job representing the async generation of IFTA mileage segments. The job should be polled until the state is terminal.
    - `args` IftaDetailJobArgsResponseBody, required: The arguments used to create this job.
      - `endHour` string, required: The `endHour` used to create this job.
      - `startHour` string, required: The `startHour` used to create this job.
      - `vehicleIds` integer[], required: The vehicleIds used to create this job. Determined by the filter list of `vehicleIds`, `vehicleTagIds`, and `vehicleParentTagIds` parameters (if provided).
    - `completedAtTime` string: The time this job completed successfully.
    - `details` string: A message containing additional details about the job, if available.
    - `failedAtTime` string: The time this job failed.
    - `files` IftaDetailJobOutputResponseBody[]: A list of files generated by this job. This field will be omitted when the job status is "Failed" or no data exists with the provided job arguments. Read about the file structure [here](https://developers.samsara.com/docs/ifta-detail-csv).
      - `createdAtTime` string, required: When this file was created.
      - `downloadUrl` string, required: A url to download the generated file. The contents will be gzipped. This url has an expiration and will no longer be valid after expiration.
      - `downloadUrlExpirationTime` string, required: The expiration time of this file's download url. Requesting this job again by ID will refresh the download urls, if expired.
      - `name` string, required: The name of this file.
      - `recordCount` integer, required: The number of records in this file.
    - `jobId` string, required: The ID used to retrieve this job.
    - `jobStatus` 'Requested' | 'Processing' | 'Completed' | 'Failed', required: The status of this job. `jobStatus` can be one of Requested, Processing, Completed, or Failed. Valid values: `Requested`, `Processing`, `Completed`, `Failed`
    - `requestedAtTime` string, required: The time this job was requested for creation.
    - `startedAtTime` string: The time this job started processing.

## Other responses

- `401`: Unauthorized response.
- `404`: Not Found response.
- `405`: Method Not Allowed response.
- `413`: Content Too Large response.
- `429`: Too Many Requests response.
- `500`: Internal Server Error response.
- `501`: Not Implemented response.
- `502`: Bad Gateway response.
- `503`: Service Unavailable response.
- `504`: Gateway Timeout response.
- `default`: Bad Request 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)
