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

# 최적화

> 필요한 권한: `plans:read`



## OpenAPI

````yaml /openapi.json get /v1/plans/{id}/optimize
openapi: 3.1.0
info:
  title: OpenAPI definition
  version: v0
servers:
  - url: https://api.morrowly.app
security:
  - token: []
paths:
  /v1/plans/{id}/optimize:
    get:
      tags:
        - plans
      summary: 최적화
      description: '필요한 권한: `plans:read`'
      operationId: optimize
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: uuid
            type: string
        - in: query
          name: goal
          required: true
          schema:
            $ref: '#/components/schemas/Goal'
        - in: query
          name: limits
          required: false
          schema:
            default: []
            items:
              $ref: '#/components/schemas/Limit'
            type: array
            uniqueItems: true
      responses:
        '200':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiResponseOptimizationView'
          description: OK
        '401':
          description: 토큰이 없거나 틀리거나 만료됨(본문 없음)
        '403':
          description: 토큰의 권한이 모자람(본문 없음)
components:
  schemas:
    Goal:
      enum:
        - NET_WORTH
        - LIFETIME_TAX
        - TO_HEIRS
        - EARLY_RETIREMENT
      type: string
    Limit:
      enum:
        - PRIVATE_PENSION
        - FINANCIAL_INCOME
        - DEPENDENT_INCOME
      type: string
    ApiResponseOptimizationView:
      properties:
        data:
          oneOf:
            - $ref: '#/components/schemas/OptimizationView'
            - type: 'null'
        error:
          oneOf:
            - $ref: '#/components/schemas/ErrorMessage'
            - type: 'null'
        result:
          $ref: '#/components/schemas/ResultType'
      required:
        - data
        - error
        - result
      type: object
    OptimizationView:
      properties:
        best:
          items:
            $ref: '#/components/schemas/Candidate'
          type: array
        combinations:
          format: int32
          type: integer
        current:
          $ref: '#/components/schemas/Candidate'
        financesRevision:
          type: string
        goal:
          $ref: '#/components/schemas/Goal'
        grid:
          items:
            $ref: '#/components/schemas/GridCell'
          type: array
        planRevision:
          type: string
      required:
        - best
        - combinations
        - current
        - financesRevision
        - goal
        - grid
        - planRevision
      type: object
    ErrorMessage:
      properties:
        code:
          type: string
        data: {}
        message:
          type: string
      required:
        - code
        - data
        - message
      type: object
    ResultType:
      enum:
        - SUCCESS
        - ERROR
      type: string
    Candidate:
      properties:
        choice:
          $ref: '#/components/schemas/Choice'
        exceeds:
          items:
            $ref: '#/components/schemas/Limit'
          type: array
          uniqueItems: true
        finalNetWorth:
          format: int64
          type: integer
        lifetimeTax:
          format: int64
          type: integer
        retirementAge:
          format: int32
          type:
            - integer
            - 'null'
        shortfall:
          type: boolean
        toHeirs:
          format: int64
          type: integer
      required:
        - choice
        - exceeds
        - finalNetWorth
        - lifetimeTax
        - retirementAge
        - shortfall
        - toHeirs
      type: object
    GridCell:
      properties:
        candidate:
          oneOf:
            - $ref: '#/components/schemas/Candidate'
            - type: 'null'
        pensionStartAge:
          format: int32
          type:
            - integer
            - 'null'
        pensionYears:
          format: int32
          type:
            - integer
            - 'null'
      required:
        - candidate
        - pensionStartAge
        - pensionYears
      type: object
    Choice:
      properties:
        harvestGains:
          type: boolean
        pensionStartAge:
          format: int32
          type:
            - integer
            - 'null'
        pensionYears:
          format: int32
          type:
            - integer
            - 'null'
        prepayDebt:
          type: boolean
        retirement:
          type:
            - string
            - 'null'
        withdrawalOrder:
          $ref: '#/components/schemas/WithdrawalOrder'
      required:
        - harvestGains
        - pensionStartAge
        - pensionYears
        - prepayDebt
        - retirement
        - withdrawalOrder
      type: object
    WithdrawalOrder:
      enum:
        - PROPORTIONAL
        - TAXABLE_FIRST
        - TAX_FREE_FIRST
      type: string
  securitySchemes:
    token:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.