Installation
Step 1: Initialize Client with Private Key
Step 2: Derive User API Credentials
Your private key is used once to derive API credentials. These credentials authenticate all subsequent requests.Step 3: Configure Signature Type and Funder
Before reinitializing the client, determine your signature type and funder address:| How do you want to trade? | Type | Value | Funder Address |
|---|---|---|---|
| I want to use an EOA wallet. It holds USDCe and position tokens, and I’ll pay my own gas. | EOA | 0 | Your EOA wallet address |
| I want to trade through my Polymarket.com account (Magic Link email/Google login). | POLY_PROXY | 1 | Your proxy wallet address |
| I want to trade through my Polymarket.com account (browser wallet connection). | GNOSIS_SAFE | 2 | Your proxy wallet address |
If you have a Polymarket.com account, your funds are in a proxy wallet (visible in the profile dropdown). Use type 1 or 2. Type 0 is for standalone EOA wallets only.
Step 4: Reinitialize with Full Authentication
Step 5: Place an Order
Now you’re ready to trade! First, get a token ID from the Gamma API.Step 6: Check Your Orders
Troubleshooting
Invalid Signature / L2 Auth Not Available
Invalid Signature / L2 Auth Not Available
Wrong private key, signature type, or funder address for the derived User API credentials.Double check the following values when creating User API credentials via
createOrDeriveApiKey():- Do not use Builder API credentials in place of User API credentials
- Check
signatureTypematches your account type (0, 1, or 2) - Ensure
funderis correct for your wallet type
Unauthorized / Invalid API Key
Unauthorized / Invalid API Key
Not Enough Balance / Allowance
Not Enough Balance / Allowance
Either not enough USDCe / position tokens in your funder address, or you lack approvals to spend your tokens.
- Deposit USDCe to your funder address.
- Ensure you have more USDCe than what’s committed in open orders.
- Check that you’ve set all necessary token approvals.
Blocked by Cloudflare / Geoblock
Blocked by Cloudflare / Geoblock
You’re trying to place a trade from a restricted region.See Geographic Restrictions for details.
Adding Builder API Credentials
If you’re building an app that routes orders for your users, you can add builder credentials to get attribution on the Builder Leaderboard:TypeScript
Builder credentials are separate from user credentials. You use your builder
credentials to tag orders, but each user still needs their own L2 credentials to trade.
Full Builder Guide
Complete documentation for order attribution and gasless transactions