Getting Started

Spare authenticates your API requests using your account's API keys. If you do not include your key when making an API request, or use one that is incorrect or outdated, Spare returns an error.

By now you should have received administrator login credentials for Spare Platform (https://platform.sparelabs.com). Access Spare Platform will enable you to set up your test organization, manage your testing environment, and test your application using the various service types within the Spare Platform.

Before you can implement server-side authentication, you will need to create API Keys for your applications. API Keys can be generated in the Administrative Panel under Organization Settings.

<aside> ⚠️ Do not expose your Spare API key to client side applications.

</aside>

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Authentication to the API from the server side is performed via your Secret API Key.

To authenticate use header: Authorization: Bearer <secret-api-key>

Your API Keys are always available in your organization. If you have any questions, consult the Spare Platform User Guide (sparelabs.com/userguide) or contact us!

Setting up a Testing Environment

Before ride requests can be made using the Rides API, you will need to set up a testing environment. Take the following steps to quickly set up a testing environment:

  1. Create Service - Create a service under the services pane.
  2. Create Driver - You can create one in the drivers pane. If you would like this driver to be able to drive unscheduled using an Accept Reject fleet, then make sure you assign this fleet to the driver. Once the driver is created, they will be sent an email. Confirm this email and set a password online. Then you may login with the driver account in the Spare Driver app.
  3. Create Vehicle - You can create a vehicle in the vehicles pane.
  4. Create Duty - Duties are essentially driver shifts. Spare uses duties to understand the available vehicle supply in the system. Duties are created through the duty pane and must be assigned to a service, driver, and vehicle. If you would like to do tests without using the driver app, you can create a duty that starts in the past and ends some time in the future. Spare will match against this duty. To complete passenger trips and see live vehicle tracking, log in to the Spare Driver app with your driver’s credentials and start the duty.