---
title: Batch import orders
description: Create up to 100 orders for the authenticated retailer in one
  request. Always returns `200`; per-item outcomes are split across `success`
  and `failed`.
url: /api/orders/importOrders
---

# Batch import orders

`POST /orders:import`

````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:import:
    post:
      operationId: importOrders
      summary: Batch import orders
      tags:
        - Orders
      description: Create up to 100 orders for the authenticated retailer in one request. Always returns `200`; per-item outcomes are split across `success` and `failed`.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                orders:
                  minItems: 1
                  maxItems: 100
                  type: array
                  items:
                    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.
                  description: The orders to create. At most 100 per request.
              required:
                - orders
              additionalProperties: false
              description: Input shape accepted by `POST /orders:import`.
        required: true
        description: Input shape accepted by `POST /orders:import`.
      responses:
        "200":
          description: The per-item results. Always returned when the request itself is valid, even when every order fails.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: array
                    items:
                      type: string
                      pattern: ^orders\/[a-zA-Z0-9_-]{1,50}$
                      description: Unique identifier of an order, in the format `orders/{id}`.
                    description: The ids of the orders created successfully.
                  failed:
                    type: array
                    items:
                      type: object
                      properties:
                        order:
                          type: object
                          properties:
                            address:
                              type: object
                              properties:
                                addressLineOne:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 255
                                    - type: "null"
                                  description: First line of the address.
                                addressLineTwo:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 255
                                    - type: "null"
                                  description: Second line of the address.
                                city:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 100
                                    - type: "null"
                                  description: City.
                                state:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 100
                                    - type: "null"
                                  description: State.
                                zip:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 100
                                    - type: "null"
                                  description: Postal code.
                                country:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 100
                                    - type: "null"
                                  description: Country.
                                addressName:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                      maxLength: 255
                                    - type: "null"
                                  description: Display-only name for the address. Not used for geocoding.
                                latitude:
                                  anyOf:
                                    - type: number
                                      minimum: -90
                                      maximum: 90
                                    - type: "null"
                                  description: Latitude in decimal degrees. Overrides the line fields when set.
                                longitude:
                                  anyOf:
                                    - type: number
                                      minimum: -180
                                      maximum: 180
                                    - type: "null"
                                  description: Longitude in decimal degrees. Overrides the line fields when set.
                              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:
                                      anyOf:
                                        - type: string
                                          minLength: 1
                                          maxLength: 255
                                        - type: "null"
                                      description: Full name of the recipient.
                                    email:
                                      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"
                                      description: Email address of the recipient.
                                    phone:
                                      anyOf:
                                        - type: string
                                          minLength: 1
                                          maxLength: 255
                                        - type: "null"
                                      description: Phone number of the recipient.
                                    externalId:
                                      anyOf:
                                        - type: string
                                          minLength: 1
                                          maxLength: 255
                                        - type: "null"
                                      description: The retailer's own id for this recipient in their system. Shown as "Seller external ID" in the Spoke Connect app.
                                  additionalProperties: false
                                  description: Recipient fields accepted when creating or editing an order.
                                - type: "null"
                            packageInfo:
                              anyOf:
                                - type: object
                                  properties:
                                    products:
                                      maxItems: 100
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                        maxLength: 255
                                      description: The products that are part of the order.
                                    packageCount:
                                      anyOf:
                                        - type: integer
                                          minimum: 1
                                          maximum: 99
                                        - type: "null"
                                      description: The amount of packages in the order, from 1 to 99. A barcode is created per package. Defaults to 1.
                                    weight:
                                      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"
                                      description: Weight information for this order.
                                    packageLoadAmount:
                                      anyOf:
                                        - type: number
                                          exclusiveMinimum: 0
                                        - type: "null"
                                      description: "Deprecated: weight in grams, regardless of the retailer weight setting. Use weight instead. Do not send both fields."
                                      deprecated: true
                                    externalId:
                                      anyOf:
                                        - type: string
                                          minLength: 1
                                          maxLength: 255
                                        - type: "null"
                                      description: The retailer's own id for this order in their own system. Shown as "Seller order ID" in the Spoke Connect app.
                                  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:
                                      anyOf:
                                        - type: string
                                          minLength: 1
                                          maxLength: 2000
                                        - type: "null"
                                      description: Notes for the delivery.
                                    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:
                                      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:
                                              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. `null` (or omitted) means `pickup_by_courier`. `ship_to_courier` is deprecated.
                                            pickupLocationId:
                                              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"
                                              description: The retailer location the courier picks up from. Only applies when `handOffType` is `pickup_by_courier`.
                                          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"
                            index:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                              description: The index in the request array, used to correlate the failure with the input.
                          additionalProperties: false
                        error:
                          type: object
                          properties:
                            code:
                              type: string
                              description: The public error code.
                            message:
                              type: string
                              description: A human-readable error message.
                          required:
                            - code
                            - message
                      required:
                        - order
                        - error
                    description: The inputs that failed, each with the public error code.
                required:
                  - success
                  - failed
                additionalProperties: false
                description: The per-item results. Always returned when the request itself is valid, even when every order fails.
        "400":
          description: The request is invalid, for example more than 100 orders.
          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, for example more than 100 orders.
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Unauthorized
        "500":
          description: An internal server error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: An internal server error occurred
        default:
          description: The default error model
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: The default error model
components:
  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.
````