openapi: 3.0.0
info:
  version: '1.0'
  title: Account snapshots
servers:
  - url: https://api.solaris-sandbox.de
    description: Sandbox
  - url: https://api.solarisbank.de
    description: Production
paths:
  /v1/persons/{person_id}/account_snapshots:
    post:
      tags:
        - Account snapshots
      summary: Create an account snapshot
      description: >-
        Creates an account snapshot for the customer with the `person_id`
        specified in the request URL. The account snapshot contains account
        information, such as balance, transactions, bookings, etc. <br>You can
        create an account snapshot in various ways by specifying the source.
        Check the properties descriptions and examples for more information.
      security:
        - oauth2:
            - solaris_service_account_snapshot#create_session
      responses:
        '201':
          description: Application
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/AccountSnapshotWeb.AccountSnapshots.CreateAccountSnapshotResponse
      requestBody:
        required: false
        description: The account snapshot attributes
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/AccountSnapshotWeb.CreateAccountSnapshotRequest
      parameters:
        - schema:
            type: string
          required: true
          name: person_id
          in: path
          description: >-
            The person ID of the customer for whom you're creating an account
            snapshot.
      operationId: AccountSnapshotWeb.V1.AccountSnapshots.CreateOperation
      deprecated: false
  /v1/persons/{person_id}/account_snapshots/{account_snapshot_id}:
    get:
      tags:
        - Account snapshots
      summary: Retrieve account snapshot
      description: >-
        Returns an account snapshot for a customer. You can use this endpoint to
        retrieve the details of an account snapshot and check its validity.
        Additionally, you can subscribe to the webhook event `ACCOUNT_SNAPSHOT`
        to receive notifications about status changes.
      security:
        - oauth2:
            - solaris_service_account_snapshot#find
      responses:
        '200':
          description: AccountSnapshot
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/AccountSnapshotWeb.AccountSnapshot.ShowAccountSnapshotResponse
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
      parameters:
        - schema:
            type: string
          required: true
          name: person_id
          in: path
          description: The person ID of the customer whose snapshot you want to retrieve.
        - schema:
            type: string
          required: true
          name: account_snapshot_id
          in: path
          description: The ID of the customer's account snapshot resource.
      operationId: AccountSnapshotWeb.V1.AccountSnapshots.ShowOperation
      deprecated: false
components:
  schemas:
    AccountSnapshotWeb.CreateAccountSnapshotRequest.SnapshotData:
      x-struct: >-
        Elixir.AccountSnapshotWeb.V1.AccountSnapshots.CreateOperation.CreateAccountSnapshotRequest.SnapshotData
      type: object
      title: AccountSnapshotWeb.CreateAccountSnapshotRequest.SnapshotData
      required:
        - date
        - days
        - account
        - balance
        - turnovers
      properties:
        turnovers:
          type: array
          items:
            type: object
            required:
              - tags
              - purpose
              - amount
              - currency
              - booking_date
              - counter_iban
              - counter_bic
              - counter_holder
            properties:
              tags:
                type: array
                description: Tags for the transactions.
                example:
                  - salary
                items:
                  type: string
              purpose:
                type: array
                description: The purpose of the transaction.
                example:
                  - >-
                    SEPA-GEHALTSGUTSCHRIFT FinTecSystems GmbH LOHN / GEHALT
                    12/16
                items:
                  type: string
              currency:
                type: string
                description: The currency of the transaction.
                example: EUR
                enum:
                  - EUR
              counter_iban:
                type: string
                description: The IBAN of the account from which the transaction was sent.
                example: DE87110101001000057123
              counter_holder:
                type: string
                description: >-
                  The name of the account holder whose account was used for the
                  transaction.
                example: FinTecSystems GmbH
              counter_bic:
                type: string
                description: >-
                  The Bank Identifier Code (BIC) of the account that sent the
                  transaction.
                example: TESTDE88XXX
              booking_date:
                type: string
                format: date
                description: The booking date of the transaction.
                example: '2020-02-28'
              amount:
                type: number
                description: >-
                  The transaction amount in Euros (expressed as a whole number,
                  no cents allowed).
                example: 3009
        days:
          type: integer
          description: The number of days during which transactions were pulled.
          example: 365
        date:
          type: string
          format: date
          description: The date when the account snapshot was created.
          example: '2020-02-28'
        balance:
          type: object
          required:
            - limit
            - balance
            - currency
            - date
          properties:
            limit:
              type: number
              description: The account limit in Euro (decimal number, not in cents).
              example: 1000
            date:
              type: string
              description: The date of the current balance.
              example: '2020-02-28'
              format: date
            currency:
              type: string
              description: The currency of the bank account.
              example: EUR
              enum:
                - EUR
            balance:
              type: number
              description: >-
                The account balance in Euros (expressed as a whole number, no
                cents allowed).
              example: 2123
        account:
          type: object
          required:
            - joint_account
            - iban
            - holder
            - description
            - bic
            - bank_name
            - country_id
          properties:
            joint_account:
              type: boolean
              description: Indicates whether or not the account is a joint account.
            iban:
              type: string
              description: The customer's IBAN.
              example: DE88888881010987654321
            holder:
              type: string
              description: The name of the account holder.
              example: MUSTERMANN, HARTMUT
            description:
              type: string
              description: >-
                Description of the customer's bank account, e.g., bank account
                type.
              example: Girokonto
            country_id:
              type: string
              description: >-
                The country ID related to the customer's account. ISO 3166-1
                alpha-2 country codes.
              example: DE
            bic:
              type: string
              description: The customer's bank identifier code.
              example: TESTDE88XXX
            bank_name:
              type: string
              description: The bank name of the customer's account.
              example: Testbank
      nullable: true
      description: >-
        An object to upload the output of the account snapshot you created. Only
        relevant if the `source` is `PARTNER`.
    AccountSnapshotWeb.CreateAccountSnapshotRequest:
      x-struct: >-
        Elixir.AccountSnapshotWeb.V1.AccountSnapshots.CreateOperation.CreateAccountSnapshotRequest
      type: object
      title: AccountSnapshotWeb.CreateAccountSnapshotRequest
      required:
        - source
      properties:
        source:
          type: string
          enum:
            - FIN_TEC_SYSTEMS
            - FINREACH
            - SOLARISBANK
            - PARTNER
          description: >-
            The source of the account snapshot. You can either create an
            automated snapshot via FinTecSystems or FINREACH, upload an output
            of a snapshot you created (in this case, the `snapshot_data` field
            is required), or a snapshot of a Solarisbank account (in this case,
            the `account_id` field is required).
        snapshot_data:
          $ref: >-
            #/components/schemas/AccountSnapshotWeb.CreateAccountSnapshotRequest.SnapshotData
        partner_reference_number:
          type: string
          description: Your internal reference number for the customer's account snapshot.
          nullable: true
        iban:
          type: string
          nullable: true
          description: >-
            The customer's IBAN to be used for the account snapshot. Only
            relevant if the `source` is `FIN_TEC_SYSTEMS` or `FINREACH`.
        account_id:
          type: string
          description: >-
            The customer's account ID to be used to initiate a Solarisbank
            account snapshot. Only relevant if the `source` is `SOLARISBANK`.
          nullable: true
    AccountSnapshotWeb.AccountSnapshots.CreateAccountSnapshotResponse:
      x-struct: >-
        Elixir.AccountSnapshotWeb.V1.AccountSnapshots.CreateOperationView.CreateAccountSnapshotResponse
      type: object
      title: AccountSnapshotWeb.AccountSnapshots.CreateAccountSnapshotResponse
      required:
        - id
      properties:
        wizard_session_key:
          type: string
          description: >-
            The wizard key session. Only relevant if the `source` is
            `FIN_TEC_SYSTEMS`.
          example: wiz04852083740
          nullable: true
        location:
          type: string
          description: >-
            The URL to which you must redirect the customer to complete the
            account snapshot. Only relevant if `source` is `FINREACH`.
          example: https://ui.solaris-i.prod.finleap.cloud?token=xxxxxx
          nullable: true
        id:
          type: string
          description: The ID of the account snapshot resource.
          example: 6c8f81a234df4052a9cde197577347b7snap
        account_id:
          type: string
          description: >-
            The customer's account ID to be used to initiate a Solarisbank
            account snapshot. Only relevant if the `source` is `SOLARISBANK`.
          example: adc123a45d6d7cf8fbfeed537ba919d5cacc
          nullable: true
    AccountSnapshotWeb.AccountSnapshot.ShowAccountSnapshotResponse:
      x-struct: >-
        Elixir.AccountSnapshotWeb.V1.AccountSnapshots.ShowOperationView.ShowAccountSnapshotResponse
      type: object
      title: AccountSnapshotWeb.AccountSnapshot.ShowAccountSnapshotResponse
      required:
        - id
        - status
        - provider
      properties:
        wizard_session_key:
          type: string
          description: >-
            The wizard key session. Only relevant if the `source` is
            `FIN_TEC_SYSTEMS`.
          example: wiz04852083740
          nullable: true
        status_description:
          type: string
          description: Additional context around the account snapshot status.
          nullable: true
        status:
          type: string
          description: The status of the account snapshot.
          example: available
          enum:
            - pending
            - available
            - expired
            - failed
        provider:
          type: string
          description: The provider of the account snapshot.
          example: FINREACH
        location:
          type: string
          description: >-
            The URL to which you must redirect the customer to complete the
            account snapshot. Only relevant if `source` is `FINREACH`.
          example: https://ui.solaris-i.prod.finleap.cloud?token=xxxxxx
          nullable: true
        id:
          type: string
          description: The ID of the account snapshot resource.
          example: 6c8f81a234df4052a9cde197577347b7snap
        iban:
          type: string
          description: >-
            The customer's IBAN to be used for the account snapshot. Only
            relevant if the `source` is `FIN_TEC_SYSTEMS` or `FINREACH`.
          example: DE87110101001000057123
          nullable: true
        account_id:
          type: string
          description: >-
            The customer's account ID to be used to initiate a Solarisbank
            account snapshot. Only relevant if the `source` is `SOLARISBANK`.
          example: adc123a45d6d7cf8fbfeed537ba919d5cacc
          nullable: true
    Error404:
      x-struct: Elixir.SolarisToolkit.Web.Schemas.HttpError.Error404
      type: object
      title: Error404
      properties:
        title:
          type: string
          example: Model Not Found
        status:
          type: string
          example: '404'
        id:
          type: string
          example: a95f2aaf-4e0c-4d49-8021-8a16a884ed86
        detail:
          type: string
          example: >-
            Couldn't find 'Account snapshot' for id
            '0a3f28733f9a4842842aae2804f80eb4snap'.
        code:
          type: string
          example: model_not_found
