> ## 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.

# Create Purchase Orders From Material Requests



## OpenAPI

````yaml /api/openapi-cutmake.json post /material-requests/create-purchase-orders
openapi: 3.1.0
info:
  title: VM App API
  version: 0.1.0
servers:
  - url: https://vinmake-erp.onrender.com
security: []
paths:
  /material-requests/create-purchase-orders:
    post:
      tags:
        - Material Requests
      summary: Create Purchase Orders From Material Requests
      operationId: >-
        create_purchase_orders_from_material_requests_material_requests_create_purchase_orders_post
      parameters:
        - name: X-Org-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Org-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/CreatePurchaseOrdersFromMaterialRequestsRequest
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CreatePurchaseOrdersFromMaterialRequestsResponse
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    CreatePurchaseOrdersFromMaterialRequestsRequest:
      properties:
        ids:
          items:
            type: string
          type: array
          title: Ids
        dryRun:
          type: boolean
          title: Dryrun
          default: true
        expectedDeliveryDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Expecteddeliverydate
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        skipInvalidLines:
          type: boolean
          title: Skipinvalidlines
          default: false
        poStatus:
          type: string
          title: Postatus
          default: Submitted
      type: object
      required:
        - ids
      title: CreatePurchaseOrdersFromMaterialRequestsRequest
    CreatePurchaseOrdersFromMaterialRequestsResponse:
      properties:
        success:
          type: boolean
          title: Success
        dryRun:
          type: boolean
          title: Dryrun
        requestedIds:
          items:
            type: string
          type: array
          title: Requestedids
        totalPurchaseOrders:
          type: integer
          title: Totalpurchaseorders
        grandTotal:
          type: number
          title: Grandtotal
        preview:
          items:
            $ref: '#/components/schemas/MaterialRequestPurchaseOrderPreviewGroup'
          type: array
          title: Preview
        createdPurchaseOrders:
          anyOf:
            - items:
                $ref: '#/components/schemas/CreatedPurchaseOrderResult'
              type: array
            - type: 'null'
          title: Createdpurchaseorders
        validationIssues:
          items:
            $ref: '#/components/schemas/MaterialRequestPurchaseOrderValidationIssue'
          type: array
          title: Validationissues
        skippedLineCount:
          type: integer
          title: Skippedlinecount
          default: 0
      type: object
      required:
        - success
        - dryRun
        - requestedIds
        - totalPurchaseOrders
        - grandTotal
        - preview
      title: CreatePurchaseOrdersFromMaterialRequestsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MaterialRequestPurchaseOrderPreviewGroup:
      properties:
        materialRequestId:
          type: string
          title: Materialrequestid
        materialRequestDocumentId:
          type: string
          title: Materialrequestdocumentid
        sourceMaterialRequestIds:
          items:
            type: string
          type: array
          title: Sourcematerialrequestids
        sourceMaterialRequestDocuments:
          items:
            type: string
          type: array
          title: Sourcematerialrequestdocuments
        supplierId:
          type: string
          title: Supplierid
        supplierName:
          type: string
          title: Suppliername
        productionOrderId:
          anyOf:
            - type: string
            - type: 'null'
          title: Productionorderid
        productionOrderDocumentId:
          anyOf:
            - type: string
            - type: 'null'
          title: Productionorderdocumentid
        salesOrderId:
          anyOf:
            - type: string
            - type: 'null'
          title: Salesorderid
        lineItemCount:
          type: integer
          title: Lineitemcount
        subtotal:
          type: number
          title: Subtotal
        taxRate:
          type: number
          title: Taxrate
        taxAmount:
          type: number
          title: Taxamount
        total:
          type: number
          title: Total
        orderDate:
          type: string
          title: Orderdate
        expectedDeliveryDate:
          anyOf:
            - type: string
            - type: 'null'
          title: Expecteddeliverydate
        items:
          items:
            $ref: '#/components/schemas/MaterialRequestPurchaseOrderPreviewLineItem'
          type: array
          title: Items
      type: object
      required:
        - materialRequestId
        - materialRequestDocumentId
        - sourceMaterialRequestIds
        - sourceMaterialRequestDocuments
        - supplierId
        - supplierName
        - lineItemCount
        - subtotal
        - taxRate
        - taxAmount
        - total
        - orderDate
        - items
      title: MaterialRequestPurchaseOrderPreviewGroup
    CreatedPurchaseOrderResult:
      properties:
        materialRequestId:
          type: string
          title: Materialrequestid
        materialRequestDocumentId:
          type: string
          title: Materialrequestdocumentid
        supplierId:
          type: string
          title: Supplierid
        supplierName:
          type: string
          title: Suppliername
        purchaseOrderId:
          type: string
          title: Purchaseorderid
        purchaseOrderDocumentId:
          type: string
          title: Purchaseorderdocumentid
        lineItemCount:
          type: integer
          title: Lineitemcount
        subtotal:
          type: number
          title: Subtotal
        taxAmount:
          type: number
          title: Taxamount
        total:
          type: number
          title: Total
      type: object
      required:
        - materialRequestId
        - materialRequestDocumentId
        - supplierId
        - supplierName
        - purchaseOrderId
        - purchaseOrderDocumentId
        - lineItemCount
        - subtotal
        - taxAmount
        - total
      title: CreatedPurchaseOrderResult
    MaterialRequestPurchaseOrderValidationIssue:
      properties:
        materialRequestId:
          type: string
          title: Materialrequestid
        materialRequestDocumentId:
          type: string
          title: Materialrequestdocumentid
        materialRequestLineId:
          type: string
          title: Materialrequestlineid
        itemNumber:
          anyOf:
            - type: integer
            - type: 'null'
          title: Itemnumber
        materialName:
          anyOf:
            - type: string
            - type: 'null'
          title: Materialname
        supplierId:
          anyOf:
            - type: string
            - type: 'null'
          title: Supplierid
        supplierName:
          anyOf:
            - type: string
            - type: 'null'
          title: Suppliername
        reason:
          type: string
          title: Reason
      type: object
      required:
        - materialRequestId
        - materialRequestDocumentId
        - materialRequestLineId
        - reason
      title: MaterialRequestPurchaseOrderValidationIssue
    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
    MaterialRequestPurchaseOrderPreviewLineItem:
      properties:
        materialRequestId:
          type: string
          title: Materialrequestid
        materialRequestDocumentId:
          type: string
          title: Materialrequestdocumentid
        materialRequestLineId:
          type: string
          title: Materialrequestlineid
        itemNumber:
          type: integer
          title: Itemnumber
        materialId:
          anyOf:
            - type: string
            - type: 'null'
          title: Materialid
        materialName:
          anyOf:
            - type: string
            - type: 'null'
          title: Materialname
        supplierId:
          type: string
          title: Supplierid
        supplierName:
          type: string
          title: Suppliername
        requiredQty:
          type: number
          title: Requiredqty
        qtyToPurchase:
          type: number
          title: Qtytopurchase
        uom:
          anyOf:
            - type: string
            - type: 'null'
          title: Uom
        unitPrice:
          type: number
          title: Unitprice
        estimatedAmount:
          type: number
          title: Estimatedamount
      type: object
      required:
        - materialRequestId
        - materialRequestDocumentId
        - materialRequestLineId
        - itemNumber
        - supplierId
        - supplierName
        - requiredQty
        - qtyToPurchase
        - unitPrice
        - estimatedAmount
      title: MaterialRequestPurchaseOrderPreviewLineItem
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /auth/login

````