---
title: "Batch import depots"
method: POST
path: "/depots:import"
tags: ["Depots"]
---

# Batch import depots

`POST /depots:import`

## Request

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

Batch import depots. The request body must contain an array of depots to import.

## Request body

- object[]: An array of depots to import in batch. Supports a maximum of 100 depots per request.
  - `name` string, required
  - `routeOverrides` object, required: Defines some default parameters for routes originating from this depot
    - `startAddress` object, required: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
      - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
      - `addressLineOne` string, nullable: The first line of the address.
      - `addressLineTwo` string, nullable: The second line of the address.
      - `city` string, nullable: The city of the address.
      - `state` string, nullable: The state of the address.
      - `zip` string, nullable: The zip code of the address.
      - `country` string, nullable: The country of the address.
      - `latitude` number, nullable: The latitude of the address in decimal degrees.
      - `longitude` number, nullable: The longitude of the address in decimal degrees.
    - `startTime` object, required: Route start time
      - `hour` integer, required: Hour of the day
      - `minute` integer, required: Minute of the hour
    - `endAddress` object, nullable: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
      - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
      - `addressLineOne` string, nullable: The first line of the address.
      - `addressLineTwo` string, nullable: The second line of the address.
      - `city` string, nullable: The city of the address.
      - `state` string, nullable: The state of the address.
      - `zip` string, nullable: The zip code of the address.
      - `country` string, nullable: The country of the address.
      - `latitude` number, nullable: The latitude of the address in decimal degrees.
      - `longitude` number, nullable: The longitude of the address in decimal degrees.
    - `endTime` object, nullable: Time of day in hours and minutes. Uses a 24 hour clock.
      - `hour` integer, required: Hour of the day
      - `minute` integer, required: Minute of the hour
    - `defaultTimeAtStop` number, nullable: Estimated time at the stop
    - `maxStops` number, nullable: Maximum number of stops per driver
    - `vehicleType` 'bike' | 'scooter' | 'car' | 'small_truck' | 'truck' | 'electric_cargo_bike', nullable: Default vehicle type
    - `roadSide` 'any' | 'left_only' | 'right_only', nullable: Attempt to visit stops on this side of the road
    - `roundTrip` boolean, nullable: Return to the startAddress at the end of the route

## Response `200`

Success

- object: Success
  - `success` string[], required: The ids of the successfully imported depots
  - `failed` object[], required: The failed depots
    - `error` object, required
      - `message` string, required: The error that occurred during import
    - `depot` object, required: The depot that failed to import
      - `name` string, required
      - `routeOverrides` object, required
        - `startAddress` object, required: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
          - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
          - `addressLineOne` string, nullable: The first line of the address.
          - `addressLineTwo` string, nullable: The second line of the address.
          - `city` string, nullable: The city of the address.
          - `state` string, nullable: The state of the address.
          - `zip` string, nullable: The zip code of the address.
          - `country` string, nullable: The country of the address.
          - `latitude` number, nullable: The latitude of the address in decimal degrees.
          - `longitude` number, nullable: The longitude of the address in decimal degrees.
        - `startTime` object, required: Route start time
          - `hour` integer, required: Hour of the day
          - `minute` integer, required: Minute of the hour
        - `endAddress` object, nullable: At least one of the fields is required. If the latitude and longitude fields are set they will override any of the others.
          - `addressName` string, nullable: The name of the address. This will not be used for geocoding, and is only for the final address display purposes.
          - `addressLineOne` string, nullable: The first line of the address.
          - `addressLineTwo` string, nullable: The second line of the address.
          - `city` string, nullable: The city of the address.
          - `state` string, nullable: The state of the address.
          - `zip` string, nullable: The zip code of the address.
          - `country` string, nullable: The country of the address.
          - `latitude` number, nullable: The latitude of the address in decimal degrees.
          - `longitude` number, nullable: The longitude of the address in decimal degrees.
        - `endTime` object, nullable: Time of day in hours and minutes. Uses a 24 hour clock.
          - `hour` integer, required: Hour of the day
          - `minute` integer, required: Minute of the hour
        - `defaultTimeAtStop` number, nullable: Estimated time at the stop
        - `maxStops` number, nullable: Maximum number of stops per driver
        - `vehicleType` 'bike' | 'scooter' | 'car' | 'small_truck' | 'truck' | 'electric_cargo_bike', nullable: Default vehicle type
        - `roadSide` 'any' | 'left_only' | 'right_only', nullable: Attempt to visit stops on this side of the road
        - `roundTrip` boolean, nullable: Return to the startAddress at the end of the route

## Other responses

- `400`: The request has errors. Either syntactic or semantic
- `401`: Unauthorized
- `500`: An internal server error occurred
- `default`: The default error model

---

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