---
title: Create an order
description: Create a new order for the authenticated retailer.
url: /api/orders/createOrder
---

# Create an order

`POST /orders`

````yaml
openapi: 3.2.0
info:
  title: Spoke Connect API
  version: v1
servers:
  - url: https://api.spoke.com/connect/v1
security:
  - BearerAuth: []
  - BasicAuth: []
paths:
  /orders:
    post:
      operationId: createOrder
      summary: Create an order
      tags:
        - Orders
      description: Create a new order for the authenticated retailer.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                address:
                  type: object
                  properties:
                    addressLineOne:
                      description: First line of the address.
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 255
                        - type: "null"
                    addressLineTwo:
                      description: Second line of the address.
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 255
                        - type: "null"
                    city:
                      description: City.
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 100
                        - type: "null"
                    state:
                      description: State.
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 100
                        - type: "null"
                    zip:
                      description: Postal code.
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 100
                        - type: "null"
                    country:
                      description: Country.
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 100
                        - type: "null"
                    addressName:
                      description: Display-only name for the address. Not used for geocoding.
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 255
                        - type: "null"
                    latitude:
                      description: Latitude in decimal degrees. Overrides the line fields when set.
                      anyOf:
                        - type: number
                          minimum: -90
                          maximum: 90
                        - type: "null"
                    longitude:
                      description: Longitude in decimal degrees. Overrides the line fields when set.
                      anyOf:
                        - type: number
                          minimum: -180
                          maximum: 180
                        - type: "null"
                  additionalProperties: false
                  description: Address of the delivery. Every field is optional on its own, but you must provide at least one that can locate the delivery. `addressName` is a display-only label and is never used for geocoding, so it does not count. When `latitude` and `longitude` are set they must be set together and override the other fields for geocoding.
                recipient:
                  anyOf:
                    - type: object
                      properties:
                        name:
                          description: Full name of the recipient.
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                        email:
                          description: Email address of the recipient.
                          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"
                        externalId:
                          description: The retailer's own id for this recipient in their system. Shown as "Seller external ID" in the Spoke Connect app.
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                      additionalProperties: false
                      description: Recipient fields accepted when creating or editing an order.
                    - type: "null"
                packageInfo:
                  anyOf:
                    - type: object
                      properties:
                        products:
                          description: The products that are part of the order.
                          maxItems: 100
                          type: array
                          items:
                            type: string
                            minLength: 1
                            maxLength: 255
                        packageCount:
                          description: The amount of packages in the order, from 1 to 99. A barcode is created per package. Defaults to 1.
                          anyOf:
                            - type: integer
                              minimum: 1
                              maximum: 99
                            - type: "null"
                        weight:
                          description: Weight information for this order.
                          anyOf:
                            - type: object
                              properties:
                                amount:
                                  type: number
                                  minimum: 0
                                  maximum: 999999
                                  multipleOf: 0.01
                                  description: The weight amount for this order.
                                unit:
                                  type: string
                                  enum:
                                    - kilogram
                                    - pound
                                    - metric-ton
                                  description: The weight unit in which the amount is specified.
                              required:
                                - amount
                                - unit
                              additionalProperties: false
                            - type: "null"
                        packageLoadAmount:
                          description: "Deprecated: weight in grams, regardless of the retailer weight setting. Use weight instead. Do not send both fields."
                          deprecated: true
                          anyOf:
                            - type: number
                              exclusiveMinimum: 0
                            - type: "null"
                        externalId:
                          description: The retailer's own id for this order in their own system. Shown as "Seller order ID" in the Spoke Connect app.
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 255
                            - type: "null"
                      additionalProperties: false
                      description: Package details accepted when creating or editing an order. Send only one of weight or packageLoadAmount, including when clearing with null. Set `weight` or `packageLoadAmount`, not both.
                    - type: "null"
                deliveryInstructions:
                  anyOf:
                    - type: object
                      properties:
                        notes:
                          description: Notes for the delivery.
                          anyOf:
                            - type: string
                              minLength: 1
                              maxLength: 2000
                            - type: "null"
                        expectedDeliveryDate:
                          description: Calendar date the retailer expects delivery on. Date-only, in the retailer's local timezone.
                          anyOf:
                            - 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: A date.
                            - type: "null"
                        proofOfAttemptRequirements:
                          anyOf:
                            - type: object
                              properties:
                                enabled:
                                  description: Whether the driver must collect proof (signature or photo) on attempt. `null` (or omitted) uses the courier's default.
                                  type:
                                    - boolean
                                    - "null"
                              additionalProperties: false
                              description: Proof-of-attempt fields accepted when creating or editing an order.
                            - type: "null"
                        handOffInfo:
                          anyOf:
                            - type: object
                              properties:
                                handOffType:
                                  description: The hand-off type. `null` (or omitted) means `pickup_by_courier`. `ship_to_courier` is deprecated.
                                  anyOf:
                                    - type: string
                                      enum:
                                        - ship_to_courier
                                        - pickup_by_courier
                                      description: "How an order is handed off to the courier. `ship_to_courier` is deprecated: a request that sends it is treated as `pickup_by_courier`, and a future API version will reject it."
                                    - type: "null"
                                pickupLocationId:
                                  description: The retailer location the courier picks up from. Only applies when `handOffType` is `pickup_by_courier`.
                                  anyOf:
                                    - type: string
                                      pattern: ^pickupLocations\/[a-zA-Z0-9_-]{1,50}$
                                      description: Unique identifier of a pickup location, in the format `pickupLocations/{id}`.
                                    - type: "null"
                              additionalProperties: false
                              description: Hand-off fields accepted when creating or editing an order.
                            - type: "null"
                      additionalProperties: false
                      description: Delivery-instruction fields accepted when creating or editing an order.
                    - type: "null"
              required:
                - address
              additionalProperties: false
              description: Input shape accepted by `POST /orders` and `POST /orders:import`. Only `address` is required.
        required: true
        description: Input shape accepted by `POST /orders` and `POST /orders:import`. Only `address` is required.
      responses:
        "201":
          description: The created order.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    allOf:
                      - $ref: "#/components/schemas/connectOrderIdSchema"
                    description: The Spoke order ID.
                  createdAt:
                    type: number
                    description: Timestamp in seconds when the order was created.
                  recipient:
                    type: object
                    properties:
                      name:
                        description: Full name of the recipient.
                        type:
                          - "null"
                          - string
                      email:
                        description: Email address of the recipient.
                        type:
                          - "null"
                          - string
                      phone:
                        description: Phone number of the recipient.
                        type:
                          - "null"
                          - string
                      externalId:
                        description: The retailer's own id for this recipient in their system. Shown as "Seller external ID" in the Spoke Connect app.
                        type:
                          - "null"
                          - string
                    required:
                      - name
                      - email
                      - phone
                      - externalId
                    additionalProperties: false
                    description: Recipient of the delivery.
                  packageInfo:
                    type: object
                    properties:
                      products:
                        type: array
                        items:
                          type: string
                        description: The products that are part of the order.
                      packageCount:
                        type: number
                        description: The amount of packages that are part of the order. For every package, a barcode will be created.
                      weight:
                        anyOf:
                          - type: object
                            properties:
                              amount:
                                type: number
                                minimum: 0
                                description: The weight amount for this order.
                              unit:
                                anyOf:
                                  - type: string
                                    enum:
                                      - kilogram
                                      - pound
                                      - metric-ton
                                  - type: string
                                description: The weight unit in which the amount is specified (defined by the retailer's weight setting).
                            required:
                              - amount
                              - unit
                            additionalProperties: false
                          - type: "null"
                        description: Weight information for this order.
                      packageLoadAmount:
                        description: "Deprecated: weight in grams, regardless of the retailer weight setting. Use weight instead."
                        deprecated: true
                        type:
                          - "null"
                          - number
                      externalId:
                        description: The retailer's own id for this order in their own system. Shown as "Seller order ID" in the Spoke Connect app.
                        type:
                          - "null"
                          - string
                    required:
                      - products
                      - packageCount
                      - weight
                      - packageLoadAmount
                      - externalId
                    additionalProperties: false
                    description: "Package details: products, quantities, and the retailer's own id for this order."
                  address:
                    type: object
                    properties:
                      address:
                        type: string
                        description: Combined address string. Computed by geocoding, and empty when the order was created from coordinates only.
                      addressLineOne:
                        type: string
                        description: First line of the address.
                      addressLineTwo:
                        type: string
                        description: Second line of the address.
                      latitude:
                        description: Latitude coordinate in decimal degrees.
                        type:
                          - "null"
                          - number
                      longitude:
                        description: Longitude coordinate in decimal degrees.
                        type:
                          - "null"
                          - number
                      placeId:
                        description: Google Places identifier for this location.
                        type:
                          - "null"
                          - string
                      placeTypes:
                        type: array
                        items:
                          type: string
                        description: Place types from the Google Places API.
                    required:
                      - address
                      - addressLineOne
                      - addressLineTwo
                      - latitude
                      - longitude
                      - placeId
                      - placeTypes
                    additionalProperties: false
                    description: Address of the delivery as returned on an `Order`.
                  deliveryInstructions:
                    type: object
                    properties:
                      notes:
                        description: Notes for the delivery.
                        type:
                          - "null"
                          - string
                      expectedDeliveryDate:
                        anyOf:
                          - 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: A date.
                          - type: "null"
                        description: Calendar date the retailer expects delivery on. Date-only, in the retailer's local timezone.
                      proofOfAttemptRequirements:
                        type: object
                        properties:
                          enabled:
                            description: Whether the driver must collect proof (signature or photo) on attempt. `null` uses the courier default, `false` disables it for this order, `true` enables it following the courier per-attempt-type policies.
                            type:
                              - "null"
                              - boolean
                        required:
                          - enabled
                        additionalProperties: false
                        description: Proof-of-attempt requirements for an order.
                      handOffInfo:
                        type: object
                        properties:
                          handOffType:
                            anyOf:
                              - type: string
                                enum:
                                  - ship_to_courier
                                  - pickup_by_courier
                                description: "How an order is handed off to the courier. `ship_to_courier` is deprecated: a request that sends it is treated as `pickup_by_courier`, and a future API version will reject it."
                              - type: "null"
                            description: "The hand-off type. `pickup_by_courier`: the courier picks up from a retailer location. `ship_to_courier` (deprecated): only on older orders, which the retailer ships to the courier. When `null`, the courier picks up the order."
                          pickupLocationId:
                            anyOf:
                              - $ref: "#/components/schemas/connectPickupLocationIdSchema"
                              - type: "null"
                            description: The retailer location the courier picks up from when `handOffType` is `pickup_by_courier`. Must be `null` when `handOffType` is `ship_to_courier`.
                        required:
                          - handOffType
                          - pickupLocationId
                        additionalProperties: false
                        description: How an order is handed off to the courier.
                    required:
                      - notes
                      - expectedDeliveryDate
                      - proofOfAttemptRequirements
                      - handOffInfo
                    additionalProperties: false
                    description: "How and when an order should be delivered: notes, the expected delivery date, proof-of-attempt requirements, and hand-off details."
                  courier:
                    anyOf:
                      - $ref: "#/components/schemas/connectCourierIdSchema"
                      - type: "null"
                    description: The courier this order has been submitted to. `null` until the order is submitted.
                  submitted:
                    type: boolean
                    description: Whether the order has been submitted to a courier.
                  submittedAt:
                    description: Timestamp in seconds when the order was submitted to a courier.
                    type:
                      - "null"
                      - number
                  progress:
                    anyOf:
                      - type: object
                        properties:
                          trackingLink:
                            description: Tracking link the recipient can follow.
                            type:
                              - string
                              - "null"
                          eta:
                            oneOf:
                              - type: object
                                properties:
                                  status:
                                    type: string
                                    enum:
                                      - available
                                  value:
                                    type: object
                                    properties:
                                      estimatedArrivalAt:
                                        type: number
                                        description: Estimated arrival, in seconds since epoch.
                                      estimatedEarliestArrivalAt:
                                        type: number
                                        description: Earliest arrival of the window, in seconds since epoch.
                                      estimatedLatestArrivalAt:
                                        type: number
                                        description: Latest arrival of the window, in seconds since epoch.
                                    required:
                                      - estimatedArrivalAt
                                      - estimatedEarliestArrivalAt
                                      - estimatedLatestArrivalAt
                                    additionalProperties: false
                                    description: Estimated time of arrival, with an earliest and latest window.
                                required:
                                  - status
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  status:
                                    type: string
                                    enum:
                                      - restricted
                                  restrictionCode:
                                    type: string
                                required:
                                  - status
                                additionalProperties: false
                              - type: object
                                properties:
                                  status:
                                    type: string
                                    enum:
                                      - pending
                                  pendingReason:
                                    type: string
                                required:
                                  - status
                                additionalProperties: false
                          attempted:
                            type: boolean
                            description: Whether a delivery attempt has been completed, successful or not.
                          attemptedAt:
                            description: Timestamp in seconds of when the driver attempted delivery.
                            type:
                              - number
                              - "null"
                          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_missing_required_proof
                              - failed_payment_not_received
                              - failed_other
                              - unattempted
                            description: The current state of the delivery.
                          routeStartDate:
                            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: Date the route started or is planned to start.
                          routeStarted:
                            type: boolean
                            description: Whether the route this order is on has been started by the driver.
                          succeeded:
                            type: boolean
                            description: Whether the delivery was successful.
                          photoUrls:
                            type: array
                            items:
                              type: string
                            description: URLs of proof-of-attempt photos taken by the driver. A URL can return not-found while the driver's app is still uploading the photo.
                          signatureUrl:
                            description: URL of the captured signature image, when one was collected. Subject to the same upload delay as `photoUrls`.
                            type:
                              - string
                              - "null"
                          signeeName:
                            description: Name of the signee, when a signature was collected.
                            type:
                              - string
                              - "null"
                          driverProvidedRecipientNotes:
                            description: Notes provided by the driver for the recipient.
                            type:
                              - string
                              - "null"
                        required:
                          - trackingLink
                          - eta
                          - attempted
                          - attemptedAt
                          - state
                          - routeStartDate
                          - routeStarted
                          - succeeded
                          - photoUrls
                          - signatureUrl
                          - signeeName
                          - driverProvidedRecipientNotes
                        additionalProperties: false
                        description: "Progress for an order: ETA, attempt outcome, and any proof captured on the delivery attempt."
                      - type: "null"
                    description: Progress for the order. `null` until the courier assigns the order to a route.
                  readOnly:
                    type: boolean
                    description: Whether the order is read-only. Read-only orders cannot be edited or withdrawn.
                  source:
                    type: string
                    enum:
                      - retailer
                      - courier
                    description: "Where the order originated. `retailer`: created by the retailer. `courier`: added by the courier on the retailer's behalf, surfaced read-only."
                  barcodes:
                    type: array
                    items:
                      type: string
                    description: List of barcodes associated with the Order.
                required:
                  - id
                  - createdAt
                  - recipient
                  - packageInfo
                  - address
                  - deliveryInstructions
                  - courier
                  - submitted
                  - submittedAt
                  - progress
                  - readOnly
                  - source
                  - barcodes
                additionalProperties: false
                description: The created order.
                definitions:
                  connectOrderIdSchema:
                    type: string
                    pattern: ^orders\/[a-zA-Z0-9_-]{1,50}$
                    description: Unique identifier of an order, in the format `orders/{id}`.
                  connectPickupLocationIdSchema:
                    type: string
                    pattern: ^pickupLocations\/[a-zA-Z0-9_-]{1,50}$
                    description: Unique identifier of a pickup location, in the format `pickupLocations/{id}`.
                  connectCourierIdSchema:
                    type: string
                    pattern: ^couriers\/[a-zA-Z0-9_-]{1,50}$
                    description: Unique identifier of a courier, in the format `couriers/{id}`.
        "400":
          description: The request is invalid.
          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 is invalid.
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Unauthorized
        "422":
          description: The order could not be processed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    enum:
                      - order_address_unresolvable
                      - order_invalid_fields
                  param:
                    type: string
                    description: The parameter that caused the error.
                required:
                  - message
                  - code
                description: The order could not be processed.
        "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:
    connectCourierIdSchema:
      type: string
      pattern: ^couriers\/[a-zA-Z0-9_-]{1,50}$
      description: Unique identifier of a courier, in the format `couriers/{id}`.
    connectOrderIdSchema:
      type: string
      pattern: ^orders\/[a-zA-Z0-9_-]{1,50}$
      description: Unique identifier of an order, in the format `orders/{id}`.
    connectPickupLocationIdSchema:
      type: string
      pattern: ^pickupLocations\/[a-zA-Z0-9_-]{1,50}$
      description: Unique identifier of a pickup location, in the format `pickupLocations/{id}`.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Pass the API key directly as the token.
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````