---
title: Batch import depots
description: Batch import depots. The request body must contain an array of
  depots to import.
url: /api/depots/importDepots
---

# Batch import depots

`POST /depots:import`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v1
servers:
  - url: https://api.spoke.com/public/v1
security:
  - BasicAuth: []
paths:
  /depots:import:
    post:
      operationId: importDepots
      summary: Batch import depots
      tags:
        - Depots
      description: Batch import depots. The request body must contain an array of depots to import.
      requestBody:
        content:
          application/json:
            schema:
              minItems: 1
              maxItems: 100
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    minLength: 1
                    maxLength: 2048
                  routeOverrides:
                    type: object
                    properties:
                      startAddress:
                        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.
                      startTime:
                        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: Route start time
                      endAddress:
                        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"
                      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. Uses a 24 hour clock.
                          - type: "null"
                      defaultTimeAtStop:
                        anyOf:
                          - type: number
                            description: Estimated time at the stop
                          - type: "null"
                      maxStops:
                        anyOf:
                          - type: number
                            description: Maximum number of stops per driver
                          - type: "null"
                      vehicleType:
                        anyOf:
                          - type: string
                            enum:
                              - bike
                              - scooter
                              - car
                              - small_truck
                              - truck
                              - electric_cargo_bike
                            description: Default vehicle type
                          - type: "null"
                      roadSide:
                        anyOf:
                          - type: string
                            enum:
                              - any
                              - left_only
                              - right_only
                            description: Attempt to visit stops on this side of the road
                          - type: "null"
                      roundTrip:
                        anyOf:
                          - type: boolean
                            description: Return to the startAddress at the end of the route
                          - type: "null"
                    required:
                      - startAddress
                      - startTime
                    description: Defines some default parameters for routes originating from this depot
                required:
                  - name
                  - routeOverrides
                additionalProperties: false
              description: An array of depots to import in batch. Supports a maximum of 100 depots per request.
        description: An array of depots to import in batch. Supports a maximum of 100 depots per request.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: array
                    items:
                      type: string
                      pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
                      description: The id of the depot, in the format `depots/<id>`.
                    description: The ids of the successfully imported depots
                  failed:
                    type: array
                    items:
                      type: object
                      properties:
                        error:
                          type: object
                          properties:
                            message:
                              type: string
                              description: The error that occurred during import
                          required:
                            - message
                        depot:
                          type: object
                          properties:
                            name:
                              type: string
                              minLength: 1
                              maxLength: 2048
                            routeOverrides:
                              type: object
                              properties:
                                startAddress:
                                  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.
                                startTime:
                                  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: Route start time
                                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"
                                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. Uses a 24 hour clock.
                                    - type: "null"
                                  description: Route end time
                                defaultTimeAtStop:
                                  anyOf:
                                    - type: number
                                      description: Estimated time at the stop
                                    - type: "null"
                                maxStops:
                                  anyOf:
                                    - type: number
                                      description: Maximum number of stops per driver
                                    - type: "null"
                                vehicleType:
                                  anyOf:
                                    - type: string
                                      enum:
                                        - bike
                                        - scooter
                                        - car
                                        - small_truck
                                        - truck
                                        - electric_cargo_bike
                                      description: Default vehicle type
                                    - type: "null"
                                roadSide:
                                  anyOf:
                                    - type: string
                                      enum:
                                        - any
                                        - left_only
                                        - right_only
                                      description: Attempt to visit stops on this side of the road
                                    - type: "null"
                                roundTrip:
                                  anyOf:
                                    - type: boolean
                                      description: Return to the startAddress at the end of the route
                                    - type: "null"
                              required:
                                - startAddress
                                - startTime
                          required:
                            - name
                            - routeOverrides
                          additionalProperties: false
                          description: The depot that failed to import
                      required:
                        - error
                        - depot
                    description: The failed depots
                required:
                  - success
                  - failed
                description: Success
        "400":
          description: The request has errors. Either syntactic or semantic
          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 request has errors. Either syntactic or semantic
        "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
        "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.
````