POST
/
v1
/
liquidity
/
remove
Remove Liquidity
curl --request POST \
  --url https://api.amm.flashnet.xyz/v1/liquidity/remove \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "lpTokensToRemove": "100000",
  "nonce": "remove-liquidity-1702934567890",
  "poolId": "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899",
  "signature": "3045022100def...",
  "userPublicKey": "03abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"
}'
{
"error": "Insufficient LP token balance",
"requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Liquidity removal details including LP tokens and authentication

Request body for removing liquidity from a pool.

When removing liquidity, you burn LP tokens to receive back a proportional share of both assets from the pool. The exact amounts depend on the current pool reserves and your share of the total LP tokens.

userPublicKey
string
required

Hex-encoded secp256k1 public key of the liquidity provider. This must match the public key in your authentication token.

Example:

"03abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"

poolId
string
required

Unique identifier of the pool to remove liquidity from. This is the pool's identity public key.

Example:

"03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"

lpTokensToRemove
string
required

Amount of LP tokens to burn, in their smallest unit. You will receive a proportional share of the pool's assets.

Example:

"100000.00000000"

nonce
string
required

Unique nonce to prevent replay attacks. Each nonce can only be used once per user.

Example:

"remove-liquidity-nonce-789"

signature
string
required

Hex-encoded secp256k1 signature of the request. Must be signed by the private key corresponding to userPublicKey.

Example:

"3045022100def..."

Response

Liquidity removal process completed

Response for removing liquidity from a pool

requestId
string
required

User-friendly request ID for tracking

Example:

"01HJZKFABCDEFGHJKLMNPQRSTVW"

accepted
boolean
required

Whether liquidity removal was accepted

Example:

true

assetAWithdrawn
integer | null

Amount of asset A withdrawn (populated if accepted)

Required range: x >= 0
Example:

"50000000"

assetBWithdrawn
integer | null

Amount of asset B withdrawn (populated if accepted)

Required range: x >= 0
Example:

"25000"

assetATransferId
string | null

Spark transfer ID for asset A withdrawal (populated if accepted)

Example:

"spark-transfer-a-789"

assetBTransferId
string | null

Spark transfer ID for asset B withdrawal (populated if accepted)

Example:

"spark-transfer-b-012"

error
string | null

User-friendly error message (populated if rejected)