openapi: 3.0.1
info:
  title: 'Document conversion: API Specification'
  description: 'The Document conversion: API Specification'
  version: 0.0.133
servers:
- description: Generated server url
  url: https://api.uat.btx.fr.banqup.com/utils/conversion
- description: Generated server url
  url: https://api.uat.btx.eu.banqup.com/utils/conversion
security:
- document_service: []
tags:
- name: Document validation
  description: These endpoints validate and detect the representation format of a
    document
paths:
  /v1/validate:
    post:
      tags:
      - Document validation
      summary: Validation document format
      description: 'This endpoint validates and detects the representation format
        of a document <br/> Scope: []'
      operationId: validateDocumentFormat
      requestBody:
        description: File Validate Request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentValidateRequest'
        required: true
      responses:
        '200':
          description: Validated document and detected its representation format successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentValidateResponse'
              example:
                errors: []
                warnings: []
                status: valid
                document_type: FACTUR X/ZUGFERD
                namespace:
                profile: MINIMUM
        '400':
          description: Invalid or unsupported file's content type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
        '401':
          description: Access to this resource is denied due to missing or invalid
            authentication credentials. Please provide valid credentials and try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 401
                error: UNAUTHENTICATED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Unauthorized
                detail: Access to the requested resource lacks valid authentication
                  credentials.
  /v1/files:convert:
    post:
      tags:
      - Document conversion
      summary: Convert document format
      description: 'This endpoint converts a document from one to another format <br/>
        Scope: []'
      operationId: convertDocumentFormat
      requestBody:
        description: File Convert Request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentConvertRequest'
        required: true
      responses:
        '200':
          description: The output document has been uploaded to your outputUrl.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentConvertResponse'
              example:
                inputType: eu.cen.en16931:ubl:1.3.12
                outputType: com.unifiedpost.btx.datastore.json:invoice:2.0
        '400':
          description: Invalid or unsupported outputType
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
        '401':
          description: Access to this resource is denied due to missing or invalid
            authentication credentials. Please provide valid credentials and try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 401
                error: UNAUTHENTICATED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Unauthorized
                detail: Access to the requested resource lacks valid authentication
                  credentials.
  /v1/outputTypes:
    get:
      tags:
      - Document conversion
      summary: Get list of valid output types.
      description: 'This endpoint provides a list of valid output types for conversion.
        <br/> Scope: []'
      operationId: getOutputDocumentTypes
      responses:
        '200':
          description: List of valid output types.
          content:
            application/json:
              schema:
                type: string
              example:
                inputType: eu.cen.en16931:ubl:1.3.12
                outputType: com.unifiedpost.btx.datastore.json:invoice:2.0
        '401':
          description: Access to this resource is denied due to missing or invalid
            authentication credentials. Please provide valid credentials and try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 401
                error: UNAUTHENTICATED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Unauthorized
                detail: Access to the requested resource lacks valid authentication
                  credentials.
  /v1/inputTypes:
    get:
      tags:
      - Document conversion
      summary: Get list of valid input types.
      description: 'This endpoint provides a list of valid input types for conversion.
        <br/> Scope: []'
      operationId: getInputDocumentTypes
      responses:
        '200':
          description: List of valid input types.
          content:
            application/json:
              schema:
                type: string
              example:
                inputType: eu.cen.en16931:ubl:1.3.12
                outputType: com.unifiedpost.btx.datastore.json:invoice:2.0
        '401':
          description: Access to this resource is denied due to missing or invalid
            authentication credentials. Please provide valid credentials and try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 401
                error: UNAUTHENTICATED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Unauthorized
                detail: Access to the requested resource lacks valid authentication
                  credentials.
components:
  schemas:
    DocumentValidateRequest:
      required:
      - inputUrl
      type: object
      properties:
        inputUrl:
          type: string
          description: The validation profile that should be applied to validate the
            input document
        validationProfile:
          type: string
          description: The validation profile that should be applied to validate the
            input document
    DocumentValidateResponse:
      required:
      - documentType
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
        warnings:
          type: array
          items:
            type: string
        status:
          type: string
        documentType:
          type: string
        namespace:
          type: string
        profile:
          type: string
    ApiErrorProblemDetail:
      required:
      - error
      - requestId
      - timestamp
      type: object
      properties:
        status:
          type: integer
          format: int32
        error:
          type: string
        requestId:
          type: string
        timestamp:
          type: string
          format: date-time
        type:
          type: string
          format: uri
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
          format: uri
        problems:
          type: array
          items:
            $ref: '#/components/schemas/NestedProblem'
        properties:
          type: object
          additionalProperties:
            type: object
    NestedProblem:
      required:
      - detail
      - error
      - title
      type: object
      properties:
        error:
          type: string
        title:
          type: string
        detail:
          type: string
        type:
          type: string
          format: uri
    Address:
      type: object
      properties:
        streetName:
          type: string
          description: The street name
        house:
          type: string
          description: The house number
        buildingNumber:
          type: string
          description: The build number
        level:
          type: string
          description: The level of the building
        postCode:
          type: string
          description: The postal code
        city:
          type: string
          description: The city name
        state:
          type: string
          description: The state name
        room:
          type: string
        postBox:
          type: string
        townName:
          type: string
        country:
          type: string
          description: The country name
        countryCode:
          pattern: ^[a-zA-Z]{2}$
          type: string
          description: The country code
        department:
          type: string
        floor:
          type: string
      description: Address JSON schema
    Allowance:
      type: object
      properties:
        netAmount:
          type: string
        baseAmount:
          type: string
        percentage:
          type: string
        vatCategory:
          type: string
        vatPercentage:
          type: string
        description:
          type: string
        reasonCode:
          type: string
    Attachment:
      type: object
      properties:
        contentType:
          type: string
          description: The mimeType of the document
        url:
          type: string
          description: The URL where the document can be downloaded
      description: Attachments to be embedded in the output document
    Bank:
      type: object
      properties:
        identifier:
          type: string
        scheme:
          type: string
    Be:
      type: object
      allOf:
      - $ref: '#/components/schemas/GlobalIdentifiers'
      - type: object
        properties:
          be:vat:
            type: string
          be:en:
            type: string
    Charge:
      type: object
      properties:
        netAmount:
          type: string
        baseAmount:
          type: string
        percentage:
          type: string
        vatCategory:
          type: string
        vatPercentage:
          type: string
        description:
          type: string
        reasonCode:
          type: string
    Customer:
      type: object
      properties:
        legalName:
          type: string
        tradeName:
          type: string
        address:
          $ref: '#/components/schemas/Address'
        globalIdentifiers:
          $ref: '#/components/schemas/GlobalIdentifiers'
    Delivery:
      type: object
      properties:
        name:
          type: string
        address:
          $ref: '#/components/schemas/Address'
        deliveryDate:
          type: string
    Document:
      type: object
      properties:
        additionalProperties:
          type: object
          additionalProperties:
            type: object
        metadata:
          $ref: '#/components/schemas/Metadata'
        lines:
          type: array
          items:
            $ref: '#/components/schemas/Line'
      description: Inline BTX Json for Document. This will be omitted if inputUrl
        is present in request.
    DocumentConvertRequest:
      required:
      - inputType
      - outputType
      - outputUrl
      type: object
      properties:
        inputType:
          type: string
          description: Type (format) of the input document
          enum:
          - com.unifiedpost.btx.datastore.json
          - com.unifiedpost.btx.datastore.json:invoice
          - eu.peppol.bis3:creditnote
          - eu.peppol.bis3:creditnote:2024.5
          - eu.peppol.bis3:invoice
          - eu.peppol.bis3:invoice:2024.5
          - fr.factur-x:en16931:1.0.6
          - fr.factur-x:basic:1.0.6
          - fr.factur-x:minimum:1.0.6
          - fr.factur-x:basicwl:1.0.6
          - fr.factur-x:extended:1.0.6
          - fr.factur-x:en16931:1.0.7-2
          - fr.factur-x:basic:1.0.7-2
          - fr.factur-x:basicwl:1.0.7-2
          - fr.factur-x:extended:1.0.7-2
          - fr.factur-x:minimum:1.0.7-2
          - fr.factur-x
          - fr.factur-x:en16931
          - fr.factur-x:basic
          - fr.factur-x:minimum
          - fr.factur-x:basicwl
          - fr.factur-x:extended
        outputType:
          type: string
          description: Target format for the conversion output
          enum:
          - eu.peppol.bis3:creditnote
          - eu.peppol.bis3:creditnote:2024.5
          - eu.peppol.bis3:invoice
          - eu.peppol.bis3:invoice:2024.5
          - be.efff:creditnote
          - be.efff:creditnote:3.0.0
          - be.efff:invoice
          - be.efff:invoice:3.0.0
          - com.unifiedpost.btx.datastore.json
          - eu.cen.en16931:cii
          - com.unifiedpost.btx.pdf
          - be.febelfin:coda:2.6
          - org.cfonb:cfonb
          - es.aebanca:norma:43
          - org.iso20022:camt:053.001.02
          - com.unifiedpost.btx.aggregation.pdf:emr:1.0
          - com.unifiedpost.btx.pdf
          - fr.factur-x
          - fr.factur-x:en16931
          - fr.factur-x:en16931:1.0.7-2
          - fr.factur-x:basic
          - fr.factur-x:basic:1.0.7-2
          - fr.factur-x:basicwl
          - fr.factur-x:basicwl:1.0.7-2
          - fr.factur-x:extended
          - fr.factur-x:extended:1.0.7-2
          - fr.factur-x:minimum
          - fr.factur-x:minimum:1.0.7-2
          - de.zugferd:en16931
          - de.zugferd:en16931:2.3.2
          - de.zugferd:basic
          - de.zugferd:basic:2.3.2
          - de.zugferd:basicwl
          - de.zugferd:basicwl:2.3.2
          - de.zugferd:minimum
          - de.zugferd:minimum:2.3.2
          - eu.peppol.bis3.sg.ubl
          - eu.peppol.bis3.sg.ubl:creditnote
          - eu.peppol.bis3.sg.ubl:creditnote:2023.12
          - eu.peppol.bis3.sg.ubl:invoice
          - eu.peppol.bis3.sg.ubl:invoice:2023.12
        inputUrl:
          pattern: 
            ^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$
          type: string
          description: 'The URL where the original document can be downloaded. '
        input:
          $ref: '#/components/schemas/Document'
        outputUrl:
          pattern: 
            ^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$
          type: string
          description: The URL where the converted document should be uploaded to
        attachments:
          type: array
          description: Attachments to be embedded in the output document
          items:
            $ref: '#/components/schemas/Attachment'
    DocumentTotals:
      type: object
      properties:
        linesNetAmount:
          type: string
        allowancesNetAmount:
          type: string
        chargesNetAmount:
          type: string
        netAmount:
          type: string
        vatAmount:
          type: string
        grossAmount:
          type: string
        prepaidAmount:
          type: string
        roundingDifference:
          type: string
        payableAmount:
          type: string
        roundingAmount:
          type: string
    Fr:
      type: object
      allOf:
      - $ref: '#/components/schemas/GlobalIdentifiers'
      - type: object
        properties:
          fr:siren:
            type: string
          fr:siret:
            type: string
          fr:vat:
            type: string
    GlobalIdentifiers:
      type: object
      properties:
        global:phoneNumber:
          type: array
          items:
            type: string
        global:email:
          type: array
          items:
            type: string
        global:participantId:
          type: string
      oneOf:
      - $ref: '#/components/schemas/Be'
      - $ref: '#/components/schemas/Fr'
      - $ref: '#/components/schemas/Nl'
    InvoiceReference:
      type: object
      properties:
        invoiceReference:
          type: string
        issueDate:
          type: string
        invoiceType:
          type: string
        invoiceNumber:
          type: string
    Line:
      type: object
      properties:
        quantity:
          type: string
        unit:
          type: string
        netAmount:
          type: string
        currency:
          type: string
        metadata:
          $ref: '#/components/schemas/LineMetadata'
        pricing:
          $ref: '#/components/schemas/Pricing'
        vatDetails:
          $ref: '#/components/schemas/VatDetail'
        productIdentifiers:
          $ref: '#/components/schemas/ProductIdentifiers'
    LineMetadata:
      type: object
      properties:
        externalLineId:
          type: string
        buyerAccountingReference:
          type: string
        notes:
          type: array
          items:
            $ref: '#/components/schemas/Note'
        allowances:
          type: array
          items:
            $ref: '#/components/schemas/Allowance'
        charges:
          type: array
          items:
            $ref: '#/components/schemas/Charge'
        invoiceReferences:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceReference'
    Metadata:
      type: object
      properties:
        startDate:
          type: string
        endDate:
          type: string
        buyerAccountingReference:
          type: string
        documentNumber:
          type: string
        issueDate:
          type: string
        invoiceType:
          type: string
        currencyCode:
          type: string
        dueDate:
          type: string
        buyerReference:
          type: string
        contractReference:
          type: string
        purchaseOrderReference:
          type: string
        paymentTerms:
          type: string
        notes:
          type: array
          items:
            $ref: '#/components/schemas/Note'
        invoiceReferences:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceReference'
        supplier:
          $ref: '#/components/schemas/Supplier'
        customer:
          $ref: '#/components/schemas/Customer'
        delivery:
          $ref: '#/components/schemas/Delivery'
        prepaid:
          $ref: '#/components/schemas/Prepaid'
        paymentMeans:
          type: array
          items:
            $ref: '#/components/schemas/PaymentMean'
        allowances:
          type: array
          items:
            $ref: '#/components/schemas/Allowance'
        charges:
          type: array
          items:
            $ref: '#/components/schemas/Charge'
        documentTotals:
          $ref: '#/components/schemas/DocumentTotals'
        vatDetails:
          type: array
          items:
            $ref: '#/components/schemas/VatDetail'
        uploadId:
          type: string
        vatChargeableMethod:
          type: string
        vatAlreadyDeclared:
          type: boolean
        processControl:
          $ref: '#/components/schemas/ProcessControl'
        externalLineId:
          type: string
    Nl:
      type: object
      allOf:
      - $ref: '#/components/schemas/GlobalIdentifiers'
      - type: object
        properties:
          nl:vat:
            type: string
          nl:kvk:
            type: string
          nl:oino:
            type: string
    Note:
      type: object
      properties:
        code:
          type: string
        text:
          type: string
    PaymentAccount:
      type: object
      properties:
        identifier:
          type: string
        scheme:
          type: string
        country:
          type: string
        currency:
          type: string
        bank:
          $ref: '#/components/schemas/Bank'
    PaymentMean:
      type: object
      properties:
        code:
          type: string
        text:
          type: string
        paymentReference:
          $ref: '#/components/schemas/PaymentReference'
        paymentAccount:
          $ref: '#/components/schemas/PaymentAccount'
        paymentLink:
          type: string
    PaymentReference:
      type: object
      properties:
        value:
          type: string
        type:
          type: string
        scheme:
          type: string
    Prepaid:
      type: object
      properties:
        paymentDate:
          type: string
        code:
          type: string
        text:
          type: string
        paymentReference:
          $ref: '#/components/schemas/PaymentReference'
    Pricing:
      type: object
      properties:
        itemNetPrice:
          type: string
        itemGrossPrice:
          type: string
        itemPriceQuantity:
          type: string
        itemPriceDiscount:
          type: string
    ProcessControl:
      type: object
      properties:
        businessProcess:
          type: string
    ProductIdentifiers:
      type: object
      properties:
        itemId:
          type: string
        itemCategory:
          type: string
        itemDescription:
          type: string
        itemName:
          type: string
    Supplier:
      type: object
      properties:
        legalName:
          type: string
        tradeName:
          type: string
        address:
          $ref: '#/components/schemas/Address'
        globalIdentifiers:
          $ref: '#/components/schemas/GlobalIdentifiers'
    VatDetail:
      type: object
      properties:
        vatCategory:
          type: string
        vatPercentage:
          type: string
        netAmount:
          type: string
        vatAmount:
          type: string
        exemptionReason:
          type: string
        exemptionReasonCode:
          type: string
    DocumentConvertResponse:
      type: object
      properties:
        inputType:
          type: string
        outputType:
          type: string
  securitySchemes:
    document_service:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://docs.uat.btx.banqup.com/docs/identity/auth/get-bearer-token
          scopes: {}
        authorizationCode:
          authorizationUrl: https://api.uat.btx.fr.banqup.com/v1/oauth20/authorization
          tokenUrl: https://api.uat.btx.fr.banqup.com/v1/oauth20/token_kc
          scopes: {}
