> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add shipment to order

> Associate a shipment with an order using a shipping address and option.

## Request

```http theme={null}
POST /orders/add-shipment
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json

{
  "orderId": "6a27d632289b87893fcbde35",
  "shippingAddressId": "6938e4f0019a97bc42775b59",
  "shippingOptionId": "69f8f047f5d9d8178331ec8a"
}
```

## Headers

| Header          | Type   | Description                                   |
| --------------- | ------ | --------------------------------------------- |
| `Authorization` | string | Provide the customer token as `Bearer <jwt>`. |
| `x-shop-id`     | string | Identify the shop that owns the order.        |
| `Content-Type`  | string | Always set to `application/json`.             |

## Body parameters

| Field               | Type   | Required | Description                                          |
| ------------------- | ------ | -------- | ---------------------------------------------------- |
| `orderId`           | string | Yes      | The order ID to associate with the shipment.         |
| `shippingAddressId` | string | Yes      | The shipping address ID to use for delivery.         |
| `shippingOptionId`  | string | Yes      | The shipping option to use.                          |
| `courierId`         | string | No       | ID of a specific courier within the shipping option. |

## Successful response

```json theme={null}
{
    "status": 200,
    "success": true,
    "message": "Shipment added to order",
    "data": {
        "shipment": {
            "_id": "6a27d67f289b87893fcbde40",
            "orders": [],
            "courier": {
                "id": null,
                "name": "Standard Delivery",
                "image": null
            },
            "shippingAddress": "6938e4f0019a97bc42775b59",
            "shippingOption": "69f8f047f5d9d8178331ec8a",
            "trackingCode": "",
            "trackingUrl": "",
            "status": "pending",
            "trackingHistory": [],
            "estimatedDelivery": null,
            "shippingCost": 5000,
            "packageDimensions": {
                "unit": "in"
            },
            "deleted": false,
            "deletedAt": null,
            "createdAt": "2026-06-09T09:01:51.440Z",
            "updatedAt": "2026-06-09T09:01:51.440Z",
            "__v": 0
        }
    }
}
```

## Error responses

### 404 Order not found

```json theme={null}
{
    "status": 404,
    "success": false,
    "message": "Order not found",
    "data": {}
}
```

### 400 Missing required field

```json theme={null}
{
    "status": 400,
    "success": false,
    "message": "\"orderId\" is required",
    "data": {}
}
```


## OpenAPI

````yaml POST /orders/add-shipment
openapi: 3.1.0
info:
  title: Salesive Store API
  description: >-
    REST interface for querying products, categories, and merchandising banners
    exposed by Salesive storefronts.
  version: 1.0.0
servers:
  - description: Production
    url: https://store.salesive.com/api/v1
security:
  - BearerAuth: []
    ShopIdHeader: []
paths:
  /orders/add-shipment:
    post:
      summary: Add shipment to order
      description: Associate a shipment with an order using shipping address and option.
      parameters:
        - $ref: '#/components/parameters/XShopIdHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddShipmentRequest'
      responses:
        '200':
          description: Shipment added to order successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '401':
          description: Unauthorized.
        '404':
          description: Order not found.
components:
  parameters:
    XShopIdHeader:
      name: x-shop-id
      in: header
      description: >-
        Optional identifier that scopes responses to a specific storefront when
        the referer cannot be inferred.
      required: false
      schema:
        type: string
  schemas:
    AddShipmentRequest:
      type: object
      required:
        - orderId
        - shippingAddressId
        - shippingOptionId
      properties:
        orderId:
          type: string
          description: The order ID to associate with the shipment.
        shippingAddressId:
          type: string
          description: The shipping address ID to use for delivery.
        shippingOptionId:
          type: string
          description: The shipping option/carrier to use.
    OrderResponse:
      type: object
      required:
        - status
        - success
        - message
        - data
      properties:
        status:
          type: integer
        success:
          type: boolean
        message:
          type: string
        data:
          $ref: '#/components/schemas/Order'
    Order:
      type: object
      required:
        - _id
        - orderId
        - user
        - shop
        - items
        - status
        - subtotal
        - shippingCost
        - total
      properties:
        _id:
          type: string
          description: Order identifier.
        orderId:
          type: integer
          description: Human-readable order number.
        user:
          type: string
          description: Identifier of the shopper who placed the order.
        shop:
          type: string
          description: Identifier of the shop associated with the order.
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrderItem'
        status:
          type: string
          enum:
            - pending
            - processing
            - paid
            - cancelled
            - refunded
          description: Current status of the order.
        subtotal:
          type: number
          description: Subtotal before shipping costs.
        shippingCost:
          type: number
          description: Shipping cost for the order.
        total:
          type: number
          description: Total order amount (subtotal + shippingCost).
        shippingAddress:
          nullable: true
          deprecated: true
          description: >-
            Legacy embedded address; absent on current orders — use the
            shipment's shippingAddress instead.
          allOf:
            - $ref: '#/components/schemas/OrderAddress'
        payment:
          type: string
          description: Payment identifier.
        shipment:
          type: string
          description: Shipment identifier.
        notes:
          type: string
          description: Additional order notes.
        additionalInfo:
          type: array
          items:
            $ref: '#/components/schemas/AdditionalInfoItem'
          description: Custom labelled key/value info attached to the order.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    OrderItem:
      type: object
      required:
        - product
        - name
        - price
        - quantity
      properties:
        product:
          type: string
          description: Product identifier.
        variant:
          type: string
          description: Variant identifier if applicable.
        name:
          type: string
          description: Product name.
        sku:
          type: string
          description: Product SKU.
        price:
          type: number
          description: Unit price at time of order.
        quantity:
          type: integer
          minimum: 1
          description: Quantity ordered.
        variantAttributes:
          type: object
          additionalProperties:
            type: string
        imageUrl:
          type: string
          format: uri
    OrderAddress:
      type: object
      properties:
        fullName:
          type: string
        addressLine1:
          type: string
        addressLine2:
          type: string
        city:
          type: string
        state:
          type: string
        zipCode:
          type: string
        country:
          type: string
        phoneNumber:
          type: string
      nullable: true
      deprecated: true
      description: >-
        Legacy embedded order address — not populated on current orders (no live
        order carries it). The delivery address lives on the order's shipment:
        see the shipment's shippingAddress, or GET /shipping/shipments.
    AdditionalInfoItem:
      type: object
      required:
        - label
      properties:
        label:
          type: string
          maxLength: 100
          description: The name of the field (e.g. "Gift message").
        value:
          type: string
          maxLength: 2000
          description: The field value.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT issued by the Salesive Store API for authenticated shoppers.
    ShopIdHeader:
      type: apiKey
      in: header
      name: x-shop-id
      description: >-
        Optional storefront identifier sent as a header to scope responses to a
        specific shop. Try It requests remember this value once provided.

````