Skip to main content
POST
/
v2
/
portfolios
/
{portfolioId}
/
liquidate-all
/
signature
curl --request POST \
  --url 'https://api.glider.fi/v2/portfolios/a1b2c3d4/liquidate-all/signature' \
  --header 'x-api-key: gldr_sk_your_api_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "recipientAccountId": "eip155:1:0x4444444444444444444444444444444444444444"
  }'
{
  "success": true,
  "data": {
    "authorizationId": "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
    "expiresAt": "2026-04-17T12:10:00.000Z",
    "typedData": {
      "primaryType": "Withdrawal",
      "domain": {
        "name": "Glider Withdrawal Authorization",
        "version": "2",
        "chainId": 1,
        "verifyingContract": "0x2222222222222222222222222222222222222222"
      },
      "types": {
        "Withdrawal": [
          { "name": "portfolioId", "type": "string" },
          { "name": "recipientAccountId", "type": "string" },
          { "name": "assets", "type": "WithdrawalAsset[]" },
          { "name": "nonce", "type": "bytes32" },
          { "name": "expiresAt", "type": "uint256" },
          { "name": "liquidate", "type": "bool" }
        ],
        "WithdrawalAsset": [
          { "name": "assetId", "type": "string" },
          { "name": "amountRaw", "type": "string" }
        ]
      },
      "message": {
        "portfolioId": "a1b2c3d4",
        "recipientAccountId": "eip155:1:0x4444444444444444444444444444444444444444",
        "assets": [
          {
            "assetId": "eip155:1/erc20:0x6b175474e89094c44da98b954eedeac495271d0f",
            "amountRaw": "5000000000000000000"
          },
          {
            "assetId": "eip155:1/erc20:0x514910771af9ca656af840dff83e8264ecf986ca",
            "amountRaw": "12000000000000000000"
          }
        ],
        "nonce": "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
        "expiresAt": 1744898400,
        "liquidate": true
      }
    }
  }
}
Stage 1 of the two-stage liquidate-all flow. Reads the portfolio’s live positions on the recipient’s chain, selects every holding whose value is above the tenant’s swap threshold, and returns an EIP-712 typed-data authorization that swaps them all to USDC and delivers the USDC to recipientAccountId. Stage 2 (POST /v2/portfolios/{portfolioId}/liquidate-all) submits the signed authorization. This is the whole-portfolio counterpart of POST .../withdraw/signature with liquidate: true — you don’t list assets; the server enumerates them. The signed message it returns is a standard withdrawal authorization with liquidate: true, so it behaves identically at stage 2.
  • Auth: x-api-key header (required)
  • Scope: portfolios:withdraw
  • EVM only.
recipientAccountId is a chain-bound CAIP-10 identifier (eip155:<chainId>:<address>). Liquidation is scoped to that one chain — holdings on other chains are untouched. To liquidate a multi-chain portfolio fully, call this once per chain.

Best-effort empty

Holdings whose value is below the tenant swap threshold (or that have no swap route) are left in the vault — forcing uneconomical swaps would lose more to gas than they recover. The portfolio is emptied of everything worth swapping, not necessarily down to zero. If nothing clears the threshold, the call returns 400 API_220 NOTHING_TO_LIQUIDATE. The authorization is valid for 10 minutes and, like all withdrawals, binds the portfolio, recipient, the enumerated assets + amounts, the nonce, and the expiry into the user’s signature. Common error responses:
  • 400 API_211 INVALID_RECIPIENT — zero address or a self-transfer to the smart account being debited.
  • 400 API_215 PORTFOLIO_HAS_NO_VAULT_ON_CHAIN — portfolio has no smart account on the recipient’s chain.
  • 400 API_219 WITHDRAW_AS_USDC_UNSUPPORTED_CHAIN — the recipient’s chain has no canonical USDC to swap into.
  • 400 API_220 NOTHING_TO_LIQUIDATE — no holding on the chain clears the swap threshold.
  • 401 when x-api-key is missing or invalid.
  • 403 when the API key lacks the portfolios:withdraw scope.
  • 404 API_200 PORTFOLIO_NOT_FOUNDportfolioId doesn’t exist or belongs to a different tenant.
  • 500 on unexpected server errors.
curl --request POST \
  --url 'https://api.glider.fi/v2/portfolios/a1b2c3d4/liquidate-all/signature' \
  --header 'x-api-key: gldr_sk_your_api_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "recipientAccountId": "eip155:1:0x4444444444444444444444444444444444444444"
  }'
{
  "success": true,
  "data": {
    "authorizationId": "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
    "expiresAt": "2026-04-17T12:10:00.000Z",
    "typedData": {
      "primaryType": "Withdrawal",
      "domain": {
        "name": "Glider Withdrawal Authorization",
        "version": "2",
        "chainId": 1,
        "verifyingContract": "0x2222222222222222222222222222222222222222"
      },
      "types": {
        "Withdrawal": [
          { "name": "portfolioId", "type": "string" },
          { "name": "recipientAccountId", "type": "string" },
          { "name": "assets", "type": "WithdrawalAsset[]" },
          { "name": "nonce", "type": "bytes32" },
          { "name": "expiresAt", "type": "uint256" },
          { "name": "liquidate", "type": "bool" }
        ],
        "WithdrawalAsset": [
          { "name": "assetId", "type": "string" },
          { "name": "amountRaw", "type": "string" }
        ]
      },
      "message": {
        "portfolioId": "a1b2c3d4",
        "recipientAccountId": "eip155:1:0x4444444444444444444444444444444444444444",
        "assets": [
          {
            "assetId": "eip155:1/erc20:0x6b175474e89094c44da98b954eedeac495271d0f",
            "amountRaw": "5000000000000000000"
          },
          {
            "assetId": "eip155:1/erc20:0x514910771af9ca656af840dff83e8264ecf986ca",
            "amountRaw": "12000000000000000000"
          }
        ],
        "nonce": "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
        "expiresAt": 1744898400,
        "liquidate": true
      }
    }
  }
}