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

# Edit Policy



## OpenAPI

````yaml /openapi.json patch /policies/{policyId}
openapi: 3.0.0
info:
  title: Korint Documentation
  description: Korint API Documentation
  version: 1.0.0
  contact: {}
servers: []
security:
  - bearerAuth: []
tags: []
paths:
  /policies/{policyId}:
    patch:
      tags:
        - policy
      summary: Edit Policy
      operationId: PolicyController_editPolicy
      parameters:
        - name: policyId
          required: true
          in: path
          description: the policy's id
          schema:
            type: string
        - name: whenAt
          required: false
          in: query
          description: 'Optional: the whenAt datetime'
          schema:
            type: string
        - name: branchId
          required: false
          in: query
          description: 'Optional: the branchId'
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditPolicyInputBody'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EditPolicyOutput'
        '400':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/InvalidInvoicingConfigErrorDto'
                  - $ref: '#/components/schemas/InvalidEventCreationDateErrorDto'
              examples:
                INVALID_INVOICING_CONFIG:
                  $ref: '#/components/schemas/InvalidInvoicingConfigErrorDto'
                INVALID_EVENT_CREATION_DATE:
                  $ref: '#/components/schemas/InvalidEventCreationDateErrorDto'
          description: ''
        '403':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ForbiddenErrorDto'
              examples:
                FORBIDDEN:
                  $ref: '#/components/schemas/ForbiddenErrorDto'
          description: ''
        '404':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PolicyNotFoundErrorDto'
              examples:
                POLICY_NOT_FOUND:
                  $ref: '#/components/schemas/PolicyNotFoundErrorDto'
          description: ''
        '409':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ConflictingPolicyStatusErrorDto'
                  - $ref: '#/components/schemas/ConflictingBranchStatusErrorDto'
                  - $ref: '#/components/schemas/FieldsDoNotMeetRequirementsErrorDto'
                  - $ref: '#/components/schemas/MaxChildPoliciesReachedErrorDto'
                  - $ref: >-
                      #/components/schemas/MaxPoliciesNotLessThanSignedPoliciesErrorDto
              examples:
                CONFLICTING_POLICY_STATUS:
                  $ref: '#/components/schemas/ConflictingPolicyStatusErrorDto'
                CONFLICTING_BRANCH_STATUS:
                  $ref: '#/components/schemas/ConflictingBranchStatusErrorDto'
                FIELDS_DO_NOT_MEET_REQUIREMENTS:
                  $ref: '#/components/schemas/FieldsDoNotMeetRequirementsErrorDto'
                MAX_CHILD_POLICIES_REACHED:
                  $ref: '#/components/schemas/MaxChildPoliciesReachedErrorDto'
                MAX_POLICIES_NOT_LESS_THAN_SIGNED_POLICIES:
                  $ref: >-
                    #/components/schemas/MaxPoliciesNotLessThanSignedPoliciesErrorDto
          description: ''
components:
  schemas:
    EditPolicyInputBody:
      type: object
      properties:
        customFields:
          description: custom fields per product
          type: array
          items:
            $ref: '#/components/schemas/NullableCustomFieldDto'
        name:
          type: string
          description: 'Optional: Name of the entity'
        invoicingConfig:
          description: the policy's invoicing configuration
          allOf:
            - $ref: '#/components/schemas/InvoicingConfigDto'
        periodDuration:
          description: the policy's period duration
          allOf:
            - $ref: '#/components/schemas/Duration'
        acceptedEmailDomains:
          description: the child policy's customer accepted email domains
          type: array
          items:
            type: string
        acceptedQuoteOptions:
          $ref: '#/components/schemas/AcceptedQuoteOptionsDto'
        maximumNumberOfBikes:
          type: number
          description: max number of bike
          minimum: 1
    EditPolicyOutput:
      type: object
      properties: {}
    InvalidInvoicingConfigErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_INVOICING_CONFIG
        message:
          type: string
          example: Invalid invoicing config
        details:
          $ref: '#/components/schemas/InvalidInvoicingConfigDetailsDto'
      required:
        - code
        - message
        - details
    InvalidEventCreationDateErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_EVENT_CREATION_DATE
        message:
          type: string
          example: >-
            You are trying to push an event that is created on {createdAt}, but
            the creation date should be after the latest event which was created
            on {latestCreatedAt}
        details:
          $ref: '#/components/schemas/InvalidEventCreationDateDetailsDto'
      required:
        - code
        - message
        - details
    ForbiddenErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - FORBIDDEN
        message:
          type: string
          example: Forbidden
        details:
          $ref: '#/components/schemas/ForbiddenDetailsDto'
      required:
        - code
        - message
        - details
    PolicyNotFoundErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - POLICY_NOT_FOUND
        message:
          type: string
          example: Policy {policyId} ({branchId}) not found
        details:
          $ref: '#/components/schemas/PolicyNotFoundDetailsDto'
      required:
        - code
        - message
        - details
    ConflictingPolicyStatusErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - CONFLICTING_POLICY_STATUS
        message:
          type: string
          example: '{policyId} status {requirement} {policyStatus} to perform {action}'
        details:
          $ref: '#/components/schemas/ConflictingPolicyStatusDetailsDto'
      required:
        - code
        - message
        - details
    ConflictingBranchStatusErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - CONFLICTING_BRANCH_STATUS
        message:
          type: string
          example: Branch status {requirement} {branchStatus} to perform {action}
        details:
          $ref: '#/components/schemas/ConflictingBranchStatusDetailsDto'
      required:
        - code
        - message
        - details
    FieldsDoNotMeetRequirementsErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - FIELDS_DO_NOT_MEET_REQUIREMENTS
        message:
          type: string
          example: >-
            Fields on this branch do not meet requirements defined in product
            configuration
        details:
          $ref: '#/components/schemas/FieldsRequirementsConflictDto'
      required:
        - code
        - message
        - details
    MaxChildPoliciesReachedErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - MAX_CHILD_POLICIES_REACHED
        message:
          type: string
          example: Max child policies reached for collective product
        details:
          $ref: '#/components/schemas/MaxChildPoliciesReachedDetailsDto'
      required:
        - code
        - message
        - details
    MaxPoliciesNotLessThanSignedPoliciesErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - MAX_POLICIES_NOT_LESS_THAN_SIGNED_POLICIES
        message:
          type: string
          example: Max policies should be greater than the number of signed policies
        details:
          $ref: '#/components/schemas/MaxPoliciesNotLessThanSignedPoliciesDetailsDto'
      required:
        - code
        - message
        - details
    NullableCustomFieldDto:
      type: object
      properties:
        key:
          type: string
        value:
          oneOf:
            - type: string
            - type: number
            - type: boolean
          nullable: true
      required:
        - key
        - value
    InvoicingConfigDto:
      type: object
      properties:
        frequency:
          allOf:
            - $ref: '#/components/schemas/InvoiceFrequency'
        timing:
          allOf:
            - $ref: '#/components/schemas/InvoiceTiming'
        billAtSignature:
          allOf:
            - $ref: '#/components/schemas/BillAtSignatureType'
        earlyPayment:
          $ref: '#/components/schemas/Duration'
      required:
        - frequency
        - timing
        - billAtSignature
    Duration:
      type: object
      properties:
        amount:
          type: number
        unit:
          type: string
          enum:
            - YEAR
            - MONTH
            - WEEK
            - DAY
            - HOUR
            - MINUTE
            - SECOND
      required:
        - amount
        - unit
    AcceptedQuoteOptionsDto:
      type: object
      properties:
        defaultConfig:
          $ref: '#/components/schemas/QuoteChosenOptionsDto'
        availableConfigs:
          type: array
          items:
            $ref: '#/components/schemas/QuoteAvailableOptionsDto'
      required:
        - availableConfigs
    InvalidInvoicingConfigDetailsDto:
      type: object
      properties:
        availableConfigs:
          type: array
          items:
            $ref: '#/components/schemas/InvoicingConfigDto'
      required:
        - availableConfigs
    InvalidEventCreationDateDetailsDto:
      type: object
      properties:
        createdAt:
          format: date-time
          type: string
        latestCreatedAt:
          format: date-time
          type: string
      required:
        - createdAt
        - latestCreatedAt
    ForbiddenDetailsDto:
      type: object
      properties:
        message:
          type: string
        documentKey:
          type: string
        userId:
          type: string
        ownerId:
          type: string
      required:
        - message
        - documentKey
        - userId
        - ownerId
    PolicyNotFoundDetailsDto:
      type: object
      properties:
        policyId:
          type: string
        branchId:
          type: string
        whenAt:
          type: string
        simulatedAt:
          type: string
      required:
        - policyId
    ConflictingPolicyStatusDetailsDto:
      type: object
      properties:
        policyStatus:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        policyId:
          type: string
        requirement:
          allOf:
            - $ref: '#/components/schemas/OperationRequirement'
        action:
          allOf:
            - $ref: '#/components/schemas/Action'
        additionalData:
          type: object
          additionalProperties: true
      required:
        - policyStatus
        - policyId
        - requirement
        - action
    ConflictingBranchStatusDetailsDto:
      type: object
      properties:
        branchStatus:
          allOf:
            - $ref: '#/components/schemas/BranchStatus'
        requirement:
          allOf:
            - $ref: '#/components/schemas/OperationRequirement'
        action:
          allOf:
            - $ref: '#/components/schemas/Action'
      required:
        - branchStatus
        - requirement
        - action
    FieldsRequirementsConflictDto:
      type: object
      properties: {}
    MaxChildPoliciesReachedDetailsDto:
      type: object
      properties:
        policyId:
          type: string
        maximumNumberOfBikes:
          type: number
      required:
        - policyId
        - maximumNumberOfBikes
    MaxPoliciesNotLessThanSignedPoliciesDetailsDto:
      type: object
      properties:
        currentPolicies:
          type: number
        maximumNumberOfBikes:
          type: number
      required:
        - currentPolicies
        - maximumNumberOfBikes
    InvoiceFrequency:
      type: string
      enum:
        - YEARLY
        - HALF_YEARLY
        - QUARTERLY
        - MONTHLY
        - BIENNIAL
        - WEEKLY
    InvoiceTiming:
      type: string
      enum:
        - IN_ADVANCE
        - IN_ARREAR
    BillAtSignatureType:
      type: string
      enum:
        - EARLY_PAYMENT
        - FULL
        - NONE
    QuoteChosenOptionsDto:
      type: object
      properties:
        tier:
          type: string
        excess:
          type: string
        perils:
          type: array
          items:
            $ref: '#/components/schemas/ConfigQuoteChosenWarrantyDto'
      required:
        - tier
        - excess
    QuoteAvailableOptionsDto:
      type: object
      properties:
        tier:
          type: string
        excess:
          type: string
        perils:
          type: array
          items:
            $ref: '#/components/schemas/ConfigQuoteAvailableWarrantyDto'
      required:
        - tier
        - excess
    OperationRequirement:
      type: string
      enum:
        - must be
        - must NOT be
        - must contain
        - must NOT contain
    Action:
      type: string
      enum:
        - PERFORM THIS ACTION
        - CREATE POLICY
        - CREATE ASSET
        - CREATE ASSET WITH START DATE
        - REPLACE ASSET
        - REMOVE ASSET
        - CHOOSE ASSET OPTIONS
        - STOP ASSET
        - EDIT ASSET
        - EDIT ASSET WITH START DATE
        - CREATE BRANCH
        - CREATE DEROGATION
        - CREATE MTA BRANCH
        - FORK TO NEW MTA BRANCH
        - FORK TO NEW NB BRANCH
        - FORK TO NEW RENEWAL BRANCH
        - FORK TO NEW REPRICING BRANCH
        - DEFINE PARENT POLICY ID
        - INITIALIZE CUSTOMER
        - EDIT CUSTOMER
        - DELETE CUSTOMER FROM POLICY
        - DECLARE CLAIMS HISTORY
        - SIGN
        - EDIT POLICY
        - EDIT POLICY EXTERNAL ID
        - CONFIRM POLICY
        - QUOTE POLICY
        - RETRIEVING QUOTE
        - STOP POLICY
        - SUSPEND POLICY
        - ACTIVATE POLICY
        - GENERATE MANDATE SIGNATURE REQUEST
        - GENERATE PAYMENT METHOD SECRET
        - CREATE CLAIM
        - FINALIZE RENEWAL
        - SEND CONTRACT TO SIGNATURE
        - GENERATE SIGNATURE REQUEST
        - GENERATE DOCUMENTS FOR SIGNATURE
        - APPROVE DISTRIBUTION REQUEST
        - DENY DISTRIBUTION REQUEST
        - REVOKED_DISTRIBUTION_REQUEST
        - DELETE DISTRIBUTION REQUEST
        - WAITING FOR SIGNATURE DISTRIBUTION REQUEST
        - UPDATE POLICY QUOTE
    BranchStatus:
      type: string
      enum:
        - BRANCH_OPEN
        - BRANCH_MERGED
        - BRANCH_CLOSED
    ConfigQuoteChosenWarrantyDto:
      type: object
      properties:
        id:
          type: string
        option:
          type: string
        available:
          type: boolean
        unavailabilityMessage:
          type: string
      required:
        - id
    ConfigQuoteAvailableWarrantyDto:
      type: object
      properties:
        id:
          type: string
        required:
          type: boolean
        options:
          type: array
          items:
            type: string
        showWhen:
          oneOf:
            - $ref: '#/components/schemas/ConfigQuoteShowWhenSingleValueDto'
            - $ref: '#/components/schemas/ConfigQuoteShowWhenMultipleValuesDto'
            - $ref: '#/components/schemas/ConfigQuoteShowWhenNoValueDto'
      required:
        - id
    ConfigQuoteShowWhenSingleValueDto:
      type: object
      properties:
        fieldKey:
          type: string
        fieldValue:
          type: string
        condition:
          type: string
        value:
          type: string
      required:
        - fieldKey
        - fieldValue
        - condition
        - value
    ConfigQuoteShowWhenMultipleValuesDto:
      type: object
      properties:
        fieldKey:
          type: string
        fieldValue:
          type: string
        condition:
          type: string
        values:
          type: array
          items:
            type: string
      required:
        - fieldKey
        - fieldValue
        - condition
        - values
    ConfigQuoteShowWhenNoValueDto:
      type: object
      properties:
        fieldKey:
          type: string
        fieldValue:
          type: string
        condition:
          type: string
      required:
        - fieldKey
        - fieldValue
        - condition

````