Skip to main content

Quick Start

Overview

Welcome to the Fleetio API docs!

Our REST API allows programmatic access to Fleetio resources (for example: Vehicles, Meter Entries, and Fuel Entries).

The sidebar on the left lists our overviews and guides. Visit the API Reference, to see a list of each API resource and available actions.

info

Sample data (eg; Vehicles) under a trial account is not accessible via the API. You'll need to create your own to test the API.

More on this here: Sample Data

Step 1: Generating an API Key

API Key Security

An API Key is a sensitive credential similar to a password. Please treat it as such.

We strongly recommend against pasting it online or committing it to a repository.

See our API Key Security guide for more information on how to safely handle API keys..

Each user account can create many API keys. API keys are used in tandem with a unique account token to authenticate requests.

To generate one, follow these steps:

  1. Once logged in to your account, navigate to the settings area for your account, you can access this from the sidebar dropdown Settings option:

Accessing settings from the dropdown

  1. Once in your account's settings area, navigate to the "Manage API Keys" page:

Accessing Manage Api Keys link

  1. Click the + Add API Key button. You can also view, revoke, and edit previously created API Keys from this page.

Add API Key button

  1. Add a label to describe how you will use it and select a version for your API key:

Add API Key example

Step 2: Set Account Token HTTP Header

Example Account Token:

Account-Token: 08765432z

You can find the account token for a particular account at the bottom of the "Manage API Keys" page. Each request to the Fleetio API requires the presence of an Account-Token HTTP header:

Account token example

Step 3: Set Authorization HTTP Header

The API Key you generated will be used as the Authorization HTTP header. Please note the word Token before the API Key.

Example API Key:

Don't forget the word Token!

Authorization: Token a43csdf3gs8gh8ifgrei823tme

Step 4: Put It All Together

You're ready to make requests to the Fleetio API using your programming tool of choice!

cURL Request Example

For your first request, try the /api/v1/users/me endpoint:

curl \
--include \
--header "Authorization: Token a43csdf3gs8gh8ifgrei823tme" \
--header "Account-Token: 08765432z" \
"https://secure.fleetio.com/api/v1/users/me"

Note that the API_KEY is preceded by the word Token. We require this because we accept multiple types of authorization methods.

{
"id": 1,
"username": "example@example.com",
"email": "example@example.com",
"time_zone_name": "Central Time (US & Canada)",
"time_zone_offset_in_seconds": -21600,
"created_at": "2022-10-01T14:05:05.907-06:00",
"updated_at": "2023-08-01T17:29:11.956-05:00",
"has_multiple_accounts": false,
"first_name": "Exampler",
"last_name": "Testington",
"default_image_url": null,
"fuel_economy_units": "mpg_us",
"contact_id": 2,
"technician": false
}

In this example, you queried the /users/me endpoint which returns useful information about the current user such as email, name, and time zone.

Fleetio API Docs Request Example

You can send a request right from the comfort of our API Reference!

Here's an example from the list Vehicles doc:

Visit our API Reference for more information on how to interact with the resources you need.