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

# Margin Analysis

> Calculate profit margins for different quoted prices.



## OpenAPI

````yaml /api/openapi-cutmake.json post /costings/{costing_id}/margin-analysis
openapi: 3.1.0
info:
  title: VM App API
  version: 0.1.0
servers:
  - url: https://vinmake-erp.onrender.com
security: []
paths:
  /costings/{costing_id}/margin-analysis:
    post:
      tags:
        - Costing Management
      summary: Margin Analysis
      description: Calculate profit margins for different quoted prices.
      operationId: margin_analysis_costings__costing_id__margin_analysis_post
      parameters:
        - name: costing_id
          in: path
          required: true
          schema:
            type: string
            title: Costing Id
        - 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/MarginAnalysisRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarginAnalysisResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    MarginAnalysisRequest:
      properties:
        quotedPrices:
          items:
            type: number
          type: array
          title: Quotedprices
        targetMarginPercent:
          anyOf:
            - type: number
            - type: 'null'
          title: Targetmarginpercent
      type: object
      required:
        - quotedPrices
      title: MarginAnalysisRequest
      description: Input payload for margin analysis calculations
    MarginAnalysisResponse:
      properties:
        costSheetId:
          type: string
          title: Costsheetid
        documentId:
          type: string
          title: Documentid
        costBreakdown:
          additionalProperties: true
          type: object
          title: Costbreakdown
        scenarios:
          items:
            $ref: '#/components/schemas/MarginScenario'
          type: array
          title: Scenarios
        suggestedPrice:
          anyOf:
            - type: number
            - type: 'null'
          title: Suggestedprice
      type: object
      required:
        - costSheetId
        - documentId
        - costBreakdown
        - scenarios
      title: MarginAnalysisResponse
      description: Response for margin analysis endpoint
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MarginScenario:
      properties:
        quotedPrice:
          type: number
          title: Quotedprice
        totalCost:
          type: number
          title: Totalcost
        profit:
          type: number
          title: Profit
        marginPercent:
          type: number
          title: Marginpercent
        markupPercent:
          type: number
          title: Markuppercent
      type: object
      required:
        - quotedPrice
        - totalCost
        - profit
        - marginPercent
        - markupPercent
      title: MarginScenario
      description: Single margin scenario in the analysis response
    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

````