API ReferenceMargin & Lending

Withdraw lent principal

POST/api/v1/px/lend/withdrawBearer

PX Discovery & AccountE6 decimal strings throughoutA | B

Takes back principal you lent out and credits cash. code is one of INVALID_AMOUNT / EXCEEDS_LEND_DEPOSIT — the withdrawal cannot exceed lendDepositE6. While the principal is on loan the withdrawable amount drops.

Send Authorization: Bearer <token>. The token is issued by POST /api/v1/auth/verify, and expires after 24h idle or 7d after issuance.

Request body

  • amountE6stringrequired

    Amount, as an E6 string; must be positive

Response

200Withdrawn; returns the updated credit state
  • debtE6string

    Debt including accrued interest, as an E6 string

  • equityE6string

    Account equity, as an E6 string

  • grossE6string

    Gross exposure, as an E6 string

  • healthBpsstringnullable

    Health, in basis points. null when there is no debt (health is undefined then) — do not treat it as 0

  • healthyboolean

    Whether the account is above the maintenance line; true when there is no debt

    Examplefalse

  • borrowAprBpsstring

    Borrow APR, in basis points

  • maxBorrowE6string

    Current borrowing limit, as an E6 string

  • lendDepositE6string

    Principal currently lent out, as an E6 string

  • maintenanceBpsstring

    Maintenance margin rate, in basis points; liquidation triggers when healthBps falls below it

  • initialMarginBpsstring

    Initial margin rate, in basis points

Switch status codes in the response example to view errors. For all codes, see the Errors page.