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

# Get Order

> Get a single sales order by document ID.

Returns full order details including:
- Line items
- Version history (all previous versions with change descriptions)



## OpenAPI

````yaml /api/openapi-cutmake.json get /api/v1/orders/{document_id}
openapi: 3.1.0
info:
  title: VM App API
  version: 0.1.0
servers:
  - url: https://vinmake-erp.onrender.com
security: []
paths:
  /api/v1/orders/{document_id}:
    get:
      tags:
        - Sales Orders
      summary: Get Order
      description: |-
        Get a single sales order by document ID.

        Returns full order details including:
        - Line items
        - Version history (all previous versions with change descriptions)
      operationId: get_order_api_v1_orders__document_id__get
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            title: Document Id
        - name: version
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 1
              - type: 'null'
            description: Optional sales order version number to view
            title: Version
          description: Optional sales order version number to view
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesOrderDetail'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    SalesOrderDetail:
      properties:
        id:
          type: string
          title: Id
        internalId:
          type: string
          title: Internalid
        versionNumber:
          type: integer
          title: Versionnumber
        currentVersion:
          type: integer
          title: Currentversion
        finalVersion:
          anyOf:
            - type: integer
            - type: 'null'
          title: Finalversion
        isFinal:
          type: boolean
          title: Isfinal
          default: false
        createdAt:
          type: string
          title: Createdat
        createdBy:
          type: string
          title: Createdby
        clientId:
          type: string
          title: Clientid
        clientName:
          type: string
          title: Clientname
        clientPoNumber:
          anyOf:
            - type: string
            - type: 'null'
          title: Clientponumber
        styleId:
          anyOf:
            - type: string
            - type: 'null'
          title: Styleid
        styleCode:
          anyOf:
            - type: string
            - type: 'null'
          title: Stylecode
        styles:
          items:
            $ref: '#/components/schemas/SalesOrderStyleRef'
          type: array
          title: Styles
          default: []
        etd:
          type: string
          title: Etd
        shippingTerm:
          type: string
          title: Shippingterm
        deadline:
          anyOf:
            - type: string
            - type: 'null'
          title: Deadline
        shipmentPlan:
          anyOf:
            - type: string
            - type: 'null'
          title: Shipmentplan
        shipmentSchedule:
          items:
            $ref: '#/components/schemas/SalesOrderShipmentScheduleOutput'
          type: array
          title: Shipmentschedule
          default: []
        paymentTerm:
          type: string
          title: Paymentterm
        estimatedQuantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Estimatedquantity
        estimatedCost:
          anyOf:
            - type: number
            - type: 'null'
          title: Estimatedcost
        sourceQuoteId:
          anyOf:
            - type: string
            - type: 'null'
          title: Sourcequoteid
        trueCostPrice:
          anyOf:
            - type: number
            - type: 'null'
          title: Truecostprice
        trueCostCurrency:
          anyOf:
            - type: string
            - type: 'null'
          title: Truecostcurrency
        budgetAllowableTolerance:
          anyOf:
            - type: number
            - type: 'null'
          title: Budgetallowabletolerance
          default: 0
        status:
          type: string
          title: Status
        budgetApproved:
          type: boolean
          title: Budgetapproved
        budgetApprovedAt:
          anyOf:
            - type: string
            - type: 'null'
          title: Budgetapprovedat
        budgetApprovedBy:
          anyOf:
            - type: string
            - type: 'null'
          title: Budgetapprovedby
        timelineApproved:
          type: boolean
          title: Timelineapproved
        timelineApprovedAt:
          anyOf:
            - type: string
            - type: 'null'
          title: Timelineapprovedat
        timelineApprovedBy:
          anyOf:
            - type: string
            - type: 'null'
          title: Timelineapprovedby
        requestedDeliveryDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Requesteddeliverydate
        requestedBulkReadyDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Requestedbulkreadydate
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        duplicateOrders:
          items:
            type: string
          type: array
          title: Duplicateorders
          default: []
        relatedProductionOrders:
          items:
            $ref: '#/components/schemas/SalesOrderRelatedProductionOrder'
          type: array
          title: Relatedproductionorders
          default: []
        lineItems:
          items:
            $ref: '#/components/schemas/SalesOrderLineItemOutput'
          type: array
          title: Lineitems
          default: []
        totalQuantity:
          type: integer
          title: Totalquantity
        versionHistory:
          items:
            $ref: '#/components/schemas/SalesOrderVersionSummary'
          type: array
          title: Versionhistory
          default: []
      type: object
      required:
        - id
        - internalId
        - versionNumber
        - currentVersion
        - createdAt
        - createdBy
        - clientId
        - clientName
        - etd
        - shippingTerm
        - paymentTerm
        - status
        - budgetApproved
        - timelineApproved
        - totalQuantity
      title: SalesOrderDetail
      description: |-
        Full sales order detail for GET /orders/{id}

        Includes version history so frontend gets everything in one call.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SalesOrderStyleRef:
      properties:
        styleId:
          type: string
          title: Styleid
        styleCode:
          anyOf:
            - type: string
            - type: 'null'
          title: Stylecode
        styleName:
          anyOf:
            - type: string
            - type: 'null'
          title: Stylename
        picture:
          anyOf:
            - type: string
            - type: 'null'
          title: Picture
        quantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Quantity
      type: object
      required:
        - styleId
      title: SalesOrderStyleRef
      description: |-
        One style behind a sales order, derived from its line-item SKUs.

        A sales order can span multiple styles; this is one entry of that set.
        `quantity` is the summed line-item order quantity for this style.
    SalesOrderShipmentScheduleOutput:
      properties:
        shipmentNumber:
          type: integer
          title: Shipmentnumber
        etd:
          type: string
          title: Etd
        quantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Quantity
        amount:
          anyOf:
            - type: number
            - type: 'null'
          title: Amount
      type: object
      required:
        - shipmentNumber
        - etd
      title: SalesOrderShipmentScheduleOutput
      description: |-
        Shipment schedule row returned to the frontend.

        `amount` is derived (quantity * true cost price) and is read-only.
    SalesOrderRelatedProductionOrder:
      properties:
        id:
          type: string
          title: Id
        documentId:
          anyOf:
            - type: string
            - type: 'null'
          title: Documentid
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
        productionType:
          anyOf:
            - type: string
            - type: 'null'
          title: Productiontype
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        orderQuantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Orderquantity
        plannedStartDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Plannedstartdate
        dueDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Duedate
        createdAt:
          anyOf:
            - type: string
            - type: 'null'
          title: Createdat
        clientId:
          anyOf:
            - type: string
            - type: 'null'
          title: Clientid
        clientName:
          anyOf:
            - type: string
            - type: 'null'
          title: Clientname
        styleId:
          anyOf:
            - type: string
            - type: 'null'
          title: Styleid
        styleName:
          anyOf:
            - type: string
            - type: 'null'
          title: Stylename
      type: object
      required:
        - id
      title: SalesOrderRelatedProductionOrder
      description: Compact production order summary shown on sales order detail.
    SalesOrderLineItemOutput:
      properties:
        id:
          type: string
          title: Id
        styleSkuId:
          type: string
          title: Styleskuid
        skuCode:
          anyOf:
            - type: string
            - type: 'null'
          title: Skucode
        color:
          anyOf:
            - type: string
            - type: 'null'
          title: Color
        size:
          anyOf:
            - type: string
            - type: 'null'
          title: Size
        styleId:
          anyOf:
            - type: string
            - type: 'null'
          title: Styleid
        styleCode:
          anyOf:
            - type: string
            - type: 'null'
          title: Stylecode
        styleName:
          anyOf:
            - type: string
            - type: 'null'
          title: Stylename
        orderQuantity:
          type: integer
          title: Orderquantity
        clientTolerance:
          anyOf:
            - type: number
            - type: 'null'
          title: Clienttolerance
          default: 0
        requestedDeliveryDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Requesteddeliverydate
        requestedBulkReadyDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Requestedbulkreadydate
        status:
          type: string
          title: Status
      type: object
      required:
        - id
        - styleSkuId
        - orderQuantity
        - status
      title: SalesOrderLineItemOutput
      description: Sales order line item for API response
    SalesOrderVersionSummary:
      properties:
        versionNumber:
          type: integer
          title: Versionnumber
        createdAt:
          type: string
          title: Createdat
        createdBy:
          type: string
          title: Createdby
        changeDescription:
          type: string
          title: Changedescription
        status:
          type: string
          title: Status
        isFinal:
          type: boolean
          title: Isfinal
          default: false
      type: object
      required:
        - versionNumber
        - createdAt
        - createdBy
        - changeDescription
        - status
      title: SalesOrderVersionSummary
      description: Summary of a sales order version for history view
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /auth/login

````