Yourdrive API

Basic API specification for users and user bookings.

Authentication

Login

POST /login Generate a JWT

Generate a JWT.

Example URI

POST https://api.yourdrive.co.nz/login

URI Parameters

email

string  (required)

User's email address

password

string  (required)

User's password

Logout

POST /logout Revoke a JWT

Revoke a JWT.

Example URI

POST https://api.yourdrive.co.nz/logout

URI Parameters

token

string  (required)

JWT to be revoked

Refresh

POST /refresh Refresh a JWT

A JWT that's less than 2 weeks old can be refreshed.

Example URI

POST https://api.yourdrive.co.nz/refresh

URI Parameters

token

string  (required)

JWT to be refreshed

Users

Owner bookings

GET /users/{userId}/bookings-as-owner List owner bookings

Get a list of bookings where the user is the vehicle owner.

Example URI

GET https://api.yourdrive.co.nz/users/userId/bookings-as-owner

URI Parameters

userId

string  (required)

User ID. You can use me as a short-hand to fetch information for the logged-in account.

Owner booking

GET /users/{userId}/bookings-as-owner/{reference} Get owner booking

Get a single booking where the user is the vehicle owner.

Example URI

GET https://api.yourdrive.co.nz/users/userId/bookings-as-owner/reference

URI Parameters

userId

string  (required)

User ID. You can use me as a short-hand to fetch information for the logged-in account.

reference

string  (required)

Booking reference.

Renter bookings

GET /users/{userId}/bookings-as-renter List renter bookings

Get a list of booking requests made by the user. These are sometimes referred to as "trips".

Example URI

GET https://api.yourdrive.co.nz/users/userId/bookings-as-renter

URI Parameters

userId

string  (required)

User ID. You can use me as a short-hand to fetch information for the logged-in account.

Renter booking

GET /users/{userId}/bookings-as-renter/{reference} Get renter booking

Get a single booking made by the user (renter). This is sometimes referred to as a "trip".

Example URI

GET https://api.yourdrive.co.nz/users/userId/bookings-as-renter/reference

URI Parameters

userId

string  (required)

User ID. You can use me as a short-hand to fetch information for the logged-in account.

reference

string  (required)

Booking reference.

User

GET /users/{userId} Find user by ID

Get a user details by their ID. Depending on the user that is requesting the information some information may be hidden, notably:

  • Last name may be a single character (e.g. "P" instead of "Pearse").

  • Phone number may be null (e.g. null instead of "+6423456789").

  • Aggregate statistics (view counts, earnings, lost earnings) may be null.

Example URI

GET https://api.yourdrive.co.nz/users/userId

URI Parameters

userId

string  (required)

ID of user to return. You can use me as a short-hand to fetch information for the logged-in account.

Trips

User Trips

A Trip is a booking initiated by the user (i.e. the user is the renter in the booking).

GET /users/{userId}/trips User's trips

Get all trips booked by a user.

Example URI

GET https://api.yourdrive.co.nz/users/userId/trips

URI Parameters

userId

string  (required)

ID of user

Insurance

Insurance details

Renters can choose from a number of different insurance options for cover on their booking.

GET /insurances/{insuranceId} Insurance details

This endpoint returns information for a specific insurance option.

Example URI

GET https://api.yourdrive.co.nz/insurances/insuranceId

URI Parameters

insuranceId

string  (required)

ID of insurance option

Vehicles

Vehicle details

Renters can choose from a number of different insurance options for cover on their booking.

GET /vehicles/{vehicleId} Vehicle details

Get vehicle information.

Example URI

GET https://api.yourdrive.co.nz/vehicles/vehicleId

URI Parameters

vehicleId

string  (required)

ID of vehicle