Documentation

Getting started

The API is public, so it's easy to jump in and get started with a basic set of data. If you're looking for more data, then simply sign-up in order to be able to authenticate your requests. You'll then have access to a broader set of data. If you want to load media or more extensive data, then that can be arranged, drop us a line.

Access levels

AccessDataMonthly request limit
PublicRestrictedn/a
RegisteredStandard100
FullFull1000

Routes

The following routes are available to load data from.

/vehicles

Returns all vehicles in the database as an array of Vehicle Objects.

URL

Route: https://v1.api.leccy.net/vehicles
Method: GET or POST

Options

The following values are supported as query string parameters.

NameDescriptionSupported valuesDefault
statusFilters results by the status of the vehicle.all, current, future, discontinuedall
typeFilters results by the vehicle type.all, car, truck, vanall
manufacturerFilters results to a specific manufacturer.Any value present in the dataset, e.g: teslaall
distanceThe distance units to return from the dataset.imperial (miles), metric (kilometers)imperial
sortSorts the results by a data attribute.name, rangename
orderOrders or the returned results.asc, descasc
tokenA valid JWT for a registered api.leccy.net user, if provided it will increase the amount of data returned.A JSON web token.undefined

/vehicles/{id}

Returns a vehicle based on its leccy.net ID.

URL

Route: https://v1.api.leccy.net/vehicles/{ID}
Method: GET or POST

Options

The following values are supported as query string parameters.

NameDescriptionSupported valuesDefault
distanceThe distance units to return from the dataset.imperial (miles), metric (kilometers)imperial
tokenA valid JWT for a registered api.leccy.net user, if provided it will increase the amount of data returned.A JSON web token.undefined

/auth

Allows sign-in to the Leccy.net API using an account registered at api.leccy.net. The response will provide a JWT to use authenticate against API data requests.

URL

Route: https://v1.api.leccy.net/auth
Method: GET or POST

Options

The following values are supported as query string parameters.

NameDescription
emailThe email address used when registering an api.leccy.net account.
passwordThe corresponding password for the api.leccy.net account.

/auth/refresh

Generates a new JWT from a given refresh token.

URL

Route: https://v1.api.leccy.net/auth/refresh
Method: GET or POST

Options

The following values are supported as query string parameters.

NameDescription
refreshTokenThe refresh token (originally provided as part of authentication).

/user/requestCount

Returns the total number of requests a given user has made in the current month, along with daily statistics.

URL

Route: https://v1.api.leccy.net/user/requestCount
Method: GET or POST

Options

The following values are supported as query string parameters.

NameDescription
tokenA valid JWT for a registered api.leccy.net user.

Messages

Vehicle Object

A Vehicle Object represents a vehicle.

KeyTypeDescriptionAccess
idstringThe Leccy.net ID of the vehicle.Public
namestringThe name of the vehicle.Public
manufacturerstringThe manufacturer of the vehicle.Public
statusstringThe status of the vehicle.Public
typestringThe type of vehicle.Public
rangeobjectA Min-Max Object showing the minimum and maximum reported ranges of variants of this vehicle. Note that as some datasets include multiple reported range tests, priority is given in the following order: WLTP, EPA, NEDC and Estimated.Public
seatsobjectA Min-Max Object showing the minimum and maximum number of seats available in variants of this vehicle.Public
variantsarrayAn array of Vehicle Variant ObjectsRegistered

Example

{
  "id": 3538,
  "name": "Tesla Model 3",
  "manufacturer": "Tesla",
  "status": "current",
  "type": "car",
  "range": {
    "min": 381,
    "max": 600
  },
  "seats": {
    "min": 5,
    "max": 5
  },
  "variants": []
}

Vehicle Variant Object

A Vehicle Variant Object represents a specific version of a vehicle.

Format

KeyTypeDescriptionAccess
idintegerThe Leccy.net ID of the vehicle variant.Registered
namestringThe name of the vehicle variant.Registered
yearintegerThe year that the vehicle variant was released.Registered
rangeobjectA Range Object representing the range of the vehicle.Registered

Example

{
  "id": 1930,
  "name": "Performance",
  "year": 2021,
  "range": {
    "wltp": 352
  }
}

Range Object

A Range Object provides data representing the expected range of a vehicle. Not all of the various testing standards may be available for any given vehicle.

Format

KeyTypeDescription
wltpintegerThe reported WLTP range for the vehicle.
epaintegerThe reported EPA range for the vehicle.
nedcintegerThe reported NEDC range for the vehicle.
estintegerAn estimated range for the vehicle (normally a value reported by a manufacturer before a vehicle is tested for release).

Example

{
  "wltp": 100,
  "epa": 110,
  "nedc": 120,
  "est": 100
}

Min-Max Object

A Min-Max Object is a simple object containing a minimum and maximum value for a given dataset.

Format

KeyTypeDescription
minintegerThe lowest number in the given data.
maxintegerThe highest number in the given data.

Example


{
  "min": 250,
  "max": 500
}

Request Count Object

A Request Count Object provides information about the requests a user has made in the current month.

Format

KeyTypeDescriptionAccess
totalintegerThe total number of requests the user has made.Private
daysarrayAn array of objects containing the date and requests - (the number of requests made on the date).Private

Example

  {
    "total": 123,
    "days": [
      {
        "date": "2021-09-01",
        "requests": 60
      },
      {
        "date": "2021-09-02",
        "requests": 63
      }
      ...
  }