openapi: 3.1.0
info:
  title: AbaNinja Accounts API
  version: 3.0.0
  x-domain-id: accounts
servers:
  - url: https://api.abaninja.ch
    description: The AbaNinja API server
tags:
  - name: accounts
    description: Manage accounts
    x-displayName: Accounts
  - name: users
    description: Manage users
    x-displayName: Users
security:
  - ApiToken: []
paths:
  /users/v2/me:
    get:
      tags:
        - users
      summary: Get user profile
      description: Get the profile of the current user
      operationId: users_list_me
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: User Resource Schema
                        description: The current users profile
                        properties:
                          uuid:
                            type: string
                            format: uuid
                          oauthUserUuid:
                            type:
                              - string
                              - 'null'
                            format: uuid
                          firstName:
                            type:
                              - string
                              - 'null'
                          lastName:
                            type:
                              - string
                              - 'null'
                          email:
                            type:
                              - string
                              - 'null'
                            format: email
                          role:
                            type: string
                            enum:
                              - STANDARD
                              - SUPPORT
                              - SUPPORT_AGENT
                              - SUPPORT_MANAGER
                              - ABANINJA_ADMIN
                        type: object
                      status:
                        example: 200
                    type: object
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/profile
      x-legacy-operation-id: 487029d0787aee5d6488594202f5cd9e
      x-required-scopes:
        - profile
  /accounts/{accountUuid}/v2/users:
    get:
      tags:
        - users
      summary: Get users
      description: Get all users for an account
      operationId: v2_list_users
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        type: array
                        items:
                          title: User Resource
                          properties:
                            uuid:
                              type: string
                              format: uuid
                            email:
                              type:
                                - string
                                - 'null'
                              format: email
                            firstName:
                              type:
                                - string
                                - 'null'
                            lastName:
                              type:
                                - string
                                - 'null'
                            isOwner:
                              type: boolean
                            isAdmin:
                              type: boolean
                          type: object
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounts
      x-legacy-operation-id: f3d1866e150badb823642f7e55bfe9f5
      x-required-scopes:
        - accounts
  /accounts/v2/accounts/{accountUuid}:
    get:
      tags:
        - accounts
      summary: Get account
      description: Get account information
      operationId: accounts_get_accounts
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: Account Resource
                        properties:
                          uuid:
                            type: string
                            format: uuid
                          name:
                            type: string
                          email:
                            type: string
                            format: email
                          type:
                            type: string
                            enum:
                              - SWISS21
                              - NINJABOX
                              - STR
                          locale:
                            type: string
                            enum:
                              - de
                              - en
                              - fr
                              - it
                          currencyCode:
                            type: string
                            format: iso-4217
                            maxLength: 3
                            minLength: 3
                          lastLogin:
                            type:
                              - string
                              - 'null'
                            format: date-time
                          hasLogo:
                            type: boolean
                          isInitialized:
                            description: shows if the account is finished setting up
                            type: boolean
                          industryCode:
                            description: NOGA code
                            type:
                              - string
                              - 'null'
                          companyKindCode:
                            type:
                              - string
                              - 'null'
                            enum:
                              - TRADE
                              - PRODUCTION
                              - SERVICE
                              - PRIVATE
                          legalFormCode:
                            type:
                              - string
                              - 'null'
                            enum:
                              - SOLE_PROPRIETORSHIP
                              - GENERAL_PARTNERSHIP
                              - LIMITED_PARTNERSHIP
                              - LIMITED_COMPANY
                              - LIMITED_LIABILITY_COMPANY
                              - ASSOCIATION
                          language:
                            type: string
                            enum:
                              - de
                              - en
                              - fr
                              - it
                        type: object
                      status:
                        example: 200
                    type: object
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounts
            - https://api.abaninja.ch/auth/profile
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: bd9ba82ee57865ab384ee4fb21b8e543
      x-required-scopes:
        - accounts
        - profile
        - settings
  /users/v2/me/accounts:
    get:
      tags:
        - users
      summary: List user accounts
      description: Lists all accounts of the current user
      operationId: users_list_accounts
      parameters:
        - name: page
          in: query
          schema:
            type:
              - integer
              - 'null'
            default: 1
            minimum: 1
        - name: perPage
          in: query
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        type: array
                        items:
                          title: User Account Resource Schema
                          description: The current users account
                          properties:
                            uuid:
                              type: string
                              format: uuid
                            appInstanceUuid:
                              type:
                                - string
                                - 'null'
                              format: uuid
                            name:
                              type: string
                            email:
                              type:
                                - string
                                - 'null'
                              format: email
                            type:
                              type: string
                              enum:
                                - SWISS21
                                - NINJABOX
                                - STR
                            lastLogin:
                              type:
                                - string
                                - 'null'
                              format: date-time
                            isOwner:
                              type: boolean
                            accountRole:
                              type: string
                              enum:
                                - OWNER
                                - ADMIN
                                - EMPLOYEE
                                - SUPPORT
                                - DC
                          type: object
                      status:
                        example: 200
                    type: object
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/profile
      x-legacy-operation-id: e168aad61bdc1dd5e33c4f9a0400002a
      x-required-scopes:
        - profile
  /accounts/{accountUuid}/v2/users/{userUuid}:
    get:
      tags:
        - users
      summary: Get user
      description: Get a user for an account
      operationId: v2_get_users
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: userUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: User Resource
                        properties:
                          uuid:
                            type: string
                            format: uuid
                          email:
                            type:
                              - string
                              - 'null'
                            format: email
                          firstName:
                            type:
                              - string
                              - 'null'
                          lastName:
                            type:
                              - string
                              - 'null'
                          isOwner:
                            type: boolean
                          isAdmin:
                            type: boolean
                        type: object
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounts
      x-legacy-operation-id: 72728e9b7df7bc74e61cb994ab1e88bb
      x-required-scopes:
        - accounts
  /accounts/v2/accounts/{accountUuid}/logo:
    get:
      tags:
        - accounts
      summary: Get logo
      description: Get the account logo
      operationId: accounts_list_logo
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          headers:
            Content-Type:
              schema:
                type: string
                enum:
                  - image/jpeg
            Content-Length:
              schema:
                type: integer
          content:
            image/jpeg:
              schema:
                type: string
                format: binary
        '404':
          description: No logo available
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounts
            - https://api.abaninja.ch/auth/profile
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 7a12d935a96a3ba786fe1894c513df30
      x-required-scopes:
        - accounts
        - profile
        - settings
    post:
      tags:
        - accounts
      summary: Upload logo
      description: Upload a new account logo
      operationId: accounts_create_logo
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              required:
                - logo
              properties:
                logo:
                  type: string
                  format: binary
              type: object
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data: {}
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounts
            - https://api.abaninja.ch/auth/profile
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 6e0c998e1a3ecfab6bafadd6aac8c945
      x-required-scopes:
        - accounts
        - profile
        - settings
components:
  securitySchemes:
    ApiToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Create tokens in Settings > API Token.
