---
agentTools:
  projectIndex: https://developer-docs.gomotive.com/llms.txt
---

# View the fuel purchases by an ID

**Purpose**: Use this API to find out the fuel purchases by entering its ID.

> 📘 NOTE
>
> You must specify the ID of the fuel purchase transactions as a path parameter. Refer to the Path Parameter section for more info.

## OAuth Token

```ruby Ruby (OAuth 2.)
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

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
* **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
* **Description**: The URL where the receipt can be downloaded.

### receipt\_filename

* **Type**: String
* **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.

***

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Motive",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.gomotive.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/fuel_purchases/{id}": {
      "get": {
        "summary": "View the fuel purchases by an ID",
        "description": "",
        "operationId": "view-the-fuel-purchases-by-an-id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Specify the ID of the fuel purchase transaction to view its details.",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "View the fuel purchases by ID": {
                    "value": "  {\n  \"fuel_purchase\": {\n    \"id\": 684,\n    \"offline_id\": \"0053ddeb-2869-4918-8c2d-db7b8d3521f7\",\n    \"purchased_at\": \"2018-06-13T18:43:00Z\",\n    \"jurisdiction\": \"AL\",\n    \"fuel_type\": \"diesel\",\n    \"ref_no\": \"\",\n    \"vendor\": \"\",\n    \"total_cost\": 321,\n    \"currency\": \"USD\",\n    \"fuel\": 12,\n    \"fuel_unit\": \"gal\",\n    \"odometer\": null,\n    \"odometer_unit\": \"mi\",\n    \"receipt_upload_url\": null,\n    \"receipt_filename\": null,\n    \"uploader\": {\n      \"id\": 8011,\n      \"first_name\": \"Uploader\",\n      \"last_name\": \"Test\",\n      \"email\": \"uploader@keeptruckin.com\",\n      \"role\": \"dispatcher\",\n      \"deactivated_at\": null\n    },\n    \"vehicle\": {\n      \"id\": 4116,\n      \"number\": \"Jason's Vehicle\",\n      \"year\": \"\",\n      \"make\": \"\",\n      \"model\": \"\",\n      \"vin\": \"\",\n      \"metric_units\": false\n    },\n    \"driver\": {\n      \"id\": 2463,\n      \"first_name\": \"Paul\",\n      \"last_name\": \"Walker\",\n      \"username\": \"paul\",\n      \"email\": \"demo@keeptruckin.com\",\n      \"driver_company_id\": null,\n      \"status\": \"active\",\n      \"role\": \"driver\"\n    }\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "fuel_purchase": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": 684,
                          "default": 0
                        },
                        "offline_id": {
                          "type": "string",
                          "example": "0053ddeb-2869-4918-8c2d-db7b8d3521f7"
                        },
                        "purchased_at": {
                          "type": "string",
                          "example": "2018-06-13T18:43:00Z"
                        },
                        "jurisdiction": {
                          "type": "string",
                          "example": "AL"
                        },
                        "fuel_type": {
                          "type": "string",
                          "example": "diesel"
                        },
                        "ref_no": {
                          "type": "string",
                          "example": ""
                        },
                        "vendor": {
                          "type": "string",
                          "example": ""
                        },
                        "total_cost": {
                          "type": "integer",
                          "example": 321,
                          "default": 0
                        },
                        "currency": {
                          "type": "string",
                          "example": "USD"
                        },
                        "fuel": {
                          "type": "integer",
                          "example": 12,
                          "default": 0
                        },
                        "fuel_unit": {
                          "type": "string",
                          "example": "gal"
                        },
                        "odometer": {},
                        "odometer_unit": {
                          "type": "string",
                          "example": "mi"
                        },
                        "receipt_upload_url": {},
                        "receipt_filename": {},
                        "uploader": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "example": 8011,
                              "default": 0
                            },
                            "first_name": {
                              "type": "string",
                              "example": "Uploader"
                            },
                            "last_name": {
                              "type": "string",
                              "example": "Test"
                            },
                            "email": {
                              "type": "string",
                              "example": "uploader@keeptruckin.com"
                            },
                            "role": {
                              "type": "string",
                              "example": "dispatcher"
                            },
                            "deactivated_at": {}
                          }
                        },
                        "vehicle": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "example": 4116,
                              "default": 0
                            },
                            "number": {
                              "type": "string",
                              "example": "Jason's Vehicle"
                            },
                            "year": {
                              "type": "string",
                              "example": ""
                            },
                            "make": {
                              "type": "string",
                              "example": ""
                            },
                            "model": {
                              "type": "string",
                              "example": ""
                            },
                            "vin": {
                              "type": "string",
                              "example": ""
                            },
                            "metric_units": {
                              "type": "boolean",
                              "example": false,
                              "default": true
                            }
                          }
                        },
                        "driver": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "example": 2463,
                              "default": 0
                            },
                            "first_name": {
                              "type": "string",
                              "example": "Paul"
                            },
                            "last_name": {
                              "type": "string",
                              "example": "Walker"
                            },
                            "username": {
                              "type": "string",
                              "example": "paul"
                            },
                            "email": {
                              "type": "string",
                              "example": "demo@keeptruckin.com"
                            },
                            "driver_company_id": {},
                            "status": {
                              "type": "string",
                              "example": "active"
                            },
                            "role": {
                              "type": "string",
                              "example": "driver"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Invalid ID": {
                    "value": "{\n  \"error_message\": \"fuel_purchase not found\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error_message": {
                      "type": "string",
                      "example": "fuel_purchase not found"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "66acf64a829e88001980fbf2:66cccf86c406a6004670205c"
}
```