---
title: "Batch import drivers"
method: POST
path: "/drivers:import"
tags: ["Drivers"]
---

# Batch import drivers

`POST /drivers:import`

## Request

- Base URL: `https://api.spoke.com/public/v1`
- URL: `https://api.spoke.com/public/v1/drivers:import`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/spoke/apis/spoke-api/docs/drivers:import/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates multiple drivers in your team. The request body must contain an array of drivers to import.

## Request body

- object[]: An array of driver descriptions to be created in batch.
  - `name` string, nullable: The driver's full name
  - `displayName` string, nullable: The name displayed for the driver in the UI
  - `email` string, email, nullable: Driver's email
  - `phone` string, nullable: Driver's phone number
  - `depots` string[], nullable: The depot IDs associated with the driver in the format `depots/<id>`, duplicates will be ignored. If set to null or not provided, the team's Main depot will be set as driver depot.
  - `routeOverrides` object, nullable: Overrides for the driver route behavior.
    - `startAddress` object, nullable: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
      - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
      - `addressLineOne` string, nullable: The first line of the address.
      - `addressLineTwo` string, nullable: The second line of the address.
      - `city` string, nullable: The city of the address.
      - `state` string, nullable: The state of the address.
      - `zip` string, nullable: The zip code of the address.
      - `country` string, nullable: The country of the address.
      - `latitude` number, nullable: The latitude of the address in decimal degrees.
      - `longitude` number, nullable: The longitude of the address in decimal degrees.
    - `endAddress` object, nullable: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
      - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
      - `addressLineOne` string, nullable: The first line of the address.
      - `addressLineTwo` string, nullable: The second line of the address.
      - `city` string, nullable: The city of the address.
      - `state` string, nullable: The state of the address.
      - `zip` string, nullable: The zip code of the address.
      - `country` string, nullable: The country of the address.
      - `latitude` number, nullable: The latitude of the address in decimal degrees.
      - `longitude` number, nullable: The longitude of the address in decimal degrees.
    - `startTime` object, nullable: Time of day in hours and minutes. Use a 24 hour clock.
      - `hour` integer, required: Hour of the day
      - `minute` integer, required: Minute of the hour
    - `endTime` object, nullable: Time of day in hours and minutes. Use a 24 hour clock.
      - `hour` integer, required: Hour of the day
      - `minute` integer, required: Minute of the hour
    - `maxStops` integer, nullable: The maximum number of stops that can be allocated to this driver.
    - `drivingSpeed` 'slower' | 'average' | 'faster', nullable: How fast this driver drives compared to the Team's average
    - `deliverySpeed` 'slower' | 'average' | 'faster', nullable: How fast this driver delivers compared to the Team's average
    - `vehicleType` 'bike' | 'scooter' | 'car' | 'small_truck' | 'truck' | 'electric_cargo_bike', nullable: The type of vehicle used by this driver

## Response `200`

Success

- object: Success
  - `success` string[], required: The ids of the successfully imported drivers
  - `failed` object[], required: The failed drivers
    - `error` object, required
      - `message` string, required: The error that occurred during import
    - `driver` object, required: The request body for creating a driver. Even though `email` and `phone` are optional, you must provide at least one of
      - `name` string, nullable: The driver's full name
      - `displayName` string, nullable: The name displayed for the driver in the UI
      - `email` string, email, nullable: Driver's email
      - `phone` string, nullable: Driver's phone number
      - `depots` string[], nullable: The depot IDs associated with the driver in the format `depots/<id>`, duplicates will be ignored. If set to null or not provided, the team's Main depot will be set as driver depot.
      - `routeOverrides` object, nullable
        - `startAddress` object, nullable: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
          - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
          - `addressLineOne` string, nullable: The first line of the address.
          - `addressLineTwo` string, nullable: The second line of the address.
          - `city` string, nullable: The city of the address.
          - `state` string, nullable: The state of the address.
          - `zip` string, nullable: The zip code of the address.
          - `country` string, nullable: The country of the address.
          - `latitude` number, nullable: The latitude of the address in decimal degrees.
          - `longitude` number, nullable: The longitude of the address in decimal degrees.
        - `endAddress` object, nullable: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
          - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
          - `addressLineOne` string, nullable: The first line of the address.
          - `addressLineTwo` string, nullable: The second line of the address.
          - `city` string, nullable: The city of the address.
          - `state` string, nullable: The state of the address.
          - `zip` string, nullable: The zip code of the address.
          - `country` string, nullable: The country of the address.
          - `latitude` number, nullable: The latitude of the address in decimal degrees.
          - `longitude` number, nullable: The longitude of the address in decimal degrees.
        - `startTime` object, nullable: Time of day in hours and minutes. Use a 24 hour clock.
          - `hour` integer, required: Hour of the day
          - `minute` integer, required: Minute of the hour
        - `endTime` object, nullable: Time of day in hours and minutes. Use a 24 hour clock.
          - `hour` integer, required: Hour of the day
          - `minute` integer, required: Minute of the hour
        - `maxStops` integer, nullable: The maximum number of stops that can be allocated to this driver.
        - `drivingSpeed` 'slower' | 'average' | 'faster', nullable: How fast this driver drives compared to the Team's average
        - `deliverySpeed` 'slower' | 'average' | 'faster', nullable: How fast this driver delivers compared to the Team's average
        - `vehicleType` 'bike' | 'scooter' | 'car' | 'small_truck' | 'truck' | 'electric_cargo_bike', nullable: The type of vehicle used by this driver

## Other responses

- `400`: Failed to validate the request
- `401`: Unauthorized
- `422`: Failed to import drivers.
- `500`: An internal server error occurred
- `default`: The default error model

---

[API](https://skmtc.dev/spoke/apis/spoke-api.md) - [All operations](https://skmtc.dev/spoke/apis/spoke-api/llms.txt) - [OpenAPI document](https://skmtc.dev/spoke/apis/spoke-api/revisions/a09d9194ae1c?raw)
