Create a fuel purchase transaction.
Rate limit: 100 requests/min (learn more about rate limits here).
To use this endpoint, select Write Fuel Purchase under the Fuel & Energy 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.
curl --request POST \
--url https://api.samsara.com/fuel-purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fuelQuantityLiters": "676.8",
"transactionLocation": "350 Rhode Island St, San Francisco, CA 94103",
"transactionPrice": {
"amount": "640.2",
"currency": "usd"
},
"transactionReference": "5454534",
"transactionTime": "2022-07-13T14:20:50.52-07:00",
"driverId": "1234",
"fuelGrade": "Regular",
"iftaFuelType": "Biodiesel",
"merchantName": "Shell",
"source": "Shell Integration",
"vehicleId": "281474900488527"
}
'{
"data": {
"uuid": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7"
}
}Documentation Index
Fetch the complete documentation index at: https://samsara-showcase.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Request payload for creating a new fuel purchase transaction.
The amount of fuel purchased in liters.
"676.8"
The full street address for the location of the fuel transaction, as it might be recognized by Google Maps. Ideal entries should be in accordance with the format used by the national postal service of the country concerned (example: 1 De Haro St, San Francisco, CA 94107, United States). Alternatively, exact latitude/longitude can be provided (example: 40.748441, -73.985664).
"350 Rhode Island St, San Francisco, CA 94103"
The price of the fuel transaction in the currency of the country where the transaction occurred.
Show child attributes
The fuel transaction reference. This is the transaction identifier. For instance, this can be the Serial Number on the invoice.
1 - 32^[a-zA-Z0-9\-]+$"5454534"
The time of the fuel transaction in RFC 3339 format. Timezone must be specified. For example, 2022-07-13T14:20:50.52-07:00 is a time in Pacific Daylight Time.
"2022-07-13T14:20:50.52-07:00"
The amount of money discounted from the gross purchase price of the fuel transaction in the currency of the country where the transaction occurred.
Show child attributes
Samsara ID of the driver that purchased the fuel.
"1234"
The grade of the fuel purchased. Valid values: Unknown, Regular, Premium
Unknown, Regular, Premium "Regular"
The type of fuel purchased supported by IFTA. Valid values: Unspecified, A55, Biodiesel, CompressedNaturalGas, Diesel, E85, Electricity, Ethanol, Gasohol, Gasoline, Hydrogen, LiquifiedNaturalGas, M85, Methanol, Propane, Other
Unspecified, A55, Biodiesel, CompressedNaturalGas, Diesel, E85, Electricity, Ethanol, Gasohol, Gasoline, Hydrogen, LiquifiedNaturalGas, M85, Methanol, Propane, Other "Biodiesel"
Brand name of the fuel station the fuel was purchased at. For example: Shell, Bp, Exxon.
"Shell"
The integration provider. For example: Customer, Shell Integration
"Shell Integration"
Samsara ID of the vehicle that purchased the fuel.
"281474900488527"
OK response.
Response after successfully adding a Fuel Purchase transaction
Show child attributes
curl --request POST \
--url https://api.samsara.com/fuel-purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fuelQuantityLiters": "676.8",
"transactionLocation": "350 Rhode Island St, San Francisco, CA 94103",
"transactionPrice": {
"amount": "640.2",
"currency": "usd"
},
"transactionReference": "5454534",
"transactionTime": "2022-07-13T14:20:50.52-07:00",
"driverId": "1234",
"fuelGrade": "Regular",
"iftaFuelType": "Biodiesel",
"merchantName": "Shell",
"source": "Shell Integration",
"vehicleId": "281474900488527"
}
'{
"data": {
"uuid": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7"
}
}