Skip to main content
POST
/
v2
/
markets
/
{id}
/
claim-fees
Claim Fees
curl --request POST \
  --url https://api.pmx.trade/v2/markets/{id}/claim-fees \
  --header 'Content-Type: application/json' \
  --data '
{
  "wallet": "<string>"
}
'
{
  "success": true,
  "noFees": true,
  "data": {
    "transaction": "<string>",
    "feesAccrued": 123,
    "feesAccruedHuman": 123,
    "message": "<string>"
  }
}
Returns an unsigned transaction to claim the market creator’s accrued trade fees. Only the market creator wallet can call this endpoint.

Idempotent

This endpoint is idempotent. If there are no fees to claim (already claimed or no trades occurred), the endpoint returns a success response with noFees: true instead of an error. Safe to call repeatedly.

Path Parameters

id
integer
required
Market ID

Request Body

wallet
string
required
The market creator’s wallet address. Only the original market creator can claim fees via this endpoint.

Response

success
boolean
noFees
boolean
true if there are no fees to claim. Only present when this is the case.
data
object
Only present when there are fees to claim.

Examples

curl -X POST "https://api.pmx.trade/v2/markets/1/claim-fees" \
  -H "Content-Type: application/json" \
  -d '{
    "wallet": "CreatorOrPmxWalletPubkey..."
  }'

Success Response

{
  "success": true,
  "data": {
    "transaction": "AQAAAAAAA...base64...",
    "feesAccrued": 2500000,
    "feesAccruedHuman": 2.50,
    "message": "Sign this transaction to claim your accrued fees."
  }
}

No Fees Response

{
  "success": true,
  "noFees": true,
  "note": "No fees available to claim for this market (already claimed or zero volume)."
}

Errors

ErrorCause
400 Market not foundInvalid market ID
403 UnauthorizedWallet is not the market creator. Response includes creator and caller fields for debugging.

How Fee Claiming Works

Every buy and sell on a market accrues fees split 50/50:
trade_fee   = trade_amount * trade_fee_bps / 10000
creator_fee = trade_fee / 2       → market.creatorFeesAccrued
pmx_fee     = trade_fee - creator_fee  → market.pmxFeesAccrued
When claimFees is called:
  1. The instruction checks if the wallet is the creator or the PMX wallet.
  2. The corresponding accrued amount (creatorFeesAccrued or pmxFeesAccrued) is transferred from the market vault to the caller’s USDC token account.
  3. The accrued field is reset to 0.
Fees can be claimed at any time — while the market is active, after resolution, or after cancellation. There is no deadline.