Deposit Collateral
Deposit pUSD when the account needs collateral for opening or maintaining Perps positions.- TypeScript
- Python
- API
1
Create a Secure Client
Create a
SecureClient for the wallet that will fund the Perps account. If you
already have a Polymarket wallet, pass it as wallet and include a Relayer API
key so the SDK can submit gasless transactions. If you are creating a wallet
programmatically, use a Builder API key so the SDK can create the Deposit Wallet
for that signer.2
Set Up Deposit Approvals
Set up the approvals required for Perps collateral deposits. The SDK skips work
that is already complete.
3
Deposit Collateral
Deposit pUSD from the user’s Polymarket wallet into the Perps account. Make sure
the wallet has pUSD before depositing. The minimum Perps deposit is 10 pUSD.
Amounts use raw pUSD base units, so 10 pUSD is
10_000_000n.deposit.wait() confirms that the chain transaction settled. Perps may take a
moment to credit the account after that.4
Verify the Deposit
Open a Perps session and read account state after the deposit settles.Use
portfolio.withdrawable to check collateral available for withdrawal and
deposits.items to reconcile deposit history. The withdrawable value already
accounts for the 10% notional reserve.Withdraw Collateral
Withdraw pUSD when the account has available collateral that should return to the authenticated wallet. Withdrawals must satisfy the withdrawal margin requirements, including the 10% reserve against open-position notional. Collateral available for trading can therefore exceed collateral available for withdrawal.- TypeScript
- Python
- API
Request a withdrawal to the authenticated wallet.
Amounts use raw pUSD base units, so 10 pUSD is The SDK signs the withdrawal request with the Polymarket account signer and
returns the Perps withdrawal ID.To track the withdrawal, open a Perps session and list withdrawals.To narrow the results to a single state, pass a For what each status means, see
Withdrawals.For more details on authenticated sessions, see Authenticated
Sessions.
10_000_000n.withdrawalStatus filter with
a PerpsKnownWithdrawalStatus member. The filter accepts one status per
request. For example, list the withdrawals that are still pending:Transfer Between Your Accounts
Move pUSD between two Perps accounts with an internal transfer. The transfer settles on the exchange ledger, with no onchain transaction and no fee. Two keys can sign an internal transfer:
The trading-key path lets a market maker running several grouped accounts
rebalance collateral from the key its trading system already holds, without
bringing the owner key online. Polymarket assigns account groups per entity; to
group your accounts, contact Polymarket with the list of accounts. A trading key
must be registered to the source account. A key registered to a different
member of the group does not qualify, and ungrouped accounts cannot use the
trading-key path.
Trading keys can only move collateral between members of the same group. They
can never withdraw; withdrawals always require the owner key.
Transfer limits:
- Withdrawable amount. A transfer can move at most the source account’s withdrawable pUSD, the same amount a withdrawal could take. See the withdrawal margin requirements. Transfers and withdrawals the account still has pending count against it.
- Pending transfers. Each account can have up to 10 transfers waiting to be
processed. Further requests return
transfer_limit_reacheduntil earlier ones settle.
- API
1
Build the Transfer Operation
Create an
internalTransfer operation naming the source account, the pUSD
token, the amount and the destination account.2
Create the Operation Hash
Internal transfers use the same Use the exact strings you send in the request body, including address casing
and the amount string. Any difference changes the hash and the signature fails.
Op signing scheme as trading operations. Build
the compact operation, MessagePack-encode it, and hash the encoded bytes with
keccak256.3
Create Transfer Typed Data
Create an EIP-712
Op typed-data payload with the operation hash.4
Sign Transfer Typed Data
Sign with the source account’s trading key for a transfer between grouped
accounts, or with the source account’s owner key for any transfer.
Viem
5
Submit the Transfer
Submit the signed request to
POST /v1/account/internal-transfer. Use the same
operation values, salt, and ts from the typed data. label is optional,
up to 64 bytes, and sits outside the signed operation. It is returned in both
accounts’ transfer history, which helps you reconcile your own rebalancing.Trading-key transfers can take slightly longer to accept than owner-key
transfers, because the gateway first confirms that its view of the key and the
group is current. This wait is capped at 500 ms.If a transfer request times out and you are unsure whether it was accepted,
resend the exact original signed request. Do not generate a new signature,
salt, or timestamp. See Errors.
6
Track the Transfer
List settled internal transfers for the authenticated account. Use
For more details on proxy credentials and private account-read headers, see
Authenticated Sessions.
direction=in or direction=out to see one side.Review Funding History
Use deposit and withdrawal history to reconcile collateral movements after your integration submits funding requests. See Authenticated Sessions for how to create an authenticated session for private account history reads.- TypeScript
- Python
- API
List deposit or withdrawal history from an authenticated Perps session.