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

# Upsert a shipment grouping several sales orders.

> Keyed by shipmentNo within the tenant: re-sending reconciles the shipment's membership
(attaches new orders, moves orders in from another shipment, and detaches orders no longer
listed). Rejects the whole request if any referenced order is unknown or is past the
pre-ship stage.



## OpenAPI

````yaml /api-reference/openapi.json post /openapi/v1/Shipments
openapi: 3.0.1
info:
  title: OmniServices Web API
  version: v1
servers:
  - url: https://api.oplog.one
    description: Production Server
  - url: https://api.staging.oplog.one
    description: Staging Server
security:
  - Authorization: []
paths:
  /openapi/v1/Shipments:
    post:
      tags:
        - Shipments
      summary: Upsert a shipment grouping several sales orders.
      description: "Keyed by shipmentNo within the tenant: re-sending reconciles the shipment's membership\r\n(attaches new orders, moves orders in from another shipment, and detaches orders no longer\r\nlisted). Rejects the whole request if any referenced order is unknown or is past the\r\npre-ship stage."
      parameters:
        - name: X-Tenant-Id
          in: header
          description: If you want to emulate, please enter TenantId.
          schema:
            type: string
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/ShipmentRequestDTO'
          application/json:
            schema:
              $ref: '#/components/schemas/ShipmentRequestDTO'
          text/json:
            schema:
              $ref: '#/components/schemas/ShipmentRequestDTO'
          application/*+json:
            schema:
              $ref: '#/components/schemas/ShipmentRequestDTO'
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/UpsertShipmentResult'
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertShipmentResult'
            text/json:
              schema:
                $ref: '#/components/schemas/UpsertShipmentResult'
components:
  schemas:
    ShipmentRequestDTO:
      type: object
      properties:
        shipmentNo:
          type: string
          description: >-
            External shipment number from the calling system (e.g. Flormar SAP).
            Upsert key.
        shipmentType:
          type: string
          description: 'Transport mode: Air, Road or Sea (English name, case-insensitive).'
        shipmentDate:
          type: string
          format: date-time
        salesOrders:
          type: array
          items:
            type: string
          description: Reference numbers of the sales orders that belong to this shipment.
        integrationId:
          type: string
          description: >-
            Optional; disambiguates when the tenant has more than one
            OpenApi/Entegra integration.
          format: uuid
      additionalProperties: false
      description: "Push payload for POST /openapi/v1/Shipments. Groups several existing sales orders (by reference\r\nnumber) into one outbound shipment with a transport mode and a target date. The list is\r\nauthoritative for the shipment's membership on every upsert."
    UpsertShipmentResult:
      type: object
      properties:
        shipmentNo:
          type: string
        shipmentType:
          type: string
        shipmentDate:
          type: string
          format: date-time
        results:
          type: array
          items:
            $ref: '#/components/schemas/ShipmentSalesOrderResult'
        detached:
          type: array
          items:
            type: string
      additionalProperties: false
    ShipmentSalesOrderResult:
      required:
        - status
      type: object
      properties:
        referenceNumber:
          type: string
        status:
          $ref: '#/components/schemas/ShipmentSalesOrderUpsertStatus'
        previousShipmentNo:
          type: string
      additionalProperties: false
    ShipmentSalesOrderUpsertStatus:
      enum:
        - Attached
        - AlreadyInGroup
        - MovedFromShipment
      type: string
  securitySchemes:
    Authorization:
      type: apiKey
      in: header
      name: Authorization

````