Skip to main content
The CLOB API uses two levels of authentication: L1 (Private Key) and L2 (API Key). Either can be accomplished using the CLOB client or REST API.

Public vs Authenticated

Public (No Auth)

The Gamma API, Data API, and CLOB read endpoints (orderbook, prices, spreads) require no authentication.

Authenticated (CLOB)

CLOB trading endpoints (placing orders, cancellations, heartbeat) require all 5 POLY_* L2 HTTP headers.

Two-Level Authentication Model

The CLOB uses two levels of authentication: L1 (Private Key) and L2 (API Key). Either can be accomplished using the CLOB client or REST API

L1 Authentication

L1 authentication uses the wallet’s private key to sign an EIP-712 message used in the request header. It proves ownership and control over the private key. The private key stays in control of the user and all trading activity remains non-custodial. Used for:
  • Creating API credentials
  • Deriving existing API credentials
  • Signing and creating user’s orders locally

L2 Authentication

L2 uses API credentials (apiKey, secret, passphrase) generated from L1 authentication. These are used solely to authenticate requests made to the CLOB API. Requests are signed using HMAC-SHA256. Used for:
  • Cancel or get user’s open orders
  • Check user’s balances and allowances
  • Post user’s signed orders
Even with L2 authentication headers, methods that create user orders still require the user to sign the order payload.

Getting API Credentials

Before making authenticated requests, you need to obtain API credentials using L1 authentication.

Using the SDK

Never commit private keys to version control. Always use environment variables or secure key management systems.

Using the REST API

While we highly recommend using our provided clients to handle signing and authentication, the following is for developers who choose NOT to use our Python or TypeScript clients. Create API Credentials
Derive API Credentials
Required L1 headers: The POLY_SIGNATURE is generated by signing the following EIP-712 struct:
Reference implementations: Response:
You’ll need all three values for L2 authentication.

L2 Authentication Headers

All trading endpoints require these 5 headers: The POLY_SIGNATURE for L2 is an HMAC-SHA256 signature created using the user’s API credentials secret value. Reference implementations can be found in the TypeScript and Python clients.

CLOB Client

Even with L2 authentication headers, methods that create user orders still require the user to sign the order payload.

Signature Types and Funder

When initializing the L2 client, you must specify your wallet signatureType and the funder address which holds the funds:
New API users should use deposit wallets with POLY_1271. Existing Safe and Proxy users are unaffected and can keep using their current funder address and signature type. See the Deposit Wallet Guide for setup details.

Security Best Practices

Store private keys in environment variables or secure key management systems. Never commit them to version control.
Never expose your API secret in client-side code. All authenticated requests should originate from your backend.

Troubleshooting

Your wallet’s private key is incorrect or improperly formatted.Solutions:
  • 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
The nonce you provided has already been used to create an API key.Solutions:
  • Use deriveApiKey() with the same nonce to retrieve existing credentials
  • Or use a different nonce with createApiKey()
Your funder address is incorrect or doesn’t match your wallet.Solution: Check your Polymarket profile address at polymarket.com/settings.If it does not exist or user has never logged into Polymarket.com, deploy it first before creating L2 authentication.
Unfortunately, there’s no way to recover lost API credentials without the nonce. You’ll need to create new credentials:

Next Steps

Place Your First Order

Learn how to create and submit orders.

Geographic Restrictions

Check trading availability by region.