Babylon Labs v1 API
Babylon Phase-1 API endpoints (Deprecated)
Babylon Phase-1 API endpoints (Deprecated)
swagger: '2.0'
info:
contact:
email: contact@babylonlabs.io
description: 'The Babylon Staking API offers information about the state of the Babylon BTC Staking system.
Your access and use is governed by the API Access License linked to below.'
license:
name: API Access License
url: https://docs.babylonlabs.io/assets/files/api-access-license.pdf
title: Babylon Staking shared v1 API
version: '2.0'
tags:
- description: Babylon Phase-1 API endpoints (Deprecated)
name: v1
paths:
/v1/delegation:
get:
deprecated: true
description: '[DEPRECATED] Retrieves a delegation by a given transaction hash. Please use /v2/delegation instead.'
parameters:
- description: Staking transaction hash in hex format
in: query
name: staking_tx_hash_hex
required: true
type: string
produces:
- application/json
responses:
'200':
description: Delegation
schema:
$ref: '#/definitions/handler.PublicResponse-v1service_DelegationPublic'
'400':
description: 'Error: Bad Request'
schema:
$ref: '#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error'
tags:
- v1
/v1/finality-providers:
get:
deprecated: true
description: '[DEPRECATED] Fetches details of all active finality providers sorted by their active total value locked (ActiveTvl) in descending order. Please use /v2/finality-providers instead.'
parameters:
- description: Public key of the finality provider to fetch
in: query
name: fp_btc_pk
type: string
- description: Pagination key to fetch the next page of finality providers
in: query
name: pagination_key
type: string
produces:
- application/json
responses:
'200':
description: A list of finality providers sorted by ActiveTvl in descending order
schema:
$ref: '#/definitions/handler.PublicResponse-array_v1service_FpDetailsPublic'
summary: Get Active Finality Providers (Deprecated)
tags:
- v1
/v1/global-params:
get:
deprecated: true
description: '[DEPRECATED] Retrieves the global parameters for Babylon, including finality provider details. Please use /v2/network-info instead.'
produces:
- application/json
responses:
'200':
description: Global parameters
schema:
$ref: '#/definitions/handler.PublicResponse-v1service_GlobalParamsPublic'
tags:
- v1
/v1/staker/delegations:
get:
description: 'Retrieves phase-1 delegations for a given staker. This endpoint will be deprecated once all phase-1 delegations are either withdrawn or registered into phase-2.
This endpoint is only used to show legacy phase-1 delegations for the purpose of unbonding or registering into phase-2.'
parameters:
- description: Staker BTC Public Key
in: query
name: staker_btc_pk
required: true
type: string
- description: Only return delegations with pending actions which include active, unbonding, unbonding_requested, unbonded
in: query
name: pending_action
type: boolean
- description: Pagination key to fetch the next page of delegations
in: query
name: pagination_key
type: string
produces:
- application/json
responses:
'200':
description: List of delegations and pagination token
schema:
$ref: '#/definitions/handler.PublicResponse-array_v1service_DelegationPublic'
'400':
description: 'Error: Bad Request'
schema:
$ref: '#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error'
tags:
- v1
/v1/stats:
get:
deprecated: true
description: '[DEPRECATED] Fetches overall stats for babylon staking including tvl, total delegations, active tvl, active delegations and total stakers. Please use /v2/stats instead.'
produces:
- application/json
responses:
'200':
description: Overall stats for babylon staking
schema:
$ref: '#/definitions/handler.PublicResponse-v1service_OverallStatsPublic'
summary: Get Overall Stats (Deprecated)
tags:
- v1
/v1/stats/staker:
get:
deprecated: true
description: '[DEPRECATED] Fetches staker stats for babylon staking including tvl, total delegations, active tvl and active delegations. Please use /v2/staker/stats instead.
If staker_btc_pk query parameter is provided, it will return stats for the specific staker.
Otherwise, it will return the top stakers ranked by active tvl.'
parameters:
- description: Public key of the staker to fetch
in: query
name: staker_btc_pk
type: string
- description: Pagination key to fetch the next page of top stakers
in: query
name: pagination_key
type: string
produces:
- application/json
responses:
'200':
description: List of top stakers by active tvl
schema:
$ref: '#/definitions/handler.PublicResponse-array_v1service_StakerStatsPublic'
'400':
description: 'Error: Bad Request'
schema:
$ref: '#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error'
summary: Get Staker Stats (Deprecated)
tags:
- v1
/v1/unbonding:
post:
consumes:
- application/json
description: 'Unbonds a phase-1 delegation by processing the provided transaction details. This endpoint will be deprecated once all phase-1 delegations are either withdrawn or registered into phase-2.
This is an async operation.'
parameters:
- description: Unbonding Request Payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/v1handlers.UnbondDelegationRequestPayload'
produces:
- application/json
responses:
'202':
description: Request accepted and will be processed asynchronously
'400':
description: Invalid request payload
schema:
$ref: '#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error'
summary: Unbond phase-1 delegation
tags:
- v1
/v1/unbonding/eligibility:
get:
description: Checks if a delegation identified by its staking transaction hash is eligible for unbonding. This endpoint will be deprecated once all phase-1 delegations are either withdrawn or registered into phase-2.
parameters:
- description: Staking Transaction Hash Hex
in: query
name: staking_tx_hash_hex
required: true
type: string
produces:
- application/json
responses:
'200':
description: The delegation is eligible for unbonding
'400':
description: Missing or invalid 'staking_tx_hash_hex' query parameter
schema:
$ref: '#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error'
summary: Check unbonding eligibility
tags:
- v1
definitions:
github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error:
properties:
err: {}
errorCode:
$ref: '#/definitions/types.ErrorCode'
statusCode:
type: integer
type: object
v1service.TransactionPublic:
properties:
output_index:
type: integer
start_height:
type: integer
start_timestamp:
type: string
timelock:
type: integer
tx_hex:
type: string
type: object
handler.PublicResponse-array_v1service_FpDetailsPublic:
properties:
data:
items:
$ref: '#/definitions/v1service.FpDetailsPublic'
type: array
pagination:
$ref: '#/definitions/handler.paginationResponse'
type: object
v1service.FpDetailsPublic:
properties:
active_delegations:
type: integer
active_tvl:
type: integer
btc_pk:
type: string
commission:
type: string
description:
$ref: '#/definitions/v1service.FpDescriptionPublic'
total_delegations:
type: integer
total_tvl:
type: integer
type: object
handler.PublicResponse-array_v1service_DelegationPublic:
properties:
data:
items:
$ref: '#/definitions/v1service.DelegationPublic'
type: array
pagination:
$ref: '#/definitions/handler.paginationResponse'
type: object
v1service.StakerStatsPublic:
properties:
active_delegations:
type: integer
active_tvl:
type: integer
staker_pk_hex:
type: string
total_delegations:
type: integer
total_tvl:
type: integer
type: object
types.ErrorCode:
enum:
- INTERNAL_SERVICE_ERROR
- VALIDATION_ERROR
- NOT_FOUND
- BAD_REQUEST
- FORBIDDEN
- UNPROCESSABLE_ENTITY
- REQUEST_TIMEOUT
type: string
x-enum-varnames:
- InternalServiceError
- ValidationError
- NotFound
- BadRequest
- Forbidden
- UnprocessableEntity
- RequestTimeout
types.DelegationState:
enum:
- active
- unbonding_requested
- unbonding
- unbonded
- withdrawable
- withdrawn
- transitioned
- slashed
type: string
x-enum-varnames:
- Active
- UnbondingRequested
- Unbonding
- Unbonded
- Withdrawable
- Withdrawn
- Transitioned
- Slashed
v1service.OverallStatsPublic:
properties:
active_delegations:
type: integer
active_tvl:
type: integer
btc_price_usd:
description: Optional field
type: number
pending_tvl:
type: integer
total_delegations:
type: integer
total_stakers:
type: integer
total_tvl:
type: integer
unconfirmed_tvl:
type: integer
type: object
v1handlers.UnbondDelegationRequestPayload:
properties:
staker_signed_signature_hex:
type: string
staking_tx_hash_hex:
type: string
unbonding_tx_hash_hex:
type: string
unbonding_tx_hex:
type: string
type: object
v1service.GlobalParamsPublic:
properties:
versions:
items:
$ref: '#/definitions/v1service.VersionedGlobalParamsPublic'
type: array
type: object
handler.PublicResponse-array_v1service_StakerStatsPublic:
properties:
data:
items:
$ref: '#/definitions/v1service.StakerStatsPublic'
type: array
pagination:
$ref: '#/definitions/handler.paginationResponse'
type: object
v1service.FpDescriptionPublic:
properties:
details:
type: string
identity:
type: string
moniker:
type: string
security_contact:
type: string
website:
type: string
type: object
handler.PublicResponse-v1service_OverallStatsPublic:
properties:
data:
$ref: '#/definitions/v1service.OverallStatsPublic'
pagination:
$ref: '#/definitions/handler.paginationResponse'
type: object
v1service.DelegationPublic:
properties:
finality_provider_pk_hex:
type: string
is_eligible_for_transition:
type: boolean
is_overflow:
type: boolean
is_slashed:
type: boolean
staker_pk_hex:
type: string
staking_tx:
$ref: '#/definitions/v1service.TransactionPublic'
staking_tx_hash_hex:
type: string
staking_value:
type: integer
state:
$ref: '#/definitions/types.DelegationState'
unbonding_tx:
$ref: '#/definitions/v1service.TransactionPublic'
type: object
handler.PublicResponse-v1service_GlobalParamsPublic:
properties:
data:
$ref: '#/definitions/v1service.GlobalParamsPublic'
pagination:
$ref: '#/definitions/handler.paginationResponse'
type: object
v1service.VersionedGlobalParamsPublic:
properties:
activation_height:
type: integer
cap_height:
type: integer
confirmation_depth:
type: integer
covenant_pks:
items:
type: string
type: array
covenant_quorum:
type: integer
max_staking_amount:
type: integer
max_staking_time:
type: integer
min_staking_amount:
type: integer
min_staking_time:
type: integer
staking_cap:
type: integer
tag:
type: string
unbonding_fee:
type: integer
unbonding_time:
type: integer
version:
type: integer
type: object
handler.paginationResponse:
properties:
next_key:
type: string
type: object
handler.PublicResponse-v1service_DelegationPublic:
properties:
data:
$ref: '#/definitions/v1service.DelegationPublic'
pagination:
$ref: '#/definitions/handler.paginationResponse'
type: object