Create a new fuel purchase transaction

Purpose: Use this API to create a new fuel purchase transaction. This allows you to capture and track costs associated with the fuel purchases of your company and helps in managing such expenses.

📘

NOTE

You must provide necessary details such as:

  • Vehicle ID
  • Driver ID
  • Jurisdiction
  • Fuel Type and others

Refer to the Body Parameters section for more info.

OAuth Token

require 'uri'
require 'net/http'
require 'json'

url = URI('https://api.gomotive.com/v1/fuel_purchases')

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
  :vehicle_id   => 1,
  :driver_id    => 2,
  :purchased_at => '2019-04-23',
  :jurisdiction => 'AL',
  :fuel_type    => 'diesel',
  :fuel         => 12,
  :fuel_unit    => 'gal'
}
request.body = params.to_json

response = http.request(request)
puts response.read_body

Response Parameters

id

  • Type: Integer
  • Description: The unique identifier for the fuel purchase.

offline_id

  • Type: String
  • Description: The offline identifier associated with the fuel purchase.

purchased_at

  • Type: String (DateTime)
  • Description: The date and time when the fuel was purchased.

jurisdiction

  • Type: String
  • Description: The jurisdiction where the fuel purchase occurred (e.g., state or region code).

fuel_type

  • Type: String
  • Description: The type of fuel purchased (e.g., diesel).

ref_no

  • Type: String
  • Description: The reference number for the fuel purchase.

vendor

  • Type: String
  • Description: The vendor from whom the fuel was purchased.

total_cost

  • Type: Integer
  • Description: The total cost of the fuel purchase.

currency

  • Type: String
  • Description: The currency used for the purchase (e.g., USD).

fuel

  • Type: Integer
  • Description: The amount of fuel purchased.

fuel_unit

  • Type: String
  • Description: The unit of measurement for the fuel (e.g., gal).

odometer

  • Type: Integer or Null
  • Description: The odometer reading at the time of fuel purchase.

odometer_unit

  • Type: String
  • Description: The unit of measurement for the odometer (e.g., mi).

receipt_upload_url

  • Type: String or Null
  • Description: The URL where the receipt can be downloaded.

receipt_filename

  • Type: String or Null
  • Description: The filename of the receipt.

uploader

  • Type: Object
  • Description: Information about the person who uploaded the fuel purchase.
    • id: Integer — The unique identifier of the uploader.
    • first_name: String — The first name of the uploader.
    • last_name: String — The last name of the uploader.
    • email: String — The email address of the uploader.
    • role: String — The role of the uploader.
    • deactivated_at: String or Null — The date and time when the uploader was deactivated.

vehicle

  • Type: Object
  • Description: Information about the vehicle associated with the fuel purchase.
    • id: Integer — The unique identifier of the vehicle.
    • number: String — The vehicle number.
    • year: String — The year of the vehicle.
    • make: String — The make of the vehicle.
    • model: String — The model of the vehicle.
    • vin: String — The Vehicle Identification Number.
    • metric_units: Boolean — Indicates if the vehicle uses metric units.

driver

  • Type: Object
  • Description: Information about the driver associated with the fuel purchase.
    • id: Integer — The unique identifier of the driver.
    • first_name: String — The first name of the driver.
    • last_name: String — The last name of the driver.
    • username: String — The username of the driver.
    • email: String — The email address of the driver.
    • driver_company_id: String or Null — The ID of the driver's company.
    • status: String — The status of the driver (e.g., active).
    • role: String — The role of the driver.

Query Params
string

This is the payment source of the current fuel purchase. Allowed values are as follows:

  • EFS_INTEGRATION
  • COMDATA_INTEGRATION
  • WEX_INTEGRATION
  • Manual
  • Motive Card
  • GIR (GIR W150 Fuel Management System)
  • fluidsecure-integration
  • fleetcor-integration

Body Params
int32
required

Specify the ID of the vehicle for which you want to create a new fuel purchase.

int32
required

Specify the ID of the driver.

date
required

Specify the time at which the fuel was purchased.

string
required

Specify the jurisdiction from where the fuel was purchased at.

string
required

Specify the type of the fuel that was purchased. Allowed values are: ['diesel', 'gasoline', 'propane', 'lng', 'cng', 'ethanol', 'methanol', 'e85', 'm85', 'a55', 'biodiesel', 'other']

string

Specify the total cost of the fuel purchase.

string

Specify the currency in which the fuel was purchased. Allowed values are USD or CAD.

string
required

Specify the total amount of the fuel purchased.

string
required

Specify the units of the fuel. Allowed values are gal for Gallons, or ltr for Litres.

string

Specify the reference number of the fuel purchase.

string

Enter the name of the fuel vendor.

int32

Mention the Odometer reading at the time of the fuel purchase.

string

Specify the units of the odometer at the time of the fuel purchase. Allowed values are: KM for Kilometres, or MI for Miles.

receipt
array of strings

Specify the URL of the location where the receipt is uploaded.

receipt
string

Specify the location of the fuel purchase.

Responses

Language
Credentials
Header
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json