Spare Balance API

The Balance API from Spare — 3 operation(s) for balance.

OpenAPI Specification

spare-balance-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Information Account Balance API
  description: Spare account information API documentation
  termsOfService: https://terms.tryspare.com/en
  contact:
    name: Spare Technologies WLL.
    email: hello@tryspare.com
  license:
    name: Spare Technologies WLL.
  version: '1.0'
security:
- Bearer: []
tags:
- name: Balance
paths:
  /api/v1.0/ais/Balance/Get:
    get:
      tags:
      - Balance
      summary: Get account balance
      description: "**Unique resource name :** ais.v1.balance.get\n            \n**Important!:**\n            \nThe permissions bellow are required on the consent:\n- `ReadAccountsBasic`\n- `ReadAccountsDetail`\n- `ReadBalances`"
      parameters:
      - name: accountId
        in: query
        description: Account id
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '500':
          description: Internal Server Error
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountBalanceModelApiResponse'
        '400':
          description: '- If account id is not valid'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '404':
          description: '- If account does not exist'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
  /api/v1.0/ais/Balance/History:
    get:
      tags:
      - Balance
      summary: Get account balance history
      description: "**Unique resource name :** ais.v1.balance.history\n            \n**Important!:**\n            \n- The maximum allowed date range period is one year.\n- `toDate` need to be greater than `fromDate`\n            \nThe permissions bellow are required on the consent:\n- `ReadAccountsBasic`\n- `ReadAccountsDetail`\n- `ReadBalances`\n- `ReadTransactionsBasic`\n- `ReadTransactionsDetail`\n- `ReadTransactionsDebits`\n- `ReadTransactionsCredits`"
      parameters:
      - name: accountId
        in: query
        description: Account id
        required: true
        schema:
          type: string
          format: uuid
      - name: fromBookingDateTime
        in: query
        description: From booking date time
        schema:
          type: string
          format: date-time
      - name: toBookingDateTime
        in: query
        description: To booking date time
        schema:
          type: string
          format: date-time
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '500':
          description: Internal Server Error
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountBalanceHistoryModelApiResponse'
        '400':
          description: '- If account id is not valid'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '404':
          description: '- If account does not exist'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
  /api/v2.0/ais/Balance/Get:
    get:
      tags:
      - Balance
      summary: Get account balance for long-lived consent
      description: "**Unique resource name :** ais.v2.balance.get\r\n            \r\n**Important!:**\r\n            \r\nThe permissions below are required on the consent:\r\n- `ReadAccountsBasic`\r\n- `ReadAccountsDetail`\r\n- `ReadBalances`"
      parameters:
      - name: accountId
        in: query
        description: Account id
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '500':
          description: Internal Server Error
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountBalanceModelApiResponse'
        '400':
          description: '- If account id is not valid'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
        '404':
          description: '- If an account does not exist'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectApiResponse'
components:
  schemas:
    BalanceLocalExchangeModel:
      type: object
      properties:
        sourceCurrency:
          type: string
          nullable: true
        targetCurrency:
          type: string
          nullable: true
        rate:
          type: number
          format: double
        date:
          type: string
          format: date
        value:
          type: number
          format: double
      additionalProperties: false
    AccountBalanceModel:
      type: object
      properties:
        accountId:
          type: string
          format: uuid
        balances:
          type: array
          items:
            $ref: '#/components/schemas/BalanceModel'
          nullable: true
      additionalProperties: false
    BalanceDataCreditLineModel:
      type: object
      properties:
        included:
          type: boolean
          nullable: true
        type:
          type: string
          nullable: true
        amount:
          $ref: '#/components/schemas/BalanceAmountModel'
      additionalProperties: false
    BalanceAmountModel:
      type: object
      properties:
        amount:
          type: number
          format: double
        currency:
          type: string
          nullable: true
        localExchange:
          $ref: '#/components/schemas/BalanceLocalExchangeModel'
      additionalProperties: false
    BalanceBaseModel:
      type: object
      properties:
        type:
          type: string
          nullable: true
        amount:
          $ref: '#/components/schemas/BalanceAmountModel'
      additionalProperties: false
    ObjectApiResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
        errorDescription:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
            nullable: true
          nullable: true
        data:
          nullable: true
      additionalProperties: false
    AccountBalanceHistoryModel:
      type: object
      properties:
        accountId:
          type: string
          format: uuid
          nullable: true
        history:
          type: array
          items:
            $ref: '#/components/schemas/BalanceHistoryModel'
          nullable: true
      additionalProperties: false
    AccountBalanceHistoryModelApiResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
        errorDescription:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
            nullable: true
          nullable: true
        data:
          $ref: '#/components/schemas/AccountBalanceHistoryModel'
      additionalProperties: false
    BalanceHistoryModel:
      type: object
      properties:
        date:
          type: string
          nullable: true
        balances:
          type: array
          items:
            $ref: '#/components/schemas/BalanceBaseModel'
          nullable: true
      additionalProperties: false
    BalanceModel:
      type: object
      properties:
        creditDebitIndicator:
          type: string
          nullable: true
        dateTime:
          type: string
          nullable: true
        creditLine:
          type: array
          items:
            $ref: '#/components/schemas/BalanceDataCreditLineModel'
          nullable: true
        type:
          type: string
          nullable: true
        amount:
          $ref: '#/components/schemas/BalanceAmountModel'
      additionalProperties: false
    ApiError:
      enum:
      - INVALID_DATA
      - INVALID_SIGNATURE
      - RESOURCE_LOCKED
      - COUNTRY_NOT_FOUND
      - CURRENCY_NOT_FOUND
      - PROVIDER_NOT_FOUND
      - CONNECTION_NOT_FOUND
      - INSUFFICIENT_CONSENT_PERMISSIONS
      - CONSENT_EXPIRED
      - CONSENT_REVOKED
      - CONSENT_UNAUTHORIZED
      - CONSENT_NOT_FOUND
      - RISK_REPORT_NOT_FOUND
      - ACCOUNT_INFORMATION_REPORT_NOT_FOUND
      - MULTIPLE_CURRENCY_NOT_ALLOWED
      - MULTIPLE_CONSENT_DATE_NOT_ALLOWED
      - PAYMENT_NOT_FOUND
      - CONSENT_REJECTED
      - PAYMENT_REQUEST_NOT_FOUND
      - CUSTOMER_NOT_FOUND
      - CUSTOMER_ALREADY_EXISTS
      - BANK_ACCOUNT_NOT_FOUND
      - SERVER_ERROR
      - PROVIDER_CONNECTION_FAILURE
      - TRANSACTION_NOT_FOUND
      - ACCOUNT_INFORMATION_ACCESS_REQUEST_NOT_FOUND
      - CONSENT_REVOCATION_FAILED
      - CONSENT_REVOKED_OR_EXPIRED
      - SUBSCRIPTION_EXPIRED
      - NOT_SUBSCRIBED_TO_SERVICE
      - BENEFICIARY_NOT_FOUND
      - PARTIES_NOT_FOUND
      - DIRECT_DEBIT_NOT_FOUND
      - SCHEDULED_PAYMENT_NOT_FOUND
      - DEBTOR_ACCOUNT_NOT_FOUND
      - CREDITOR_ACCOUNT_NOT_FOUND
      - UNAUTHORIZED_IP_ADDRESS
      type: string
    AccountBalanceModelApiResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
        errorDescription:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
            nullable: true
          nullable: true
        data:
          $ref: '#/components/schemas/AccountBalanceModel'
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: apiKey
      description: Please enter into field the word 'Bearer' followed by a space and JWT
      name: Authorization
      in: header