---
title: Create a depot
description: Create a depot
url: /api/depots/createDepot
---

# Create a depot

`POST /depots`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v1
servers:
  - url: https://api.spoke.com/public/v1
security:
  - BasicAuth: []
paths:
  /depots:
    post:
      operationId: createDepot
      summary: Create a depot
      tags:
        - Depots
      requestBody:
        content:
          application/json:
            schema:
              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
        required: true
      responses:
        "200":
          description: The requested depot
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/depotSchema"
                description: The requested depot
        "400":
          description: The request was invalid
          content:
            application/json:
              schema:
                oneOf:
                  - 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
                  - type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                        description: The error code.
                      param:
                        type: string
                      url:
                        type: string
                        description: The URL with more information about the error.
                    required:
                      - message
                      - param
                    description: A provided route override parameter was invalid.
                    title: Route override was invalid
                description: The request was invalid
        "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:
  schemas:
    depotIdSchema:
      type: string
      pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
    depotSchema:
      type: object
      properties:
        id:
          allOf:
            - $ref: "#/components/schemas/depotIdSchema"
          description: The depot id, in the format `depots/<id>`
        name:
          type: string
          description: The name of the depot.
        routeOverrides:
          anyOf:
            - type: object
              properties:
                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: Default route start time.
                startAddress:
                  type: object
                  properties:
                    address:
                      description: The full address.
                      type:
                        - string
                        - "null"
                    addressLineOne:
                      description: The first line of the address.
                      type:
                        - string
                        - "null"
                    addressLineTwo:
                      description: The second line of the address.
                      type:
                        - string
                        - "null"
                    latitude:
                      description: Latitude coordinate of the depot in decimal degrees.
                      type:
                        - number
                        - "null"
                    longitude:
                      description: Longitude coordinate of the depot in decimal degrees.
                      type:
                        - number
                        - "null"
                    placeId:
                      description: A Google PlaceID identifying the location of the depot.
                      type:
                        - string
                        - "null"
                    countryCode:
                      description: The country code of the address.
                      type:
                        - string
                        - "null"
                  required:
                    - address
                    - addressLineOne
                    - addressLineTwo
                    - latitude
                    - longitude
                    - placeId
                    - countryCode
                  description: The default start address for routes originating from this depot.
                defaultTimeAtStop:
                  description: Estimated time at stop in seconds.
                  type:
                    - number
                    - "null"
                endAddress:
                  anyOf:
                    - type: object
                      properties:
                        address:
                          description: The full address.
                          type:
                            - string
                            - "null"
                        addressLineOne:
                          description: The first line of the address.
                          type:
                            - string
                            - "null"
                        addressLineTwo:
                          description: The second line of the address.
                          type:
                            - string
                            - "null"
                        latitude:
                          description: Latitude coordinate of the depot in decimal degrees.
                          type:
                            - number
                            - "null"
                        longitude:
                          description: Longitude coordinate of the depot in decimal degrees.
                          type:
                            - number
                            - "null"
                        placeId:
                          description: A Google PlaceID identifying the location of the depot.
                          type:
                            - string
                            - "null"
                        countryCode:
                          description: The country code of the address.
                          type:
                            - string
                            - "null"
                      required:
                        - address
                        - addressLineOne
                        - addressLineTwo
                        - latitude
                        - longitude
                        - placeId
                        - countryCode
                      description: The default end address for routes originating from this depot (if empty, assume a round-trip).
                    - 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: Default route end time.
                    - type: "null"
                maxStops:
                  description: Max stops assigned to each driver
                  type:
                    - number
                    - "null"
                roadSide:
                  anyOf:
                    - type: string
                      enum:
                        - any
                        - left_only
                        - right_only
                    - type: "null"
                  description: The side of the road drivers should stop at.
                vehicleType:
                  anyOf:
                    - type: string
                      enum:
                        - bike
                        - scooter
                        - car
                        - small_truck
                        - truck
                        - electric_cargo_bike
                    - type: "null"
                  description: Default vehicle type for new routes from this depot.
                roundTrip:
                  description: Return to start address at end of route
                  type:
                    - boolean
                    - "null"
              required:
                - startTime
                - startAddress
            - type: "null"
      required:
        - id
        - name
        - routeOverrides
      additionalProperties: false
      description: A depot.
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````