{
  "openapi": "3.0.3",
  "info": {
    "title": "Sendaparcel Order Imports API",
    "version": "1.0.0",
    "description": "Push orders for manual review and booking. Separate test/live Bearer keys. Polling supported; outgoing webhooks are not part of v1."
  },
  "servers": [
    {
      "url": "https://sendaparcel.com.au"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/v1/imports": {
      "post": {
        "operationId": "post_api_v1_imports",
        "responses": {
          "200": {
            "description": "Success; import creation is not a courier booking",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResult"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or inactive key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found within customer and environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Shipment locked or import changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body over 64 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Retry safely using the same reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Order"
              }
            }
          }
        }
      }
    },
    "/api/v1/imports/{reference}": {
      "get": {
        "operationId": "get_api_v1_imports_reference",
        "responses": {
          "200": {
            "description": "Success; import creation is not a courier booking",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderStatus"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or inactive key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found within customer and environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Shipment locked or import changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body over 64 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Retry safely using the same reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "put": {
        "operationId": "put_api_v1_imports_reference",
        "responses": {
          "200": {
            "description": "Success; import creation is not a courier booking",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResult"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or inactive key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found within customer and environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Shipment locked or import changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body over 64 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Retry safely using the same reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Order"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_api_v1_imports_reference",
        "responses": {
          "200": {
            "description": "Success; import creation is not a courier booking",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResult"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or inactive key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found within customer and environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Shipment locked or import changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body over 64 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Retry safely using the same reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/labels/{id}": {
      "get": {
        "operationId": "get_api_v1_labels_id",
        "responses": {
          "200": {
            "description": "Private PDF; use Bearer authentication",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, revoked or inactive key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found within customer and environment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Shipment locked or import changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body over 64 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Retry safely using the same reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Order": {
        "type": "object",
        "required": [
          "reference",
          "recipient",
          "deliveryAddress",
          "items"
        ],
        "properties": {
          "reference": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
          },
          "orderedAt": {
            "type": "string",
            "format": "date-time"
          },
          "recipient": {
            "type": "object",
            "required": [
              "name",
              "phone"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "businessName": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "deliveryAddress": {
            "type": "object",
            "required": [
              "line1",
              "suburb",
              "state",
              "postcode",
              "country"
            ],
            "properties": {
              "line1": {
                "type": "string"
              },
              "line2": {
                "type": "string"
              },
              "suburb": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "postcode": {
                "type": "string",
                "pattern": "^[0-9]{4}$"
              },
              "country": {
                "type": "string",
                "enum": [
                  "AU"
                ]
              }
            }
          },
          "deliveryInstructions": {
            "type": "string",
            "maxLength": 250
          },
          "residential": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "required": [
                "name",
                "quantity"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "maxLength": 200
                },
                "sku": {
                  "type": "string",
                  "maxLength": 100
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10000
                }
              }
            }
          },
          "parcels": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "type",
                "lengthCm",
                "widthCm",
                "heightCm",
                "weightKg"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "carton",
                    "satchel"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 99
                },
                "lengthCm": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 180
                },
                "widthCm": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 180
                },
                "heightCm": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 180
                },
                "weightKg": {
                  "type": "number",
                  "minimum": 0.01,
                  "maximum": 25
                }
              },
              "description": "Length + width + height \u2264180 cm. Satchels \u22645 kg. At most 99 pieces total."
            }
          }
        },
        "example": {
          "reference": "JV-100042",
          "orderedAt": "2026-11-03T09:15:00+08:00",
          "recipient": {
            "name": "Jane Citizen",
            "businessName": "Example Medical Centre",
            "phone": "0400 000 000",
            "email": "jane@example.com"
          },
          "deliveryAddress": {
            "line1": "Unit 2, 10 Sample Street",
            "line2": "",
            "suburb": "Subiaco",
            "state": "WA",
            "postcode": "6008",
            "country": "AU"
          },
          "deliveryInstructions": "Leave at reception, business hours only",
          "items": [
            {
              "sku": "P6304",
              "name": "Rosche Modern Compact Hand Towel 1-ply \u2014 Carton of 16 packs",
              "quantity": 2,
              "unitPriceIncGst": 42.95
            },
            {
              "sku": "JVMER57",
              "name": "Examination Bed Roll 57cm x 50m \u2014 6 rolls/carton",
              "quantity": 1,
              "unitPriceIncGst": 57.99
            }
          ],
          "parcels": [
            {
              "type": "carton",
              "lengthCm": 40,
              "widthCm": 30,
              "heightCm": 25,
              "weightKg": 5.3
            }
          ],
          "orderTotalIncGst": 143.89
        }
      },
      "ImportResult": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          },
          "importId": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "imported",
              "withdrawn"
            ]
          },
          "duplicate": {
            "type": "boolean"
          },
          "requiresReview": {
            "type": "boolean"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "OrderStatus": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          },
          "importId": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "status": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "shipment": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "carrier": {
                "type": "string"
              },
              "trackingNumber": {
                "type": "string",
                "nullable": true
              },
              "bookingReference": {
                "type": "string",
                "nullable": true
              },
              "pickupBookingId": {
                "type": "string",
                "nullable": true
              },
              "labelRequired": {
                "type": "boolean"
              },
              "labels": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "requiresBearer": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
