---
title: Batch import drivers
description: Creates multiple drivers in your team. The request body must
  contain an array of drivers to import.
url: /api/drivers/importDrivers
---

# Batch import drivers

`POST /drivers:import`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v1
servers:
  - url: https://api.spoke.com/public/v1
security:
  - BasicAuth: []
paths:
  /drivers:import:
    post:
      operationId: importDrivers
      summary: Batch import drivers
      tags:
        - Drivers
      description: Creates multiple drivers in your team. The request body must contain an array of drivers to import.
      requestBody:
        content:
          application/json:
            schema:
              minItems: 1
              maxItems: 50
              type: array
              items:
                type: object
                properties:
                  name:
                    description: The driver's full name
                    anyOf:
                      - type: string
                        minLength: 1
                        maxLength: 255
                      - type: "null"
                  displayName:
                    description: The name displayed for the driver in the UI
                    anyOf:
                      - type: string
                        minLength: 1
                        maxLength: 255
                      - type: "null"
                  email:
                    description: Driver's email
                    anyOf:
                      - type: string
                        minLength: 1
                        maxLength: 255
                        format: email
                        pattern: ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                      - type: "null"
                  phone:
                    description: Driver's phone number
                    anyOf:
                      - type: string
                        minLength: 1
                        maxLength: 255
                      - type: "null"
                  depots:
                    description: 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.
                    anyOf:
                      - minItems: 1
                        maxItems: 50
                        type: array
                        items:
                          type: string
                          pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
                          description: The depot ID, in the format `depots/<id>`
                      - type: "null"
                  routeOverrides:
                    description: Overrides for the driver route behavior.
                    anyOf:
                      - type: object
                        properties:
                          startAddress:
                            description: Address of a start location for every route assigned to this driver. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.
                            anyOf:
                              - type: object
                                properties:
                                  addressName:
                                    description: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 255
                                      - type: "null"
                                  addressLineOne:
                                    description: The first line of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 255
                                      - type: "null"
                                  addressLineTwo:
                                    description: The second line of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 255
                                      - type: "null"
                                  city:
                                    description: The city of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  state:
                                    description: The state of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  zip:
                                    description: The zip code of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  country:
                                    description: The country of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  latitude:
                                    description: The latitude of the address in decimal degrees.
                                    anyOf:
                                      - type: number
                                        minimum: -90
                                        maximum: 90
                                      - type: "null"
                                  longitude:
                                    description: The longitude of the address in decimal degrees.
                                    anyOf:
                                      - type: number
                                        minimum: -180
                                        maximum: 180
                                      - type: "null"
                                additionalProperties: false
                                description: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
                              - type: "null"
                          endAddress:
                            description: Address of an end location for every route assigned to this driver. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.
                            anyOf:
                              - type: object
                                properties:
                                  addressName:
                                    description: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 255
                                      - type: "null"
                                  addressLineOne:
                                    description: The first line of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 255
                                      - type: "null"
                                  addressLineTwo:
                                    description: The second line of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 255
                                      - type: "null"
                                  city:
                                    description: The city of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  state:
                                    description: The state of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  zip:
                                    description: The zip code of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  country:
                                    description: The country of the address.
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 100
                                      - type: "null"
                                  latitude:
                                    description: The latitude of the address in decimal degrees.
                                    anyOf:
                                      - type: number
                                        minimum: -90
                                        maximum: 90
                                      - type: "null"
                                  longitude:
                                    description: The longitude of the address in decimal degrees.
                                    anyOf:
                                      - type: number
                                        minimum: -180
                                        maximum: 180
                                      - type: "null"
                                additionalProperties: false
                                description: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
                              - type: "null"
                          startTime:
                            description: The start time for the driver's work day.
                            anyOf:
                              - type: object
                                properties:
                                  hour:
                                    type: integer
                                    minimum: 0
                                    maximum: 23
                                    description: Hour of the day
                                  minute:
                                    type: integer
                                    minimum: 0
                                    maximum: 59
                                    description: Minute of the hour
                                required:
                                  - hour
                                  - minute
                                additionalProperties: false
                                description: Time of day in hours and minutes. Use a 24 hour clock.
                              - type: "null"
                          endTime:
                            description: The end time for the driver's work day.
                            anyOf:
                              - type: object
                                properties:
                                  hour:
                                    type: integer
                                    minimum: 0
                                    maximum: 23
                                    description: Hour of the day
                                  minute:
                                    type: integer
                                    minimum: 0
                                    maximum: 59
                                    description: Minute of the hour
                                required:
                                  - hour
                                  - minute
                                additionalProperties: false
                                description: Time of day in hours and minutes. Use a 24 hour clock.
                              - type: "null"
                          maxStops:
                            description: The maximum number of stops that can be allocated to this driver.
                            anyOf:
                              - type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              - type: "null"
                          drivingSpeed:
                            anyOf:
                              - default: average
                                type: string
                                enum:
                                  - slower
                                  - average
                                  - faster
                                description: How fast this driver drives compared to the Team's average
                              - type: "null"
                          deliverySpeed:
                            description: How fast this driver delivers compared to the Team's average
                            anyOf:
                              - default: average
                                type: string
                                enum:
                                  - slower
                                  - average
                                  - faster
                              - type: "null"
                          vehicleType:
                            description: The type of vehicle used by this driver
                            anyOf:
                              - type: string
                                enum:
                                  - bike
                                  - scooter
                                  - car
                                  - small_truck
                                  - truck
                                  - electric_cargo_bike
                              - type: "null"
                      - type: "null"
                additionalProperties: false
                description: The request body for creating a driver. Even though `email` and `phone` are optional, you must provide exactly one of them
              description: An array of driver descriptions to be created in batch.
        description: An array of driver descriptions to be created in batch.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: array
                    items:
                      type: string
                      pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
                      description: The id of the driver, in the format `drivers/<id>`.
                    description: The ids of the successfully imported drivers
                  failed:
                    type: array
                    items:
                      type: object
                      properties:
                        error:
                          type: object
                          properties:
                            message:
                              type: string
                              description: The error that occurred during import
                          required:
                            - message
                        driver:
                          type: object
                          properties:
                            name:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 255
                                - type: "null"
                              description: The driver's full name
                            displayName:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 255
                                - type: "null"
                              description: The name displayed for the driver in the UI
                            email:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 255
                                  format: email
                                  pattern: ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                                - type: "null"
                              description: Driver's email
                            phone:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 255
                                - type: "null"
                              description: Driver's phone number
                            depots:
                              anyOf:
                                - minItems: 1
                                  maxItems: 50
                                  type: array
                                  items:
                                    type: string
                                    pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
                                    description: The depot ID, in the format `depots/<id>`
                                - type: "null"
                              description: 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:
                              anyOf:
                                - type: object
                                  properties:
                                    startAddress:
                                      anyOf:
                                        - type: object
                                          properties:
                                            addressName:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 255
                                                - type: "null"
                                              description: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
                                            addressLineOne:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 255
                                                - type: "null"
                                              description: The first line of the address.
                                            addressLineTwo:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 255
                                                - type: "null"
                                              description: The second line of the address.
                                            city:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The city of the address.
                                            state:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The state of the address.
                                            zip:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The zip code of the address.
                                            country:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The country of the address.
                                            latitude:
                                              anyOf:
                                                - type: number
                                                  minimum: -90
                                                  maximum: 90
                                                - type: "null"
                                              description: The latitude of the address in decimal degrees.
                                            longitude:
                                              anyOf:
                                                - type: number
                                                  minimum: -180
                                                  maximum: 180
                                                - type: "null"
                                              description: The longitude of the address in decimal degrees.
                                          additionalProperties: false
                                          description: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
                                        - type: "null"
                                      description: Address of a start location for every route assigned to this driver. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.
                                    endAddress:
                                      anyOf:
                                        - type: object
                                          properties:
                                            addressName:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 255
                                                - type: "null"
                                              description: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
                                            addressLineOne:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 255
                                                - type: "null"
                                              description: The first line of the address.
                                            addressLineTwo:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 255
                                                - type: "null"
                                              description: The second line of the address.
                                            city:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The city of the address.
                                            state:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The state of the address.
                                            zip:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The zip code of the address.
                                            country:
                                              anyOf:
                                                - type: string
                                                  minLength: 1
                                                  maxLength: 100
                                                - type: "null"
                                              description: The country of the address.
                                            latitude:
                                              anyOf:
                                                - type: number
                                                  minimum: -90
                                                  maximum: 90
                                                - type: "null"
                                              description: The latitude of the address in decimal degrees.
                                            longitude:
                                              anyOf:
                                                - type: number
                                                  minimum: -180
                                                  maximum: 180
                                                - type: "null"
                                              description: The longitude of the address in decimal degrees.
                                          additionalProperties: false
                                          description: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
                                        - type: "null"
                                      description: Address of an end location for every route assigned to this driver. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.
                                    startTime:
                                      anyOf:
                                        - type: object
                                          properties:
                                            hour:
                                              type: integer
                                              minimum: 0
                                              maximum: 23
                                              description: Hour of the day
                                            minute:
                                              type: integer
                                              minimum: 0
                                              maximum: 59
                                              description: Minute of the hour
                                          required:
                                            - hour
                                            - minute
                                          additionalProperties: false
                                          description: Time of day in hours and minutes. Use a 24 hour clock.
                                        - type: "null"
                                      description: The start time for the driver's work day.
                                    endTime:
                                      anyOf:
                                        - type: object
                                          properties:
                                            hour:
                                              type: integer
                                              minimum: 0
                                              maximum: 23
                                              description: Hour of the day
                                            minute:
                                              type: integer
                                              minimum: 0
                                              maximum: 59
                                              description: Minute of the hour
                                          required:
                                            - hour
                                            - minute
                                          additionalProperties: false
                                          description: Time of day in hours and minutes. Use a 24 hour clock.
                                        - type: "null"
                                      description: The end time for the driver's work day.
                                    maxStops:
                                      anyOf:
                                        - type: integer
                                          minimum: 0
                                          maximum: 9007199254740991
                                        - type: "null"
                                      description: The maximum number of stops that can be allocated to this driver.
                                    drivingSpeed:
                                      anyOf:
                                        - default: average
                                          type: string
                                          enum:
                                            - slower
                                            - average
                                            - faster
                                          description: How fast this driver drives compared to the Team's average
                                        - type: "null"
                                    deliverySpeed:
                                      anyOf:
                                        - default: average
                                          type: string
                                          enum:
                                            - slower
                                            - average
                                            - faster
                                        - type: "null"
                                      description: How fast this driver delivers compared to the Team's average
                                    vehicleType:
                                      anyOf:
                                        - type: string
                                          enum:
                                            - bike
                                            - scooter
                                            - car
                                            - small_truck
                                            - truck
                                            - electric_cargo_bike
                                        - type: "null"
                                      description: The type of vehicle used by this driver
                                - type: "null"
                          description: The request body for creating a driver. Even though `email` and `phone` are optional, you must provide at least one of
                      required:
                        - error
                        - driver
                    description: The failed drivers
                required:
                  - success
                  - failed
                description: Success
        "400":
          description: Failed to validate the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Failed to validate the request
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Unauthorized
        "422":
          description: Failed to import drivers.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    anyOf:
                      - type: string
                        enum:
                          - An error occured when importing drivers, but the error is not due to a validation error, instead it is another conflict, check if the provided data is semantically valid.
                      - type: string
                required:
                  - message
                description: Failed to import drivers.
        "500":
          description: An internal server error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: An internal server error occurred
        default:
          description: The default error model
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: The default error model
components:
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````