openapi: 3.0.1
info:
  title: 'Partner service: API Specification'
  description: 'The Partner service: API Specification'
  version: 0.0.163
servers:
- description: Generated server url
  url: https://api.btx.fr.banqup.com/partner
- description: Generated server url
  url: https://api.btx.eu.banqup.com/partner
security:
- oauth2: []
tags:
- name: Client
  description: Client APIs
- name: Extension
  description: Extension APIs
paths:
  /v1/spaces/{spaceId}/clients:importFromTemplate:
    post:
      tags:
      - Client
      summary: Import list clients from excel file
      description: "<div class='my-preview'><span>Preview: The API is in development
        or testing phases and the interface could still change slightly.</span></div>
        <br/> Api to import client in bulk <br/> Scope: []"
      operationId: importBulkClient
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientBulkImportRequest'
        required: true
      responses:
        '200':
          description: response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientBulkValidationResponse'
        '400':
          description: Bad request
        '500':
          description: Internal server error
  /v1/clients/importTemplate:create:
    post:
      tags:
      - Client
      summary: Get excel template file for import clients in bulk
      description: "<div class='my-preview'><span>Preview: The API is in development
        or testing phases and the interface could still change slightly.</span></div>
        <br/> Api generate template file for import clients in bulk <br/> Scope: []"
      operationId: getBulkImportTemplate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientBulkImportTemplateRequest'
        required: true
      responses:
        '200':
          description: response
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
        '500':
          description: Internal server error
  /v1/spaces/{spaceId}/clients/settings/billingDefaults:
    patch:
      tags:
      - Extension
      summary: Update extension setting
      description: "<div class='my-preview'><span>Preview: The API is in development
        or testing phases and the interface could still change slightly.</span></div>
        <br/> Api update extension setting <br/> Scope: []"
      operationId: updateExtensionSetting
      parameters:
      - name: spaceId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DefaultBillingRequest'
        required: true
      responses:
        '200':
          description: response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DefaultBillingRequest'
        '400':
          description: Bad request
        '500':
          description: Internal server error
components:
  schemas:
    ClientBulkValidationResponse:
      type: object
      properties:
        success:
          $ref: '#/components/schemas/SuccessClientValidation'
        fail:
          type: array
          items:
            $ref: '#/components/schemas/FailClientValidation'
    ErrorDto:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: error_code
        message:
          type: string
          description: Error message
          example: Name cannot be null
        fieldCode:
          type: string
          description: Field name code
          example: Name
    FailClientValidation:
      required:
      - clientRow
      - name
      type: object
      properties:
        name:
          type: string
          description: Client name
          example: Client1
        clientRow:
          type: string
          description: Client row
          example: '1'
        error:
          type: string
          description: Error code
          example: error_code
        errorList:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDto'
    SuccessClientValidation:
      required:
      - rows
      - total
      type: object
      properties:
        total:
          type: integer
          description: Number of success clients
          format: int32
          example: 3
        rows:
          type: array
          description: Client row validation success
          example:
          - '1'
          - '2'
          - '3'
          items:
            type: string
            description: Client row validation success
            example: '["1","2","3"]'
    ClientBulkImportRequest:
      required:
      - fileId
      type: object
      properties:
        fileId:
          type: string
          description: The file identifier
          format: uuid
          example: 69f296a5-fb7e-47d8-a1de-bd528f0038b0
        rows:
          type: array
          description: Client rows import
          example:
          - '1'
          - '2'
          - '3'
          items:
            type: string
            description: Client rows import
            example: '["1","2","3"]'
        billing:
          type: object
          additionalProperties:
            type: object
            description: Default billing subscription
            example:
              plans: ''
              ownerSpaceId: d6a1eeef-882a-4595-9f6e-b97f90796ad9
              payForClients: ''
              customerGroups: ''
              partnerSpaceId: ''
              periodQuantity: 1
          description: Default billing subscription
          example:
            plans: ''
            ownerSpaceId: d6a1eeef-882a-4595-9f6e-b97f90796ad9
            payForClients: ''
            customerGroups: ''
            partnerSpaceId: ''
            periodQuantity: 1
    ClientBulkImportTemplateRequest:
      required:
      - clientSheetName
      - headers
      type: object
      properties:
        headers:
          type: array
          description: Client template headers
          example:
          - name
          - country
          - email
          items:
            type: string
            description: Client template headers
            example: '["name","country","email"]'
        clientSheetName:
          type: string
          description: Client sheet name
          example: client
        country:
          type: string
          description: Space's country code
          example: be
    DefaultBillingRequest:
      type: object
      properties:
        plans:
          type: array
          description: Billing plans
          example:
          - plan1
          - plan2
          items:
            type: string
            description: Billing plans
            example: '["plan1","plan2"]'
        ownerSpaceId:
          type: string
          description: Owner spaceId
          example: b073a960-e85b-4400-af22-42ec5b15ed4d
        payForClients:
          type: boolean
          description: Is accountant pay for their client subscription
          example: true
        customerGroups:
          type: array
          description: Customer group
          example:
          - customer1
          - customer2
          items:
            type: string
            description: Customer group
            example: '["customer1","customer2"]'
        periodQuantity:
          type: integer
          description: Period quantity
          format: int32
          example: 3
        partnerSpaceId:
          type: string
          description: partner spaceId
          example: b073a960-e85b-4400-af22-42ec5b15ed4d
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.btx.fr.banqup.com/oauth2/client_credential/gettoken
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
        authorizationCode:
          authorizationUrl: https://api.btx.fr.banqup.com/oauth2/auth
          tokenUrl: https://api.btx.fr.banqup.com/oauth2/token
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
