---
title: Create a new stop
description: Create a new stop with the given data 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. Prefer using the [batch
  import endpoint](/api/live-stops/importLiveStops) if you want to create
  multiple stops at once as it is more efficient and will produce better
  geocoding results.
url: /api/live-stops/createLiveStop
---

# Create a new stop

`POST /plans/{planId}/stops:liveCreate`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v1
servers:
  - url: https://api.spoke.com/public/v1
security:
  - BasicAuth: []
paths:
  /plans/{planId}/stops:liveCreate:
    post:
      operationId: createLiveStop
      summary: Create a new stop
      tags:
        - Live Stops
      description: Create a new stop with the given data 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. Prefer using the [batch import endpoint](/api/live-stops/importLiveStops) if you want to create multiple stops at once as it is more efficient and will produce better geocoding results.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                address:
                  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: Address of the stop, at least one of the fields is required. If the latitude and longitude fields are set they will override any of the others. The addressName field is not used for geocoding and is only for display purposes.
                timing:
                  anyOf:
                    - description: Timing information for this stop
                      type: object
                      properties:
                        timeWindows:
                          type: array
                          items:
                            type: object
                            properties:
                              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. Use a 24 hour clock.
                                  - type: "null"
                                description: Earliest attempt time in this window. Null means there is no earliest time constraint. Both bounds must be non-null when providing two windows.
                              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. Use a 24 hour clock.
                                  - type: "null"
                                description: Latest attempt time in this window. Null means there is no latest time constraint. Both bounds must be non-null when providing two windows.
                            required:
                              - earliestAttemptTime
                              - latestAttemptTime
                            additionalProperties: false
                          description: Up to two ordered arrival windows for this stop. An empty array clears the windows. A single window may have one null bound; two windows must have both bounds set. Windows must not overlap or touch, and their total span must not exceed 24 hours.
                          maxItems: 2
                        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"
                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
                        invoiceNumber:
                          description: Invoice number
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                        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"
                allowedDrivers:
                  description: Driver IDs that are allowed to be assigned to this stop. These drivers must be configured as part of the plan to be valid.
                  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"
                clientId:
                  description: Client ID of the retailer in Spoke Connect
                  anyOf:
                    - type: string
                      minLength: 1
                      maxLength: 100
                    - 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"
                serviceInfo:
                  anyOf:
                    - type: object
                      properties:
                        identifier:
                          anyOf:
                            - description: The identifier of a service offering to assign to this stop. Must match the identifier of a current, non-deleted service offering defined on your team. On update, set it to `null` to remove an assigned service; on create, omit it to leave the stop without a service.
                              type: string
                              minLength: 1
                              maxLength: 32
                              pattern: ^[a-zA-Z0-9]+$
                            - type: "null"
                        slaStartsAt:
                          anyOf:
                            - type: integer
                              exclusiveMinimum: 0
                              maximum: 9007199254740991
                              description: The SLA start time for this stop, in seconds since Unix epoch. Allows backdating when the actual order time is known. Can be provided with or without a service identifier.
                            - type: "null"
                      additionalProperties: false
                      description: Service offering data for this stop. Combines the service identifier and SLA start time. On update, set the whole object to `null` to clear all service info.
                    - type: "null"
              required:
                - address
              additionalProperties: false
              description: The request body for creating a stop. The only required field is address, you need to provide at least one of the fields in it. The latitude and longitude fields will override any of the other fields if they are set(and they need to be both set if any of them are). The more fields you provide the more accurate the geocoding will be.
        required: true
        description: The request body for creating a stop. The only required field is address, you need to provide at least one of the fields in it. The latitude and longitude fields will override any of the other fields if they are set(and they need to be both set if any of them are). The more fields you provide the more accurate the geocoding will be.
      parameters:
        - schema:
            type: string
            pattern: ^[a-zA-Z0-9---_]{1,50}$
          in: path
          name: planId
          required: true
          description: The plan 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.
                      allowedDrivers:
                        type: array
                        items:
                          type: string
                          pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
                        description: The driver IDs that can be assigned to this stop
                      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.
                          invoiceNumber:
                            description: Invoice number associated with the order.
                            type:
                              - "null"
                              - string
                          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
                          - invoiceNumber
                          - 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"
                              timeAtStopInfo:
                                oneOf:
                                  - type: object
                                    properties:
                                      status:
                                        type: string
                                        enum:
                                          - available
                                      value:
                                        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
                                        additionalProperties: false
                                        description: Grouped time-at-stop data.
                                    required:
                                      - status
                                      - value
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      status:
                                        type: string
                                        enum:
                                          - restricted
                                      requiredFeature:
                                        type: string
                                      upgradeUrl:
                                        type: string
                                      restrictionCode:
                                        type: string
                                        enum:
                                          - subscription_not_supported
                                    required:
                                      - status
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      status:
                                        type: string
                                        enum:
                                          - pending
                                      pendingReason:
                                        type: string
                                        enum:
                                          - not_yet_arrived
                                    required:
                                      - status
                                    additionalProperties: false
                              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
                              - timeAtStopInfo
                              - 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:
                        oneOf:
                          - type: object
                            properties:
                              status:
                                type: string
                                enum:
                                  - available
                              value:
                                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.
                            required:
                              - status
                              - value
                            additionalProperties: false
                          - type: object
                            properties:
                              status:
                                type: string
                                enum:
                                  - restricted
                              requiredFeature:
                                type: string
                              upgradeUrl:
                                type: string
                              restrictionCode:
                                type: string
                                enum:
                                  - subscription_not_supported
                            required:
                              - status
                            additionalProperties: false
                          - type: object
                            properties:
                              status:
                                type: string
                                enum:
                                  - pending
                              pendingReason:
                                type: string
                                enum:
                                  - not_optimized
                            required:
                              - status
                            additionalProperties: false
                      timing:
                        type: object
                        properties:
                          timeWindows:
                            maxItems: 2
                            type: array
                            items:
                              type: object
                              properties:
                                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: Earliest attempt time in this window. Null means there is no earliest time constraint.
                                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: Latest attempt time in this window. Null means there is no latest time constraint.
                              required:
                                - earliestAttemptTime
                                - latestAttemptTime
                              additionalProperties: false
                              description: An arrival window for the stop.
                            description: Ordered arrival windows for this stop.
                          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:
                          - timeWindows
                          - 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.
                      clientId:
                        description: The associated Client ID of the Spoke Connect
                        type:
                          - "null"
                          - string
                      serviceInfo:
                        oneOf:
                          - type: object
                            properties:
                              status:
                                type: string
                                enum:
                                  - available
                              value:
                                anyOf:
                                  - type: object
                                    properties:
                                      identifier:
                                        type: string
                                        description: The service offering identifier, as configured in Spoke Dispatch, captured at assignment time. Not currently discoverable through the public API.
                                      name:
                                        type: string
                                        description: The human-readable service name.
                                      slaStartsAt:
                                        type: number
                                        description: The SLA start time in seconds since epoch.
                                      slaDueDate:
                                        type: object
                                        properties:
                                          day:
                                            type: integer
                                            minimum: 1
                                            maximum: 31
                                            description: The day of the date.
                                          month:
                                            type: integer
                                            minimum: 1
                                            maximum: 12
                                            description: The month of the date.
                                          year:
                                            type: integer
                                            minimum: 2000
                                            maximum: 2100
                                            description: The year of the date.
                                        required:
                                          - day
                                          - month
                                          - year
                                        additionalProperties: false
                                        description: The computed SLA due date in the team's timezone.
                                      slaDueTime:
                                        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: SLA due time-of-day in the team's timezone, null for day-level SLA.
                                      deliveryHorizon:
                                        type: object
                                        properties:
                                          unit:
                                            anyOf:
                                              - type: string
                                                enum:
                                                  - days
                                                  - hours
                                              - type: string
                                            description: "The time unit of the delivery horizon. Known: `days`, `hours`."
                                          value:
                                            type: number
                                            description: The number of time units in the delivery horizon.
                                        required:
                                          - unit
                                          - value
                                        additionalProperties: false
                                        description: The delivery horizon for this service.
                                      price:
                                        type: object
                                        properties:
                                          value:
                                            type: number
                                            description: Price in minor currency units (e.g. cents).
                                          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: string
                                            description: 3-letter ISO 4217 currency code.
                                        required:
                                          - value
                                          - currency
                                        additionalProperties: false
                                        description: Price for this service at assignment time.
                                      hasPaymentOnDelivery:
                                        type: boolean
                                        description: Whether cash on delivery is enabled via the service.
                                      definedAt:
                                        type: number
                                        description: When the service was assigned in seconds since epoch.
                                    required:
                                      - identifier
                                      - name
                                      - slaStartsAt
                                      - slaDueDate
                                      - slaDueTime
                                      - deliveryHorizon
                                      - price
                                      - hasPaymentOnDelivery
                                      - definedAt
                                    additionalProperties: false
                                    description: Service offering data when a service is assigned to the stop.
                                  - type: object
                                    properties:
                                      identifier:
                                        type: "null"
                                        description: Null indicates no service offering is linked.
                                      slaStartsAt:
                                        type: number
                                        description: The SLA start time in seconds since epoch.
                                    required:
                                      - identifier
                                      - slaStartsAt
                                    additionalProperties: false
                                    description: Service data when only an SLA start time is set.
                                description: Service offering data for this stop.
                            required:
                              - status
                              - value
                            additionalProperties: false
                          - type: object
                            properties:
                              status:
                                type: string
                                enum:
                                  - empty
                            required:
                              - status
                            additionalProperties: false
                          - type: object
                            properties:
                              status:
                                type: string
                                enum:
                                  - restricted
                              requiredFeature:
                                type: string
                              upgradeUrl:
                                type: string
                              restrictionCode:
                                type: string
                                enum:
                                  - subscription_not_supported
                            required:
                              - status
                            additionalProperties: false
                        description: Service offering data for this stop.
                    required:
                      - id
                      - address
                      - barcodes
                      - allowedDrivers
                      - estimatedTravelDuration
                      - estimatedTravelDistance
                      - notes
                      - packageCount
                      - weight
                      - type
                      - packageLabel
                      - stopPosition
                      - trackingLink
                      - webAppLink
                      - orderInfo
                      - placeInVehicle
                      - recipient
                      - deliveryInfo
                      - paymentOnDelivery
                      - proofOfAttemptRequirements
                      - plan
                      - route
                      - eta
                      - timing
                      - customProperties
                      - clientId
                      - serviceInfo
                    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
        "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: The plan or driver was not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                required:
                  - message
                description: The plan or driver was 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
        "410":
          description: Failed to create stop
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    enum:
                      - Failed to create stop. Some related resources were deleted while the request was being processed.
                required:
                  - message
                description: Failed to create stop
        "422":
          description: The stop is unprocessable.
          content:
            application/json:
              schema:
                oneOf:
                  - 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
                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.
        allowedDrivers:
          type: array
          items:
            type: string
            pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
          description: The driver IDs that can be assigned to this stop
        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.
            invoiceNumber:
              description: Invoice number associated with the order.
              type:
                - "null"
                - string
            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
            - invoiceNumber
            - 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"
                timeAtStopInfo:
                  oneOf:
                    - type: object
                      properties:
                        status:
                          type: string
                          enum:
                            - available
                        value:
                          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
                          additionalProperties: false
                          description: Grouped time-at-stop data.
                      required:
                        - status
                        - value
                      additionalProperties: false
                    - type: object
                      properties:
                        status:
                          type: string
                          enum:
                            - restricted
                        requiredFeature:
                          type: string
                        upgradeUrl:
                          type: string
                        restrictionCode:
                          type: string
                          enum:
                            - subscription_not_supported
                      required:
                        - status
                      additionalProperties: false
                    - type: object
                      properties:
                        status:
                          type: string
                          enum:
                            - pending
                        pendingReason:
                          type: string
                          enum:
                            - not_yet_arrived
                      required:
                        - status
                      additionalProperties: false
                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
                - timeAtStopInfo
                - 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:
          oneOf:
            - type: object
              properties:
                status:
                  type: string
                  enum:
                    - available
                value:
                  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.
              required:
                - status
                - value
              additionalProperties: false
            - type: object
              properties:
                status:
                  type: string
                  enum:
                    - restricted
                requiredFeature:
                  type: string
                upgradeUrl:
                  type: string
                restrictionCode:
                  type: string
                  enum:
                    - subscription_not_supported
              required:
                - status
              additionalProperties: false
            - type: object
              properties:
                status:
                  type: string
                  enum:
                    - pending
                pendingReason:
                  type: string
                  enum:
                    - not_optimized
              required:
                - status
              additionalProperties: false
        timing:
          type: object
          properties:
            timeWindows:
              maxItems: 2
              type: array
              items:
                type: object
                properties:
                  earliestAttemptTime:
                    anyOf:
                      - $ref: "#/components/schemas/timeOfDaySchema"
                      - type: "null"
                    description: Earliest attempt time in this window. Null means there is no earliest time constraint.
                  latestAttemptTime:
                    anyOf:
                      - $ref: "#/components/schemas/timeOfDaySchema"
                      - type: "null"
                    description: Latest attempt time in this window. Null means there is no latest time constraint.
                required:
                  - earliestAttemptTime
                  - latestAttemptTime
                additionalProperties: false
                description: An arrival window for the stop.
              description: Ordered arrival windows for this stop.
            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:
            - timeWindows
            - 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.
        clientId:
          description: The associated Client ID of the Spoke Connect
          type:
            - "null"
            - string
        serviceInfo:
          oneOf:
            - type: object
              properties:
                status:
                  type: string
                  enum:
                    - available
                value:
                  anyOf:
                    - type: object
                      properties:
                        identifier:
                          type: string
                          description: The service offering identifier, as configured in Spoke Dispatch, captured at assignment time. Not currently discoverable through the public API.
                        name:
                          type: string
                          description: The human-readable service name.
                        slaStartsAt:
                          type: number
                          description: The SLA start time in seconds since epoch.
                        slaDueDate:
                          type: object
                          properties:
                            day:
                              type: integer
                              minimum: 1
                              maximum: 31
                              description: The day of the date.
                            month:
                              type: integer
                              minimum: 1
                              maximum: 12
                              description: The month of the date.
                            year:
                              type: integer
                              minimum: 2000
                              maximum: 2100
                              description: The year of the date.
                          required:
                            - day
                            - month
                            - year
                          additionalProperties: false
                          description: The computed SLA due date in the team's timezone.
                        slaDueTime:
                          anyOf:
                            - $ref: "#/components/schemas/timeOfDaySchema"
                            - type: "null"
                          description: SLA due time-of-day in the team's timezone, null for day-level SLA.
                        deliveryHorizon:
                          type: object
                          properties:
                            unit:
                              anyOf:
                                - type: string
                                  enum:
                                    - days
                                    - hours
                                - type: string
                              description: "The time unit of the delivery horizon. Known: `days`, `hours`."
                            value:
                              type: number
                              description: The number of time units in the delivery horizon.
                          required:
                            - unit
                            - value
                          additionalProperties: false
                          description: The delivery horizon for this service.
                        price:
                          type: object
                          properties:
                            value:
                              type: number
                              description: Price in minor currency units (e.g. cents).
                            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: string
                              description: 3-letter ISO 4217 currency code.
                          required:
                            - value
                            - currency
                          additionalProperties: false
                          description: Price for this service at assignment time.
                        hasPaymentOnDelivery:
                          type: boolean
                          description: Whether cash on delivery is enabled via the service.
                        definedAt:
                          type: number
                          description: When the service was assigned in seconds since epoch.
                      required:
                        - identifier
                        - name
                        - slaStartsAt
                        - slaDueDate
                        - slaDueTime
                        - deliveryHorizon
                        - price
                        - hasPaymentOnDelivery
                        - definedAt
                      additionalProperties: false
                      description: Service offering data when a service is assigned to the stop.
                    - type: object
                      properties:
                        identifier:
                          type: "null"
                          description: Null indicates no service offering is linked.
                        slaStartsAt:
                          type: number
                          description: The SLA start time in seconds since epoch.
                      required:
                        - identifier
                        - slaStartsAt
                      additionalProperties: false
                      description: Service data when only an SLA start time is set.
                  description: Service offering data for this stop.
              required:
                - status
                - value
              additionalProperties: false
            - type: object
              properties:
                status:
                  type: string
                  enum:
                    - empty
              required:
                - status
              additionalProperties: false
            - type: object
              properties:
                status:
                  type: string
                  enum:
                    - restricted
                requiredFeature:
                  type: string
                upgradeUrl:
                  type: string
                restrictionCode:
                  type: string
                  enum:
                    - subscription_not_supported
              required:
                - status
              additionalProperties: false
          description: Service offering data for this stop.
      required:
        - id
        - address
        - barcodes
        - allowedDrivers
        - estimatedTravelDuration
        - estimatedTravelDistance
        - notes
        - packageCount
        - weight
        - type
        - packageLabel
        - stopPosition
        - trackingLink
        - webAppLink
        - orderInfo
        - placeInVehicle
        - recipient
        - deliveryInfo
        - paymentOnDelivery
        - proofOfAttemptRequirements
        - plan
        - route
        - eta
        - timing
        - customProperties
        - clientId
        - serviceInfo
      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.
````