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.

User

GET /users/{userId}/quote Fleet availability and pricing

This is similar to the vehicle quote API, but returns pricing and availability for all vehicles owned by the given user ID.

Example URI

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

URI Parameters

userId

string  (required)

ID of vehicle

start

string  (required)

Start date and time. Use a well-known format like ISO-8601.

end

string  (required)

End date and time. Use a well-known format like ISO-8601.

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

Each booking is tied to a unique vehicle. Use these API endpoints to interact with a specific vehicle.

GET /vehicles/{vehicleId} Get details

Get vehicle information.

Example URI

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

URI Parameters

vehicleId

string  (required)

ID of vehicle

Vehicle quote

GET /vehicles/{vehicleId}/quote Get quote

Use this endpoint to get a price (and availability) for a booking with the given start and end times.

Check the conflicts array for any issues (e.g. conflicting bookings, violation of owner booking preferences). A booking can only be made for the given dates if there are no conflicts.

Example URI

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

URI Parameters

vehicleId

string  (required)

ID of vehicle

start

string  (required)

Start date and time. Use a well-known format like ISO-8601.

end

string  (required)

End date and time. Use a well-known format like ISO-8601.