Client Initialization
L1 methods require the client to initialize with a signer.- TypeScript
- Python
API Key Management
createApiKey
Creates a new API key (L2 credentials) for the wallet signer. Each wallet can only have one active API key at a time — creating a new key invalidates the previous one.Signature
Optional custom nonce for deterministic key generation. Optional.
The generated API key string.
The secret associated with the API key.
The passphrase associated with the API key.
deriveApiKey
Derives an existing API key using a specific nonce. If you’ve already created credentials with a particular nonce, this returns the same credentials.Signature
The nonce used when originally creating the key. Optional.
The derived API key string.
The secret associated with the API key.
The passphrase associated with the API key.
createOrDeriveApiKey
Convenience method that attempts to derive an API key with the default nonce, or creates a new one if it doesn’t exist. Recommended for initial setup.Signature
The API key string, either derived or newly created.
The secret associated with the API key.
The passphrase associated with the API key.
Order Signing
createOrder
Create and sign a limit order locally without posting it to the CLOB. Use this when you want to sign orders in advance or implement custom submission logic. Submit viapostOrder() or postOrders().
Signature
The token ID of the market outcome to trade.
The limit price for the order.
The size (number of shares) for the order.
The side of the order (buy or sell).
Optional fee rate in basis points. Optional.
Optional nonce for the order. Optional.
Optional expiration timestamp for the order. Optional.
Optional taker address for the order. Optional.
The tick size used for order validation (CreateOrderOptions).
Optional flag for negative risk markets (CreateOrderOptions). Optional.
A random salt value for the signed order.
The maker’s address.
The signer’s address.
The taker’s address in the signed order.
The token ID in the signed order.
The maker amount as a string.
The taker amount as a string.
The side of the order as a number (0 = BUY, 1 = SELL).
The expiration timestamp as a string.
The nonce as a string.
The fee rate in basis points as a string.
The type identifier for the signature scheme used.
The cryptographic signature of the order.
createMarketOrder
Create and sign a market order locally without posting it to the CLOB. Submit viapostOrder() or postOrders().
Signature
The token ID of the market outcome to trade.
The order amount. For BUY orders this is a dollar amount; for SELL orders this is the number of shares.
The side of the order (buy or sell).
Optional price limit for the market order. Optional.
Optional fee rate in basis points. Optional.
Optional nonce for the order. Optional.
Optional taker address for the order. Optional.
Optional order type, either FOK (Fill-Or-Kill) or FAK (Fill-And-Kill). Optional.
A random salt value for the signed order.
The maker’s address.
The signer’s address.
The taker’s address in the signed order.
The token ID in the signed order.
The maker amount as a string.
The taker amount as a string.
The side of the order as a number (0 = BUY, 1 = SELL).
The expiration timestamp as a string.
The nonce as a string.
The fee rate in basis points as a string.
The type identifier for the signature scheme used.
The cryptographic signature of the order.
Troubleshooting
Error - INVALID_SIGNATURE
Error - INVALID_SIGNATURE
Your wallet’s private key is incorrect or improperly formatted.Solution:
- Verify your private key is a valid hex string (starts with
0x) - Ensure you’re using the correct key for the intended address
- Check that the key has proper permissions
Error - NONCE_ALREADY_USED
Error - NONCE_ALREADY_USED
The nonce you provided has already been used to create an API key.Solution:
- Use
deriveApiKey()with the same nonce to retrieve existing credentials - Or use a different nonce with
createApiKey()
Error - Invalid Funder Address
Error - Invalid Funder Address
Your funder address is incorrect or doesn’t match your wallet.Solution: Check your proxy wallet address at polymarket.com/settings. If it doesn’t exist, the user has never logged in to Polymarket.com — deploy the proxy wallet first before creating L2 credentials.
Lost API credentials but have nonce
Lost API credentials but have nonce
Lost both credentials and nonce
Lost both credentials and nonce
There’s no way to recover lost credentials without the nonce. Create new ones: