> ## 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.

# Estimate emergency exit fee

> Estimates the on-chain cost of unilaterally (emergency) exiting a set of VTXOs without server cooperation. The breakdown separates the broadcast cost—CPFP-bumping every not-yet-confirmed transaction in each VTXO's exit tree, paid now from confirmed on-chain funds—from the claim cost of the single batched transaction that later drains the matured outputs. The estimate reflects current chain state, so exit transactions already confirmed cost nothing. `fundable` is false when the wallet's confirmed on-chain balance can't cover the full broadcast walk, which would stall the exit midway.



## OpenAPI

````yaml https://gitlab.com/ark-bitcoin/bark/-/raw/master/bark-rest/openapi.json get /api/v1/exits/fee
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: message
    description: Sign arbitrary messages with the wallet's keys and verify signed messages.
  - 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/exits/fee:
    get:
      tags:
        - exits
      summary: Estimate emergency exit fee
      description: >-
        Estimates the on-chain cost of unilaterally (emergency) exiting a set of
        VTXOs without server cooperation. The breakdown separates the broadcast
        cost—CPFP-bumping every not-yet-confirmed transaction in each VTXO's
        exit tree, paid now from confirmed on-chain funds—from the claim cost of
        the single batched transaction that later drains the matured outputs.
        The estimate reflects current chain state, so exit transactions already
        confirmed cost nothing. `fundable` is false when the wallet's confirmed
        on-chain balance can't cover the full broadcast walk, which would stall
        the exit midway.
      operationId: emergency_exit_fee
      parameters:
        - name: vtxo_ids
          in: query
          description: Comma-separated VTXO ids to exit; omit to exit the entire wallet
          required: false
          schema:
            type: string
        - name: fee_rate_sat_per_vb
          in: query
          description: >-
            Fee rate in sat/vB applied to both legs; omit to price the broadcast
            leg at the current fast rate and the claim leg at the regular rate
          required: false
          schema:
            type: integer
            format: int64
            minimum: 0
        - name: destination
          in: query
          description: Claim destination address; omit to use a placeholder for weighing
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Returns the emergency exit fee breakdown
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmergencyExitFeeEstimateResponse'
        '400':
          description: >-
            A VTXO is unknown, dust, already exited, or already spent, or a
            parameter is invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    EmergencyExitFeeEstimateResponse:
      type: object
      description: A fee breakdown for unilaterally (emergency) exiting a set of VTXOs.
      required:
        - exit_broadcast_fee_sat
        - claim_fee_sat
        - total_fee_sat
        - fee_rate_sat_per_vb
        - txs_to_broadcast
        - fundable
      properties:
        claim_fee_sat:
          type: integer
          format: int64
          description: >-
            The fee for the single batched transaction that drains the matured
            exit outputs (in

            satoshis). Paid later out of the recovered value.
          minimum: 0
        exit_broadcast_fee_sat:
          type: integer
          format: int64
          description: >-
            The CPFP fees to broadcast every not-yet-confirmed exit transaction
            (in satoshis). Paid now

            from confirmed on-chain funds.
          minimum: 0
        fee_rate_sat_per_vb:
          type: integer
          format: int64
          description: >-
            The fee rate the exit-broadcast leg was priced at (sat/vB). Unless
            an explicit fee rate was

            supplied, the claim leg is priced separately at the chain's
            `regular` rate.
          minimum: 0
        fundable:
          type: boolean
          description: >-
            Whether the wallet's current on-chain balance covers the full serial
            exit-broadcast walk.
        total_fee_sat:
          type: integer
          format: int64
          description: The sum of the broadcast and claim fees (in satoshis).
          minimum: 0
        txs_to_broadcast:
          type: integer
          description: >-
            The number of exit transactions that still need to be broadcast and
            CPFP-bumped.
          minimum: 0
    BadRequestError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    InternalServerError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: AuthToken
      description: Base64url-encoded auth token

````