---
title: Update an existing stop
description: Update a stop on live plans. When the plan is not writable, this
  endpoint starts an editing session and the action can be applied through a new
  optimization, or be discarded. It does not support updating a stop's location.
  To do so, delete the stop and create a new one.
url: /api/v0.2b/live-stops/updateLiveStop
---

# Update an existing stop

`POST /plans/{planId}/stops/{stopId}:liveUpdate`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v0.2b
servers:
  - url: https://api.spoke.com/public/v0.2b
security:
  - BasicAuth: []
paths:
  /plans/{planId}/stops/{stopId}:liveUpdate:
    post:
      operationId: updateLiveStop
      summary: Update an existing stop
      tags:
        - Live Stops
      description: Update a stop on live plans. When the plan is not writable, this endpoint starts an editing session and the action can be applied through a new optimization, or be discarded. It does not support updating a stop's location. To do so, delete the stop and create a new one.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                recipient:
                  anyOf:
                    - type: object
                      properties:
                        externalId:
                          description: External ID of the recipient, as defined by the API user
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                        email:
                          description: The email address of the recipient. Multiple emails are not supported.
                          anyOf:
                            - type: string
                              maxLength: 255
                              format: email
                              pattern: ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
                            - type: "null"
                        phone:
                          description: Phone number of the recipient
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                        name:
                          description: Name of the recipient
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                      additionalProperties: false
                      description: Recipient information for this stop
                    - type: "null"
                orderInfo:
                  anyOf:
                    - type: object
                      properties:
                        products:
                          description: Products in this stop
                          maxItems: 100
                          type: array
                          items:
                            type: string
                            minLength: 1
                            maxLength: 255
                        sellerOrderId:
                          description: Seller order ID
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                        sellerName:
                          description: Seller name
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                        sellerWebsite:
                          description: Seller website
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                      additionalProperties: false
                      description: Order information for this stop
                    - type: "null"
                paymentOnDelivery:
                  anyOf:
                    - type: object
                      properties:
                        amount:
                          description: Amount *in minor units* (e.g. cents) to be collected upon delivery
                          anyOf:
                            - type: integer
                              minimum: 0
                              maximum: 9007199254740991
                            - type: "null"
                        currency:
                          description: Currency of the payment. Defaults to the team's currency.
                          anyOf:
                            - type: string
                              enum:
                                - AED
                                - ARS
                                - AUD
                                - BRL
                                - CAD
                                - CHF
                                - CLP
                                - CNY
                                - COP
                                - DKK
                                - EGP
                                - EUR
                                - GBP
                                - HKD
                                - HUF
                                - ILS
                                - INR
                                - JPY
                                - KRW
                                - MYR
                                - MXN
                                - NOK
                                - NZD
                                - PEN
                                - RON
                                - RUB
                                - SAR
                                - SEK
                                - SGD
                                - TRY
                                - USD
                                - UYU
                                - ZAR
                            - type: "null"
                      additionalProperties: false
                      description: Payment on delivery (also known as "Cash on Delivery") data for this stop
                    - type: "null"
                proofOfAttemptRequirements:
                  anyOf:
                    - type: object
                      properties:
                        enabled:
                          description: Whether proof of attempt is required for this stop
                          type:
                            - boolean
                            - "null"
                      additionalProperties: false
                      description: Proof of attempt requirement settings for this stop
                    - type: "null"
                driver:
                  description: |-
                    Deprecated. Prefer using the `allowedDrivers` field instead.
                    Driver ID that should be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the `allowedDrivers` field.
                  anyOf:
                    - type: string
                      pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
                    - type: "null"
                allowedDrivers:
                  description: Driver IDs that are allowed to be assigned to this stop. If not provided, the stop will be assigned to any available driver during optimization. This field is mutually exclusive with the `driver` field. When the stop is first created, all the drivers in this list will be added to the plan as well. If the stop is updated, no changes will be made to the plan, so if you want to add a driver to the plan, you must also add them to the plan separately, if they are not already.
                  anyOf:
                    - maxItems: 100
                      type: array
                      items:
                        type: string
                        pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
                    - type: "null"
                activity:
                  default: delivery
                  description: Activity type
                  anyOf:
                    - type: string
                      enum:
                        - delivery
                        - pickup
                    - type: "null"
                optimizationOrder:
                  description: The preferred order of this stop in the optimized route. If not provided or `"default"`, the stop will be placed in the optimal order, decided by the optimization algorithm. Otherwise it will be placed either `"first"` or `"last"`.
                  anyOf:
                    - type: string
                      enum:
                        - first
                        - last
                        - default
                    - type: "null"
                packageCount:
                  description: Number of packages in the stop
                  anyOf:
                    - type: number
                      minimum: 1
                      maximum: 10000
                    - type: "null"
                weight:
                  description: Weight information for this stop.
                  anyOf:
                    - type: object
                      properties:
                        amount:
                          type: number
                          minimum: 0
                          maximum: 999999
                          multipleOf: 0.01
                          description: The weight amount for this stop.
                        unit:
                          type: string
                          enum:
                            - kilogram
                            - pound
                            - metric-ton
                          description: The weight unit in which the amount is specified.
                      required:
                        - amount
                        - unit
                    - type: "null"
                notes:
                  description: Notes for the stop
                  anyOf:
                    - type: string
                      minLength: 1
                      maxLength: 2000
                    - type: "null"
                barcodes:
                  description: List of barcode IDs associated with this stop
                  maxItems: 200
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 255
                customProperties:
                  description: Key-value pairs of custom stop properties for this stop. The keys must be unique and match a custom stop property defined in your team.
                  anyOf:
                    - type: object
                      propertyNames:
                        type: string
                        maxLength: 50
                        description: The custom stop property id
                      additionalProperties:
                        anyOf:
                          - type: string
                            minLength: 1
                            maxLength: 255
                          - type: "null"
                        description: The value of the custom stop property, up to 255 characters.
                    - type: "null"
                timing:
                  anyOf:
                    - type: object
                      properties:
                        earliestAttemptTime:
                          description: Time of day of the earliest time this stop should happen
                          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"
                        latestAttemptTime:
                          description: Time of day of the latest time this stop should happen
                          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"
                        estimatedAttemptDuration:
                          description: Duration in seconds of the activity in this stop, only set if you want to override the default. This can be set up to 8 hours.
                          anyOf:
                            - type: integer
                              minimum: 1
                              maximum: 28800
                            - type: "null"
                      additionalProperties: false
                    - type: "null"
              additionalProperties: false
              description: The request body for updating a stop. All the values present in the request will update the stop value, if you wish to update only certain fields, only set them and do not set the others. Any fields not set will not be updated.
        description: The request body for updating a stop. All the values present in the request will update the stop value, if you wish to update only certain fields, only set them and do not set the others. Any fields not set will not be updated.
      parameters:
        - schema:
            type: string
            pattern: ^[a-zA-Z0-9---_]{1,50}$
          in: path
          name: planId
          required: true
          description: The plan id
        - schema:
            type: string
            pattern: ^[a-zA-Z0-9---_]{1,50}$
          in: path
          name: stopId
          required: true
          description: The stop id
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  pending:
                    type: boolean
                  stop:
                    $ref: "#/components/schemas/stopSchema"
                required:
                  - pending
                  - stop
                definitions:
                  stopSchema:
                    type: object
                    properties:
                      id:
                        type: string
                        pattern: ^plans\/[a-zA-Z0-9---_]{1,50}\/stops\/[a-zA-Z0-9---_]{1,50}$
                        description: The id of the stop, in the format `plans/<id>/stops/<id>`.
                      address:
                        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:
                              - "null"
                              - string
                          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.
                      barcodes:
                        type: array
                        items:
                          type: string
                        description: List of Barcode IDs associated with the stop.
                      driverIdentifier:
                        description: The driver identifier. This field is deprecated, prefer using `allowedDriversIdentifiers`.
                        type:
                          - "null"
                          - string
                      allowedDriversIdentifiers:
                        type: array
                        items:
                          type: string
                        description: The allowed drivers that can be assigned to this stop, replaces the `driverIdentifier` field.
                      estimatedTravelDuration:
                        description: Estimated time that the driver will take to arrive at this stop from the previous stop in seconds.
                        type:
                          - "null"
                          - number
                      estimatedTravelDistance:
                        description: The distance in meters between the previous stop and this stop.
                        type:
                          - "null"
                          - number
                      notes:
                        description: Notes for the stop.
                        type:
                          - "null"
                          - string
                      packageCount:
                        description: The number of packages.
                        type:
                          - "null"
                          - number
                      weight:
                        anyOf:
                          - type: object
                            properties:
                              amount:
                                type: number
                                minimum: 0
                                description: The weight amount for this stop.
                              unit:
                                type: string
                                enum:
                                  - kilogram
                                  - pound
                                  - metric-ton
                                description: The weight unit in which the amount is specified (defined at team's capacity unit).
                            required:
                              - amount
                              - unit
                            additionalProperties: false
                            description: Weight information for the stop.
                          - type: "null"
                      type:
                        type: string
                        enum:
                          - start
                          - stop
                          - end
                        description: The type of the stop. `start` is the first stop of the route, `stop` is a stop in the middle of the route, and `end` is the last stop of the route.
                      packageLabel:
                        description: The label of the package.
                        type:
                          - "null"
                          - string
                      stopPosition:
                        description: The position of the stop in the route.
                        type:
                          - "null"
                          - number
                      trackingLink:
                        description: The recipient tracking link.
                        type:
                          - "null"
                          - string
                      webAppLink:
                        type: string
                        description: The web app link.
                      orderInfo:
                        type: object
                        properties:
                          products:
                            type: array
                            items:
                              type: string
                            description: The products of the stop.
                          sellerName:
                            description: Name of the seller where the order is from.
                            type:
                              - "null"
                              - string
                          sellerOrderId:
                            description: Id of the seller where the order is from.
                            type:
                              - "null"
                              - string
                          sellerWebsite:
                            description: Website of the seller where the order is from.
                            type:
                              - "null"
                              - string
                        required:
                          - products
                          - sellerName
                          - sellerOrderId
                          - sellerWebsite
                        additionalProperties: false
                        description: The order information of the stop.
                      placeInVehicle:
                        anyOf:
                          - type: object
                            properties:
                              x:
                                anyOf:
                                  - type: string
                                    enum:
                                      - left
                                      - right
                                  - type: "null"
                                description: The x position of the package.
                              y:
                                anyOf:
                                  - type: string
                                    enum:
                                      - front
                                      - back
                                      - middle
                                  - type: "null"
                                description: The y position of the package.
                              z:
                                anyOf:
                                  - type: string
                                    enum:
                                      - floor
                                      - shelf
                                  - type: "null"
                                description: The z position of the package.
                            required:
                              - x
                              - y
                              - z
                            additionalProperties: false
                            description: The position of the package in the vehicle.
                          - type: "null"
                      recipient:
                        type: object
                        properties:
                          name:
                            description: The name of the recipient.
                            type:
                              - "null"
                              - string
                          email:
                            description: The email of the recipient.
                            type:
                              - "null"
                              - string
                          phone:
                            description: The phone of the recipient.
                            type:
                              - "null"
                              - string
                          externalId:
                            description: The external id of the recipient.
                            type:
                              - "null"
                              - string
                        required:
                          - name
                          - email
                          - phone
                          - externalId
                        additionalProperties: false
                        description: The recipient of the stop.
                      activity:
                        default: delivery
                        type: string
                        enum:
                          - delivery
                          - pickup
                      deliveryInfo:
                        anyOf:
                          - type: object
                            properties:
                              attempted:
                                type: boolean
                                description: Whether the stop was attempted.
                              attemptedAt:
                                description: When the stop was attempted in seconds since epoch.
                                type:
                                  - number
                                  - "null"
                              arrivedAt:
                                description: When the driver arrived at the stop in seconds since epoch. This field is deprecated, prefer `timeAtStopInfo.arrivedAt`.
                                type:
                                  - number
                                  - "null"
                              timeAtStopInfo:
                                anyOf:
                                  - type: object
                                    properties:
                                      arrivedAt:
                                        description: When the driver arrived at the stop in seconds since epoch.
                                        type:
                                          - number
                                          - "null"
                                      departedAt:
                                        description: When the driver departed from the stop in seconds since epoch.
                                        type:
                                          - number
                                          - "null"
                                      isEstimated:
                                        description: Whether the time at stop was estimated rather than directly measured.
                                        type:
                                          - boolean
                                          - "null"
                                    required:
                                      - arrivedAt
                                      - departedAt
                                      - isEstimated
                                  - type: "null"
                                description: Grouped time-at-stop data.
                              timeAtStopInfoNullReason:
                                anyOf:
                                  - type: object
                                    properties:
                                      reason:
                                        type: string
                                        enum:
                                          - subscription_not_supported
                                      message:
                                        type: string
                                      url:
                                        type:
                                          - string
                                          - "null"
                                    required:
                                      - reason
                                      - message
                                      - url
                                  - type: "null"
                                description: Reason why time-at-stop data was not provided.
                              attemptedLocation:
                                anyOf:
                                  - type: object
                                    properties:
                                      latitude:
                                        type: number
                                        description: The latitude of the location.
                                      longitude:
                                        type: number
                                        description: The longitude of the location.
                                    required:
                                      - latitude
                                      - longitude
                                    additionalProperties: false
                                    description: A location.
                                  - type: "null"
                                description: Where the stop was attempted.
                              driverProvidedInternalNotes:
                                description: Internal notes provided by the driver.
                                type:
                                  - string
                                  - "null"
                              driverProvidedRecipientNotes:
                                description: Recipient notes provided by the driver.
                                type:
                                  - string
                                  - "null"
                              photoUrls:
                                type: array
                                items:
                                  type: string
                                description: URLs of proof of delivery photos.
                              recipientProvidedNotes:
                                description: Notes from recipient
                                type:
                                  - string
                                  - "null"
                              signatureUrl:
                                description: URL of the signature.
                                type:
                                  - string
                                  - "null"
                              signeeName:
                                description: Name of the signee.
                                type:
                                  - string
                                  - "null"
                              succeeded:
                                type: boolean
                                description: Whether the stop was succeeded.
                              state:
                                type: string
                                enum:
                                  - delivered_to_recipient
                                  - delivered_to_third_party
                                  - delivered_to_mailbox
                                  - delivered_to_safe_place
                                  - delivered_to_pickup_point
                                  - delivered_other
                                  - picked_up_from_customer
                                  - picked_up_unmanned
                                  - picked_up_from_locker
                                  - picked_up_other
                                  - failed_not_home
                                  - failed_cant_find_address
                                  - failed_no_parking
                                  - failed_no_time
                                  - failed_package_not_available
                                  - failed_other
                                  - failed_missing_required_proof
                                  - failed_payment_not_received
                                  - unattempted
                                description: The state of the delivery.
                            required:
                              - attempted
                              - attemptedAt
                              - arrivedAt
                              - timeAtStopInfo
                              - timeAtStopInfoNullReason
                              - attemptedLocation
                              - driverProvidedInternalNotes
                              - driverProvidedRecipientNotes
                              - photoUrls
                              - recipientProvidedNotes
                              - signatureUrl
                              - signeeName
                              - succeeded
                              - state
                            additionalProperties: false
                            description: The delivery information of the stop.
                          - type: "null"
                      paymentOnDelivery:
                        anyOf:
                          - type: object
                            properties:
                              amount:
                                anyOf:
                                  - type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                  - type: "null"
                                description: The amount *in minor units* (e.g. cents) to be collected upon delivery.
                              currency:
                                type: string
                                description: The payment's currency in ISO 4217 standard.
                            required:
                              - amount
                              - currency
                            additionalProperties: false
                            description: The payment due upon delivery also known as "Cash on Delivery".
                          - type: "null"
                      proofOfAttemptRequirements:
                        type: object
                        properties:
                          enabled:
                            description: Whether the proof of attempt is enabled.This only works if the team subscription has access to proof of delivery
                            type:
                              - "null"
                              - boolean
                        required:
                          - enabled
                        additionalProperties: false
                        description: The proof of attempt requirements of the stop.
                      plan:
                        type: string
                        pattern: ^plans\/[a-zA-Z0-9---_]{1,50}$
                        description: The id of the plan, in the format `plans/<id>`.
                      route:
                        anyOf:
                          - type: object
                            properties:
                              id:
                                type: string
                                pattern: ^routes\/[a-zA-Z0-9---_]{1,50}$
                                description: The id of the route, in the format `routes/<id>`.
                              title:
                                type: string
                                description: The title of the route.
                              stopCount:
                                type: number
                                description: The number of stops in the route.
                              driver:
                                anyOf:
                                  - type: string
                                    pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
                                  - type: "null"
                                description: The id of the driver.
                              state:
                                anyOf:
                                  - type: object
                                    properties:
                                      completed:
                                        type: boolean
                                        description: Whether the route is completed.
                                      completedAt:
                                        description: The timestamp the route was completed at.
                                        type:
                                          - number
                                          - "null"
                                      distributed:
                                        type: boolean
                                        description: Whether the route is distributed.
                                      distributedAt:
                                        description: The timestamp the route was distributed at.
                                        type:
                                          - number
                                          - "null"
                                      notifiedRecipients:
                                        type: boolean
                                        description: Whether the recipients were notified.
                                      notifiedRecipientsAt:
                                        description: The timestamp the recipients were notified at.
                                        type:
                                          - number
                                          - "null"
                                      started:
                                        type: boolean
                                        description: Whether the route is started.
                                      startedAt:
                                        description: The timestamp the route was started at.
                                        type:
                                          - number
                                          - "null"
                                    required:
                                      - completed
                                      - completedAt
                                      - distributed
                                      - distributedAt
                                      - notifiedRecipients
                                      - notifiedRecipientsAt
                                      - started
                                      - startedAt
                                    additionalProperties: false
                                    description: The state of a route.
                                  - type: "null"
                                description: The state of the route.
                              plan:
                                anyOf:
                                  - type: string
                                    pattern: ^plans\/[a-zA-Z0-9---_]{1,50}$
                                  - type: "null"
                                description: The id of the related plan.
                            required:
                              - id
                              - title
                              - stopCount
                              - driver
                              - state
                              - plan
                            additionalProperties: false
                            description: A route.
                          - type: "null"
                        description: The route of the stop, if any.
                      eta:
                        anyOf:
                          - type: object
                            properties:
                              estimatedArrivalAt:
                                type: number
                                description: The estimated time in seconds since epoch.
                              estimatedLatestArrivalAt:
                                type: number
                                description: The latest estimated time in seconds since epoch.
                              estimatedEarliestArrivalAt:
                                type: number
                                description: The earliest estimated time in seconds since epoch.
                            required:
                              - estimatedArrivalAt
                              - estimatedLatestArrivalAt
                              - estimatedEarliestArrivalAt
                            additionalProperties: false
                            description: The estimated time of arrival data of the stop.
                          - type: "null"
                      etaNullReason:
                        anyOf:
                          - type: object
                            properties:
                              reason:
                                type: string
                                enum:
                                  - not_optimized
                                  - subscription_not_supported
                              message:
                                type: string
                              url:
                                type:
                                  - string
                                  - "null"
                            required:
                              - reason
                              - message
                              - url
                            additionalProperties: false
                            description: The reason why the ETA data is null, if it is.
                          - type: "null"
                      timing:
                        type: object
                        properties:
                          estimatedAttemptDuration:
                            description: Time that the driver estimates to spend on the stop to do his job (deliver a parcel, visit a client, etc) in seconds.
                            type:
                              - "null"
                              - number
                          earliestAttemptTime:
                            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: The earliest time that the driver should arrive at the stop
                          latestAttemptTime:
                            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: The latest time that the driver should arrive at the stop.
                        required:
                          - estimatedAttemptDuration
                          - earliestAttemptTime
                          - latestAttemptTime
                        additionalProperties: false
                        description: The timing data of the stop.
                      optimizationOrder:
                        default: default
                        type: string
                        enum:
                          - first
                          - last
                          - default
                      customProperties:
                        anyOf:
                          - type: object
                            propertyNames:
                              type: string
                            additionalProperties:
                              type:
                                - string
                                - "null"
                          - type: "null"
                        description: Custom properties of the stop, can be used to store additional information.
                      circuitClientId:
                        description: The associated Client ID of the Spoke Connect
                        type:
                          - "null"
                          - string
                    required:
                      - id
                      - address
                      - barcodes
                      - driverIdentifier
                      - allowedDriversIdentifiers
                      - estimatedTravelDuration
                      - estimatedTravelDistance
                      - notes
                      - packageCount
                      - weight
                      - type
                      - packageLabel
                      - stopPosition
                      - trackingLink
                      - webAppLink
                      - orderInfo
                      - placeInVehicle
                      - recipient
                      - deliveryInfo
                      - paymentOnDelivery
                      - proofOfAttemptRequirements
                      - plan
                      - route
                      - eta
                      - etaNullReason
                      - timing
                      - customProperties
                      - circuitClientId
                    additionalProperties: false
                    description: A stop of a plan, can be related to a route.
                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
                title: The request is 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
        "403":
          description: The plan is no longer accessible or the stop contains fields that require upgrading your team subscription.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      message:
                        type: string
                        enum:
                          - Plan is no longer accessible due to data access restrictions. Upgrade to a plan that supports a longer delivery history period to access it.
                      code:
                        type: string
                        enum:
                          - plan_inaccessible
                      url:
                        type: string
                        enum:
                          - https://dispatch.spoke.com/paywall
                    required:
                      - message
                      - code
                      - url
                    description: Plan is no longer accessible due to data access restrictions. Upgrade to a plan that supports a longer delivery history period to access it.
                    x-response-description: Plan is no longer accessible due to data access restrictions. Upgrade to a plan that supports a longer delivery history period to access it.
                  - type: object
                    properties:
                      message:
                        type: string
                        description: The error message.
                      code:
                        type: string
                        enum:
                          - feature_not_in_subscription
                      url:
                        type: string
                        enum:
                          - https://dispatch.spoke.com/paywall
                    required:
                      - message
                      - code
                      - url
                    description: Feature not included in your team subscription
                description: The plan is no longer accessible or the stop contains fields that require upgrading your team subscription.
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                required:
                  - message
                description: Not Found
        "409":
          description: The plan's optimization is in progress.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    enum:
                      - Plan optimization in progress
                  code:
                    type: string
                    enum:
                      - plan_optimization_in_progress
                required:
                  - message
                  - code
                description: The plan's optimization is in progress.
                title: Plan optimization in progress
        "422":
          description: The stop is unprocessable.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      message:
                        anyOf:
                          - type: string
                            enum:
                              - Stop cannot be edited
                          - type: string
                      code:
                        type: string
                        enum:
                          - stop_not_editable
                    required:
                      - message
                      - code
                    description: Failed to update stop
                  - type: object
                    properties:
                      message:
                        anyOf:
                          - type: string
                            enum:
                              - An error occurred when creating the stop, 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 stop
                  - type: object
                    properties:
                      message:
                        type: string
                        description: The error message.
                      code:
                        type: string
                        enum:
                          - vehicle_capacity_disabled
                      url:
                        type: string
                        enum:
                          - https://dispatch.spoke.com/settings/team-profile
                    required:
                      - message
                      - code
                      - url
                    description: Vehicle capacity mode is disabled in the team's settings
                    x-response-description: Vehicle capacity mode is disabled in the team's settings
                description: The stop is unprocessable.
        "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:
    driverIdSchema:
      type: string
      pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
    planIdSchema:
      type: string
      pattern: ^plans\/[a-zA-Z0-9---_]{1,50}$
    routeIdSchema:
      type: string
      pattern: ^routes\/[a-zA-Z0-9---_]{1,50}$
    routeSchema:
      type: object
      properties:
        id:
          allOf:
            - $ref: "#/components/schemas/routeIdSchema"
          description: The id of the route, in the format `routes/<id>`.
        title:
          type: string
          description: The title of the route.
        stopCount:
          type: number
          description: The number of stops in the route.
        driver:
          anyOf:
            - $ref: "#/components/schemas/driverIdSchema"
            - type: "null"
          description: The id of the driver.
        state:
          anyOf:
            - type: object
              properties:
                completed:
                  type: boolean
                  description: Whether the route is completed.
                completedAt:
                  description: The timestamp the route was completed at.
                  type:
                    - number
                    - "null"
                distributed:
                  type: boolean
                  description: Whether the route is distributed.
                distributedAt:
                  description: The timestamp the route was distributed at.
                  type:
                    - number
                    - "null"
                notifiedRecipients:
                  type: boolean
                  description: Whether the recipients were notified.
                notifiedRecipientsAt:
                  description: The timestamp the recipients were notified at.
                  type:
                    - number
                    - "null"
                started:
                  type: boolean
                  description: Whether the route is started.
                startedAt:
                  description: The timestamp the route was started at.
                  type:
                    - number
                    - "null"
              required:
                - completed
                - completedAt
                - distributed
                - distributedAt
                - notifiedRecipients
                - notifiedRecipientsAt
                - started
                - startedAt
              additionalProperties: false
              description: The state of a route.
            - type: "null"
          description: The state of the route.
        plan:
          anyOf:
            - $ref: "#/components/schemas/planIdSchema"
            - type: "null"
          description: The id of the related plan.
      required:
        - id
        - title
        - stopCount
        - driver
        - state
        - plan
      additionalProperties: false
      description: A route.
    stopIdSchema:
      type: string
      pattern: ^plans\/[a-zA-Z0-9---_]{1,50}\/stops\/[a-zA-Z0-9---_]{1,50}$
    stopSchema:
      type: object
      properties:
        id:
          allOf:
            - $ref: "#/components/schemas/stopIdSchema"
          description: The id of the stop, in the format `plans/<id>/stops/<id>`.
        address:
          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:
                - "null"
                - string
            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.
        barcodes:
          type: array
          items:
            type: string
          description: List of Barcode IDs associated with the stop.
        driverIdentifier:
          description: The driver identifier. This field is deprecated, prefer using `allowedDriversIdentifiers`.
          type:
            - "null"
            - string
        allowedDriversIdentifiers:
          type: array
          items:
            type: string
          description: The allowed drivers that can be assigned to this stop, replaces the `driverIdentifier` field.
        estimatedTravelDuration:
          description: Estimated time that the driver will take to arrive at this stop from the previous stop in seconds.
          type:
            - "null"
            - number
        estimatedTravelDistance:
          description: The distance in meters between the previous stop and this stop.
          type:
            - "null"
            - number
        notes:
          description: Notes for the stop.
          type:
            - "null"
            - string
        packageCount:
          description: The number of packages.
          type:
            - "null"
            - number
        weight:
          anyOf:
            - type: object
              properties:
                amount:
                  type: number
                  minimum: 0
                  description: The weight amount for this stop.
                unit:
                  type: string
                  enum:
                    - kilogram
                    - pound
                    - metric-ton
                  description: The weight unit in which the amount is specified (defined at team's capacity unit).
              required:
                - amount
                - unit
              additionalProperties: false
              description: Weight information for the stop.
            - type: "null"
        type:
          type: string
          enum:
            - start
            - stop
            - end
          description: The type of the stop. `start` is the first stop of the route, `stop` is a stop in the middle of the route, and `end` is the last stop of the route.
        packageLabel:
          description: The label of the package.
          type:
            - "null"
            - string
        stopPosition:
          description: The position of the stop in the route.
          type:
            - "null"
            - number
        trackingLink:
          description: The recipient tracking link.
          type:
            - "null"
            - string
        webAppLink:
          type: string
          description: The web app link.
        orderInfo:
          type: object
          properties:
            products:
              type: array
              items:
                type: string
              description: The products of the stop.
            sellerName:
              description: Name of the seller where the order is from.
              type:
                - "null"
                - string
            sellerOrderId:
              description: Id of the seller where the order is from.
              type:
                - "null"
                - string
            sellerWebsite:
              description: Website of the seller where the order is from.
              type:
                - "null"
                - string
          required:
            - products
            - sellerName
            - sellerOrderId
            - sellerWebsite
          additionalProperties: false
          description: The order information of the stop.
        placeInVehicle:
          anyOf:
            - type: object
              properties:
                x:
                  anyOf:
                    - type: string
                      enum:
                        - left
                        - right
                    - type: "null"
                  description: The x position of the package.
                y:
                  anyOf:
                    - type: string
                      enum:
                        - front
                        - back
                        - middle
                    - type: "null"
                  description: The y position of the package.
                z:
                  anyOf:
                    - type: string
                      enum:
                        - floor
                        - shelf
                    - type: "null"
                  description: The z position of the package.
              required:
                - x
                - y
                - z
              additionalProperties: false
              description: The position of the package in the vehicle.
            - type: "null"
        recipient:
          type: object
          properties:
            name:
              description: The name of the recipient.
              type:
                - "null"
                - string
            email:
              description: The email of the recipient.
              type:
                - "null"
                - string
            phone:
              description: The phone of the recipient.
              type:
                - "null"
                - string
            externalId:
              description: The external id of the recipient.
              type:
                - "null"
                - string
          required:
            - name
            - email
            - phone
            - externalId
          additionalProperties: false
          description: The recipient of the stop.
        activity:
          default: delivery
          type: string
          enum:
            - delivery
            - pickup
        deliveryInfo:
          anyOf:
            - type: object
              properties:
                attempted:
                  type: boolean
                  description: Whether the stop was attempted.
                attemptedAt:
                  description: When the stop was attempted in seconds since epoch.
                  type:
                    - number
                    - "null"
                arrivedAt:
                  description: When the driver arrived at the stop in seconds since epoch. This field is deprecated, prefer `timeAtStopInfo.arrivedAt`.
                  type:
                    - number
                    - "null"
                timeAtStopInfo:
                  anyOf:
                    - type: object
                      properties:
                        arrivedAt:
                          description: When the driver arrived at the stop in seconds since epoch.
                          type:
                            - number
                            - "null"
                        departedAt:
                          description: When the driver departed from the stop in seconds since epoch.
                          type:
                            - number
                            - "null"
                        isEstimated:
                          description: Whether the time at stop was estimated rather than directly measured.
                          type:
                            - boolean
                            - "null"
                      required:
                        - arrivedAt
                        - departedAt
                        - isEstimated
                    - type: "null"
                  description: Grouped time-at-stop data.
                timeAtStopInfoNullReason:
                  anyOf:
                    - type: object
                      properties:
                        reason:
                          type: string
                          enum:
                            - subscription_not_supported
                        message:
                          type: string
                        url:
                          type:
                            - string
                            - "null"
                      required:
                        - reason
                        - message
                        - url
                    - type: "null"
                  description: Reason why time-at-stop data was not provided.
                attemptedLocation:
                  anyOf:
                    - type: object
                      properties:
                        latitude:
                          type: number
                          description: The latitude of the location.
                        longitude:
                          type: number
                          description: The longitude of the location.
                      required:
                        - latitude
                        - longitude
                      additionalProperties: false
                      description: A location.
                    - type: "null"
                  description: Where the stop was attempted.
                driverProvidedInternalNotes:
                  description: Internal notes provided by the driver.
                  type:
                    - string
                    - "null"
                driverProvidedRecipientNotes:
                  description: Recipient notes provided by the driver.
                  type:
                    - string
                    - "null"
                photoUrls:
                  type: array
                  items:
                    type: string
                  description: URLs of proof of delivery photos.
                recipientProvidedNotes:
                  description: Notes from recipient
                  type:
                    - string
                    - "null"
                signatureUrl:
                  description: URL of the signature.
                  type:
                    - string
                    - "null"
                signeeName:
                  description: Name of the signee.
                  type:
                    - string
                    - "null"
                succeeded:
                  type: boolean
                  description: Whether the stop was succeeded.
                state:
                  type: string
                  enum:
                    - delivered_to_recipient
                    - delivered_to_third_party
                    - delivered_to_mailbox
                    - delivered_to_safe_place
                    - delivered_to_pickup_point
                    - delivered_other
                    - picked_up_from_customer
                    - picked_up_unmanned
                    - picked_up_from_locker
                    - picked_up_other
                    - failed_not_home
                    - failed_cant_find_address
                    - failed_no_parking
                    - failed_no_time
                    - failed_package_not_available
                    - failed_other
                    - failed_missing_required_proof
                    - failed_payment_not_received
                    - unattempted
                  description: The state of the delivery.
              required:
                - attempted
                - attemptedAt
                - arrivedAt
                - timeAtStopInfo
                - timeAtStopInfoNullReason
                - attemptedLocation
                - driverProvidedInternalNotes
                - driverProvidedRecipientNotes
                - photoUrls
                - recipientProvidedNotes
                - signatureUrl
                - signeeName
                - succeeded
                - state
              additionalProperties: false
              description: The delivery information of the stop.
            - type: "null"
        paymentOnDelivery:
          anyOf:
            - type: object
              properties:
                amount:
                  anyOf:
                    - type: integer
                      minimum: 0
                      maximum: 9007199254740991
                    - type: "null"
                  description: The amount *in minor units* (e.g. cents) to be collected upon delivery.
                currency:
                  type: string
                  description: The payment's currency in ISO 4217 standard.
              required:
                - amount
                - currency
              additionalProperties: false
              description: The payment due upon delivery also known as "Cash on Delivery".
            - type: "null"
        proofOfAttemptRequirements:
          type: object
          properties:
            enabled:
              description: Whether the proof of attempt is enabled.This only works if the team subscription has access to proof of delivery
              type:
                - "null"
                - boolean
          required:
            - enabled
          additionalProperties: false
          description: The proof of attempt requirements of the stop.
        plan:
          allOf:
            - $ref: "#/components/schemas/planIdSchema"
          description: The id of the plan, in the format `plans/<id>`.
        route:
          anyOf:
            - $ref: "#/components/schemas/routeSchema"
            - type: "null"
          description: The route of the stop, if any.
        eta:
          anyOf:
            - type: object
              properties:
                estimatedArrivalAt:
                  type: number
                  description: The estimated time in seconds since epoch.
                estimatedLatestArrivalAt:
                  type: number
                  description: The latest estimated time in seconds since epoch.
                estimatedEarliestArrivalAt:
                  type: number
                  description: The earliest estimated time in seconds since epoch.
              required:
                - estimatedArrivalAt
                - estimatedLatestArrivalAt
                - estimatedEarliestArrivalAt
              additionalProperties: false
              description: The estimated time of arrival data of the stop.
            - type: "null"
        etaNullReason:
          anyOf:
            - type: object
              properties:
                reason:
                  type: string
                  enum:
                    - not_optimized
                    - subscription_not_supported
                message:
                  type: string
                url:
                  type:
                    - string
                    - "null"
              required:
                - reason
                - message
                - url
              additionalProperties: false
              description: The reason why the ETA data is null, if it is.
            - type: "null"
        timing:
          type: object
          properties:
            estimatedAttemptDuration:
              description: Time that the driver estimates to spend on the stop to do his job (deliver a parcel, visit a client, etc) in seconds.
              type:
                - "null"
                - number
            earliestAttemptTime:
              anyOf:
                - $ref: "#/components/schemas/timeOfDaySchema"
                - type: "null"
              description: The earliest time that the driver should arrive at the stop
            latestAttemptTime:
              anyOf:
                - $ref: "#/components/schemas/timeOfDaySchema"
                - type: "null"
              description: The latest time that the driver should arrive at the stop.
          required:
            - estimatedAttemptDuration
            - earliestAttemptTime
            - latestAttemptTime
          additionalProperties: false
          description: The timing data of the stop.
        optimizationOrder:
          default: default
          type: string
          enum:
            - first
            - last
            - default
        customProperties:
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties:
                type:
                  - string
                  - "null"
            - type: "null"
          description: Custom properties of the stop, can be used to store additional information.
        circuitClientId:
          description: The associated Client ID of the Spoke Connect
          type:
            - "null"
            - string
      required:
        - id
        - address
        - barcodes
        - driverIdentifier
        - allowedDriversIdentifiers
        - estimatedTravelDuration
        - estimatedTravelDistance
        - notes
        - packageCount
        - weight
        - type
        - packageLabel
        - stopPosition
        - trackingLink
        - webAppLink
        - orderInfo
        - placeInVehicle
        - recipient
        - deliveryInfo
        - paymentOnDelivery
        - proofOfAttemptRequirements
        - plan
        - route
        - eta
        - etaNullReason
        - timing
        - customProperties
        - circuitClientId
      additionalProperties: false
      description: A stop of a plan, can be related to a route.
    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.
````