> ## Documentation Index
> Fetch the complete documentation index at: https://second.tech/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Long-poll for wallet notifications

> Long-polls for wallet notifications. Returns all notifications received since the given timestamp. If no timestamp is provided, returns all notifications in the buffer. Returned notifications are sorted by timestamp in ascending order.



## OpenAPI

````yaml https://gitlab.com/ark-bitcoin/bark/-/raw/master/bark-rest/openapi.json get /api/v1/notifications/wait
openapi: 3.1.0
info:
  title: barkd REST API
  description: >-
    A simple REST API for barkd, a wallet daemon for integrating bitcoin
    payments into your app over HTTP. Supports self-custodial Lightning, Ark,
    and on-chain out of the box.


    barkd is a long-running daemon best suited for always-on or
    high-connectivity environments like nodes, servers, desktops, and
    point-of-sale terminals.


    All endpoints return JSON. Amounts are denominated in satoshis.
  contact:
    name: Second Team
    email: hello@second.tech
  license:
    name: MIT
    identifier: MIT
  version: 0.6.0
servers: []
security:
  - bearer: []
tags:
  - name: boards
    description: Move on-chain bitcoin onto the Ark protocol.
  - name: exits
    description: Move bitcoin back on-chain without server cooperation.
  - name: fees
    description: Estimate fees for wallet operations before executing them.
  - name: history
    description: Inspect and annotate wallet movement history.
  - name: lightning
    description: Create Lightning invoices and track receives.
  - name: onchain
    description: Manage barkd's on-chain bitcoin wallet.
  - name: wallet
    description: Manage Ark balances and VTXOs, send payments via Ark, LN, and on-chain.
  - name: bitcoin
    description: Query bitcoin network data.
  - name: notifications
    description: Receive real-time notifications from barkd.
paths:
  /api/v1/notifications/wait:
    get:
      tags:
        - notifications
      summary: Long-poll for wallet notifications
      description: >-
        Long-polls for wallet notifications. Returns all notifications received
        since the given timestamp. If no timestamp is provided, returns all
        notifications in the buffer. Returned notifications are sorted by
        timestamp in ascending order.
      operationId: wait_notification
      parameters:
        - name: since
          in: query
          description: >-
            The timestamp to start waiting for notifications from. If not
            provided, returns all notifications in the buffer.
          required: false
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: >-
            Returns notifications received during the long-poll window if any.
            Otherwise returns an empty array with provided `since` argument as
            `last_pushed_at` field
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WaitNotificationResponse'
        '400':
          description: Invalid query parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    WaitNotificationResponse:
      type: object
      description: Response payload for the long-poll `wait` endpoint.
      required:
        - notifications
      properties:
        last_pushed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: The timestamp of the last notification pushed to the client.
        notifications:
          type: array
          items:
            $ref: '#/components/schemas/WalletNotification'
          description: |-
            Notifications received during the long-poll window. Empty if the
            timeout elapsed without any notifications. Sorted by timestamp
            in ascending order.
    BadRequestError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    InternalServerError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    WalletNotification:
      oneOf:
        - type: object
          description: A new movement was created
          required:
            - movement
            - type
          properties:
            movement:
              $ref: '#/components/schemas/Movement'
            type:
              type: string
              enum:
                - movement-created
        - type: object
          description: An existing movement was updated
          required:
            - movement
            - type
          properties:
            movement:
              $ref: '#/components/schemas/Movement'
            type:
              type: string
              enum:
                - movement-updated
        - type: object
          description: >-
            Some notifications were lost because they are not handled fast
            enough
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - channel-lagging
      description: A notification of something happening in the wallet
    Movement:
      type: object
      description: >-
        Describes an attempted movement of offchain funds within the
        [bark::Wallet].
      required:
        - id
        - status
        - subsystem
        - intended_balance_sat
        - effective_balance_sat
        - offchain_fee_sat
        - sent_to
        - received_on
        - input_vtxos
        - output_vtxos
        - exited_vtxos
        - time
      properties:
        effective_balance_sat:
          type: integer
          format: int64
          description: >-
            How much the wallet balance actually changed by. Positive numbers
            indicate an increase and

            negative numbers indicate a decrease. This is often inclusive of
            applicable fees, and it

            should be the most accurate number.
        exited_vtxos:
          type: array
          items:
            type: string
          description: >-
            A list of IDs for VTXOs that were marked for unilateral exit as a
            result of this movement.

            This could happen for many reasons, e.g. an unsuccessful lightning
            payment which can't be

            revoked but is about to expire. VTXOs listed here will result in a
            reduction of spendable

            balance due to the VTXOs being managed by the [bark::exit::Exit]
            system.
        id:
          type: integer
          format: int32
          description: The internal ID of the movement.
          minimum: 0
        input_vtxos:
          type: array
          items:
            type: string
          description: >-
            A list of [Vtxo](ark::Vtxo) IDs that were consumed by this movement
            and

            are either locked or unavailable.
        intended_balance_sat:
          type: integer
          format: int64
          description: >-
            How much the movement was expected to increase or decrease the
            balance by. This is always an

            estimate and often discounts any applicable fees.
        metadata:
          type:
            - object
            - 'null'
          description: >-
            Miscellaneous metadata for the movement. This is JSON containing
            arbitrary information as

            defined by the subsystem that created the movement.
          additionalProperties: {}
          propertyNames:
            type: string
        offchain_fee_sat:
          type: integer
          format: int64
          description: >-
            How much the movement cost the user in offchain fees. If there are
            applicable onchain fees

            they will not be included in this value but, depending on the
            subsystem, could be found in

            the metadata.
          minimum: 0
        output_vtxos:
          type: array
          items:
            type: string
          description: >-
            A list of IDs for new VTXOs that were produced as a result of this
            movement. Often change

            VTXOs will be found here for outbound actions unless this was an
            inbound action.
        received_on:
          type: array
          items:
            $ref: '#/components/schemas/MovementDestination'
          description: >-
            Describes the means by which the wallet received funds in this
            movement. This could include

            BOLT11 invoices or other useful data.
        sent_to:
          type: array
          items:
            $ref: '#/components/schemas/MovementDestination'
          description: >-
            A list of external recipients that received funds from this
            movement.
        status:
          $ref: '#/components/schemas/MovementStatus'
          description: The status of the movement.
        subsystem:
          $ref: '#/components/schemas/MovementSubsystem'
          description: >-
            Contains information about the subsystem that created the movement
            as well as the purpose

            of the movement.
        time:
          $ref: '#/components/schemas/MovementTimestamp'
          description: >-
            Contains the times at which the movement was created, updated and
            completed.
    MovementDestination:
      type: object
      description: >-
        Describes a recipient of a movement. This could either be an external
        recipient in send actions

        or it could be the bark wallet itself.
      required:
        - destination
        - amount_sat
      properties:
        amount_sat:
          type: integer
          format: int64
          description: How many sats the recipient received.
          minimum: 0
        destination:
          $ref: '#/components/schemas/PaymentMethod'
          description: >-
            An address, invoice or any other identifier to distinguish the
            recipient.
    MovementStatus:
      type: string
      enum:
        - pending
        - successful
        - failed
        - canceled
    MovementSubsystem:
      type: object
      description: >-
        Contains information about the subsystem that created the movement as
        well as the purpose

        of the movement.
      required:
        - name
        - kind
      properties:
        kind:
          type: string
          description: The action responsible for registering the movement.
        name:
          type: string
          description: The name of the subsystem that created and manages the movement.
    MovementTimestamp:
      type: object
      description: >-
        Contains the times at which the movement was created, updated and
        completed.
      required:
        - created_at
        - updated_at
      properties:
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: The action responsible for registering the movement.
        created_at:
          type: string
          format: date-time
          description: When the movement was first created.
        updated_at:
          type: string
          format: date-time
          description: When the movement was last updated.
    PaymentMethod:
      type: object
      title: PaymentMethod
      description: A payment method with a type discriminator and string value
      required:
        - type
        - value
      properties:
        type:
          type: string
          description: The type of payment method
          enum:
            - ark
            - bitcoin
            - output-script
            - invoice
            - offer
            - lightning-address
            - lnurl
            - custom
        value:
          type: string
          description: The payment method value (address, invoice, etc.)
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: AuthToken
      description: Base64url-encoded auth token

````