openapi: 3.0.1
info:
  title: Partner Documents
  version: 2.10.0
  description: Rest API for Partner Document Management. This API is used to manage documents not connected to single customer. For example reports.
  contact:
    name: Tradevest GmbH
servers:
  - url: https://tvda-api.platform-test.tradevest.ai
    description: Test
security:
  - Bearer: []
tags:
  - name: Partner Documents
    description: Partner Documents
paths:
  /partner-documents:
    get:
      summary: Get Partner Documents
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerDocuments'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      operationId: get-partner-documents
      x-operation-group: partner-documents-query
      x-required-permissions: rs/partner-documents/read
      tags:
        - Partner Documents
      parameters:
        - schema:
            $ref: '#/components/schemas/PartnerDocumentTypeEnum'
          in: query
          name: documentType
          description: Type of document. For example TERMS_AND_CONDITIONS.
        - schema:
            type: string
            format: date-time
          in: query
          name: startDate
          description: Beginning of the range. Document create date time is after this parameter.
        - schema:
            type: string
            format: date-time
          in: query
          name: endDate
          description: End of the range. Document create date time is before this parameter.
        - schema:
            type: boolean
          in: query
          name: isValid
          description: Used to filter active documents.
        - schema:
            type: string
          in: query
          name: cursor
          description: String value used for pagination
        - schema:
            type: integer
            default: 20
            minimum: 1
          in: query
          description: Maximum number of items to return
          name: limit
          required: true
      description: '> Get partner documents not connected to single customer. For example reports. By default, it returns last 20 documents. It is possible to send query parameters to adjust the result.'
  /partner-documents/{documentId}:
    parameters:
      - schema:
          type: string
          format: uuid
        name: documentId
        in: path
        required: true
        description: Id of document
    get:
      summary: Get Partner Document
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerDocument'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      operationId: get-partner-document
      x-operation-group: partner-documents-query
      x-required-permissions: rs/partner-documents/read
      tags:
        - Partner Documents
      description: '> Get single partner document for given documentId.'
  /partner-documents/{documentId}/file:
    parameters:
      - schema:
          type: string
          format: uuid
        name: documentId
        in: path
        required: true
        description: Id of document
    get:
      summary: Download document file
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
              examples: {}
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      operationId: download-partner-document
      x-operation-group: partner-documents-query
      x-required-permissions: rs/partner-documents/read
      tags:
        - Partner Documents
      description: '> Download document file for given documentId.'
components:
  schemas:
    PartnerDocuments:
      title: PartnerDocuments
      type: object
      properties:
        data:
          type: array
          description: Array of documents
          items:
            $ref: '#/components/schemas/PartnerDocument'
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - data
        - pagination
    PartnerDocument:
      type: object
      properties:
        documentId:
          type: string
          format: uuid
          readOnly: true
        size:
          type: integer
          description: file size in kB
          readOnly: true
        version:
          type: integer
          description: document version
          readOnly: true
        validFrom:
          type: string
          format: date
        validUntil:
          type: string
          format: date
        name:
          type: string
          maxLength: 255
        type:
          $ref: '#/components/schemas/PartnerDocumentTypeEnum'
        description:
          type: string
          minLength: 1
          maxLength: 255
        createdOn:
          type: string
          format: date-time
          readOnly: true
        modifiedOn:
          type: string
          format: date-time
          readOnly: true
      required:
        - createdOn
        - documentId
        - modifiedOn
        - name
        - size
        - type
        - version
      title: Document
    PartnerDocumentData:
      title: PartnerDocumentData
      type: object
      properties:
        name:
          type: string
          maxLength: 255
        type:
          $ref: '#/components/schemas/PartnerDocumentTypeEnum'
        description:
          type: string
          minLength: 1
          maxLength: 255
      required:
        - name
        - type
    PartnerDocumentTypeEnum:
      title: PartnerDocumentTypeEnum
      description: This list may change in the future.
      type: string
      enum:
        - TERMS_AND_CONDITIONS
        - DATA_PRIVACY_POLICY
        - KIID
        - RISK_INFORMATION
        - CONSUMER_INFORMATION
        - PRODUCT_TERMS_AND_CONDITIONS
    Pagination:
      title: Pagination
      type: object
      properties:
        cursor:
          type: string
          description: String value used for pagination, which should be set in next page request.
        limit:
          type: integer
          description: Maximum number of returned items
      required:
        - cursor
        - limit
    ErrorDetailsExplanation:
      title: ErrorDetailsExplanation
      type: object
      properties:
        code:
          type: string
          maxLength: 255
        parameter:
          type: string
        message:
          type: string
      required:
        - code
        - message
    ErrorDetails:
      title: ErrorDetails
      type: object
      properties:
        field:
          type: string
          maxLength: 255
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetailsExplanation'
      required:
        - field
    ErrorMessage:
      title: ErrorMessage
      type: object
      properties:
        message:
          type: string
        responseType:
          type: string
        validationString:
          minLength: 1
          type: string
        requestId:
          type: string
        errorCode:
          type: string
          maxLength: 255
        errorDetails:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetails'
      required:
        - message
        - responseType
        - requestId
  securitySchemes:
    Bearer:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /oauth2/token
          scopes: {}
x-tagGroups:
  - name: Partner Documents
    tags:
      - Partner Documents
