---
title: Create a new driver
description: Create a driver with the given data in your team. Prefer using the
  [batch import endpoint](/api/v0.2b/drivers/importDrivers) for creating
  multiple drivers at once as it is more efficient, faster.
url: /api/v0.2b/drivers/createDriver
---

# Create a new driver

`POST /drivers`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v0.2b
servers:
  - url: https://api.spoke.com/public/v0.2b
security:
  - BasicAuth: []
paths:
  /drivers:
    post:
      operationId: createDriver
      summary: Create a new driver
      tags:
        - Drivers
      description: Create a driver with the given data in your team. Prefer using the [batch import endpoint](/api/v0.2b/drivers/importDrivers) for creating multiple drivers at once as it is more efficient, faster.
      requestBody:
        content:
          application/json:
            schema:
              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: The request body for creating a driver. Even though `email` and `phone` are optional, you must provide exactly one of them
      responses:
        "200":
          description: The created driver
          content:
            application/json:
              schema:
                description: The created driver
                $ref: "#/components/schemas/driverSchema"
        "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 create driver.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    anyOf:
                      - type: string
                        enum:
                          - An error occured when creating the driver, 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 create driver.
        "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:
  schemas:
    depotIdSchema:
      type: string
      pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
    driverIdSchema:
      type: string
      pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
    driverSchema:
      type: object
      properties:
        id:
          allOf:
            - $ref: "#/components/schemas/driverIdSchema"
          description: The driver id, in the format `drivers/<id>`
        name:
          description: The name of the driver.
          type:
            - "null"
            - string
        email:
          description: The email of the driver.
          type:
            - "null"
            - string
        phone:
          description: The phone number of the driver.
          type:
            - "null"
            - string
        displayName:
          description: The display name of the driver.
          type:
            - "null"
            - string
        active:
          type: boolean
          description: Whether the driver membership is active or paused. Paused drivers will not be assigned to any routes.
        depots:
          type: array
          items:
            $ref: "#/components/schemas/depotIdSchema"
          description: Depots associated with the driver.
        routeOverrides:
          type: object
          properties:
            startTime:
              anyOf:
                - $ref: "#/components/schemas/timeOfDaySchema"
                - type: "null"
              description: Driver's start time.
            endTime:
              anyOf:
                - $ref: "#/components/schemas/timeOfDaySchema"
                - type: "null"
              description: Driver's end time.
            startAddress:
              anyOf:
                - type: object
                  properties:
                    address:
                      type: string
                      description: The address of the stop.
                    addressLineOne:
                      type: string
                      description: The first line of the address.
                    addressLineTwo:
                      type: string
                      description: The second line 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.
                    placeId:
                      description: The identifier of the place corresponding to this stop on Google Places
                      type:
                        - string
                        - "null"
                    placeTypes:
                      type: array
                      items:
                        type: string
                      description: Array of strings that is provided by the Google AutoCompleteAPI
                  required:
                    - address
                    - addressLineOne
                    - addressLineTwo
                    - latitude
                    - longitude
                    - placeId
                    - placeTypes
                  additionalProperties: false
                  description: The address of the stop.
                - type: "null"
              description: Driver's start location.
            endAddress:
              anyOf:
                - type: object
                  properties:
                    address:
                      type: string
                      description: The address of the stop.
                    addressLineOne:
                      type: string
                      description: The first line of the address.
                    addressLineTwo:
                      type: string
                      description: The second line 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.
                    placeId:
                      description: The identifier of the place corresponding to this stop on Google Places
                      type:
                        - string
                        - "null"
                    placeTypes:
                      type: array
                      items:
                        type: string
                      description: Array of strings that is provided by the Google AutoCompleteAPI
                  required:
                    - address
                    - addressLineOne
                    - addressLineTwo
                    - latitude
                    - longitude
                    - placeId
                    - placeTypes
                  additionalProperties: false
                  description: The address of the stop.
                - type: "null"
              description: Driver's end location.
            maxStops:
              anyOf:
                - type: integer
                  minimum: -9007199254740991
                  maximum: 9007199254740991
                - type: "null"
              description: Maximum number of Stops the Driver can take in a route.
            drivingSpeed:
              type: string
              enum:
                - slower
                - average
                - faster
              description: The relative driving speed of the driver compared to others.
            deliverySpeed:
              type: string
              enum:
                - slower
                - average
                - faster
              description: The relative delivery speed of the driver compared to others.
            vehicleType:
              anyOf:
                - type: string
                  enum:
                    - bike
                    - scooter
                    - car
                    - small_truck
                    - truck
                    - electric_cargo_bike
                - type: "null"
              description: The vehicle type the driver will be using for deliveries.
          required:
            - startTime
            - endTime
            - startAddress
            - endAddress
            - maxStops
            - drivingSpeed
            - deliverySpeed
            - vehicleType
          description: Settings to override default route settings.
      required:
        - id
        - name
        - email
        - phone
        - displayName
        - active
        - depots
        - routeOverrides
      additionalProperties: false
      description: A driver.
    timeOfDaySchema:
      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. Uses a 24 hour clock.
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````