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

# Generate Upload Document Url



## OpenAPI

````yaml /openapi.json post /policies/{policyId}/documents
openapi: 3.0.0
info:
  title: Korint Documentation
  description: Korint API Documentation
  version: 1.0.0
  contact: {}
servers: []
security:
  - bearerAuth: []
tags: []
paths:
  /policies/{policyId}/documents:
    post:
      tags:
        - policy
      summary: Generate Upload Document Url
      operationId: PolicyController_generateDocumentUploadUrl
      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
        description: Add in metadata the documenttype for non-delegated document generation
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PolicyGenerateDocumentUploadUrlInputBody'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateDocumentUploadUrlOutput'
        '400':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/InvalidEventCreationDateErrorDto'
                  - $ref: >-
                      #/components/schemas/InvalidNonDelegatedDocumentTypeErrorDto
                  - $ref: >-
                      #/components/schemas/DuplicateNonDelegatedDocumentTypeErrorDto
              examples:
                INVALID_EVENT_CREATION_DATE:
                  $ref: '#/components/schemas/InvalidEventCreationDateErrorDto'
                INVALID_NON_DELEGATED_DOCUMENT_TYPE:
                  $ref: '#/components/schemas/InvalidNonDelegatedDocumentTypeErrorDto'
                DUPLICATE_NON_DELEGATED_DOCUMENT_TYPE:
                  $ref: >-
                    #/components/schemas/DuplicateNonDelegatedDocumentTypeErrorDto
          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'
                  - $ref: >-
                      #/components/schemas/NonDelegatedDocumentsConfigNotFoundErrorDto
              examples:
                POLICY_NOT_FOUND:
                  $ref: '#/components/schemas/PolicyNotFoundErrorDto'
                NON_DELEGATED_DOCUMENTS_CONFIG_NOT_FOUND:
                  $ref: >-
                    #/components/schemas/NonDelegatedDocumentsConfigNotFoundErrorDto
          description: ''
components:
  schemas:
    PolicyGenerateDocumentUploadUrlInputBody:
      type: object
      properties:
        name:
          type: string
          description: 'name '
        metadata:
          description: metadata of the policy
          example:
            - key: category
              value: kbis
          type: array
          items:
            $ref: '#/components/schemas/Metadata'
      required:
        - name
    GenerateDocumentUploadUrlOutput:
      type: object
      properties:
        url:
          type: string
          description: the signed url to upload the document
        id:
          type: string
          description: the id of the document
      required:
        - url
        - id
    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
    InvalidNonDelegatedDocumentTypeErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_NON_DELEGATED_DOCUMENT_TYPE
        message:
          type: string
          example: >-
            Document type {documentType} is not allowed for non-delegated
            document generation in product {productId}
        details:
          $ref: '#/components/schemas/InvalidNonDelegatedDocumentTypeDetailsDto'
      required:
        - code
        - message
        - details
    DuplicateNonDelegatedDocumentTypeErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - DUPLICATE_NON_DELEGATED_DOCUMENT_TYPE
        message:
          type: string
          example: 'Duplicate non delegated document type: {documentType}'
        details:
          $ref: '#/components/schemas/DuplicateNonDelegatedDocumentTypeDetailsDto'
      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
    NonDelegatedDocumentsConfigNotFoundErrorDto:
      type: object
      properties:
        code:
          type: string
          enum:
            - NON_DELEGATED_DOCUMENTS_CONFIG_NOT_FOUND
        message:
          type: string
          example: >-
            Non-delegated documents configuration not found for product
            {productId}
        details:
          $ref: '#/components/schemas/NonDelegatedDocumentsConfigNotFoundDetailsDto'
      required:
        - code
        - message
        - details
    Metadata:
      type: object
      properties:
        key:
          type: string
          description: the key of the metadata
        value:
          type: string
          description: the value of the metadata
      required:
        - key
        - value
    InvalidEventCreationDateDetailsDto:
      type: object
      properties:
        createdAt:
          format: date-time
          type: string
        latestCreatedAt:
          format: date-time
          type: string
      required:
        - createdAt
        - latestCreatedAt
    InvalidNonDelegatedDocumentTypeDetailsDto:
      type: object
      properties:
        documentType:
          type: string
        productId:
          type: string
      required:
        - documentType
        - productId
    DuplicateNonDelegatedDocumentTypeDetailsDto:
      type: object
      properties:
        documentType:
          type: string
      required:
        - documentType
    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
    NonDelegatedDocumentsConfigNotFoundDetailsDto:
      type: object
      properties:
        productId:
          type: string
      required:
        - productId

````