{"id":28074,"library":"py-clob-client-v2","title":"Polymarket CLOBClient V2","description":"Python client for interacting with the Polymarket CLOB (Central Limit Order Book) V2 API. Version 1.0.0 is the latest stable release, with a release candidate 1.0.1rc1 available. Requires Python >=3.9.10. Maintained actively on GitHub.","status":"active","version":"1.0.0","language":"python","source_language":"en","source_url":"https://github.com/Polymarket/py-clob-client-v2","tags":["polymarket","clob","prediction-market","defi","polygon"],"install":[{"cmd":"pip install py-clob-client-v2","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"ClobClient","correct":"from py_clob_client.client import ClobClient"},{"note":"","wrong":"","symbol":"PolymarketCredentials","correct":"from py_clob_client.client import Credentials"}],"quickstart":{"code":"import os\nfrom py_clob_client.client import ClobClient\nfrom py_clob_client.clob_types import Credentials\n\nhost = \"https://clob.polymarket.com\"\nkey = os.environ.get('PRIVATE_KEY', '')\ncreds = Credentials(private_key=key, chain_id=137)\nclient = ClobClient(host=host, credentials=creds)\nprint(client.get_heartbeat())","lang":"python","description":"Initialize a ClobClient with private key from environment variable and test connectivity."},"warnings":[{"fix":"Pin to 1.0.0 for production unless you need the features in 1.0.1rc1.","message":"The library's release versions do not follow strict semver; 1.0.1rc1 is a pre-release and may contain breaking changes.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure private key is a hex string (64 characters) without '0x'.","message":"Private key must be in hex format without 0x prefix. Incorrect formatting will cause silent failures.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Replace `getHeartbeat()` with `get_heartbeat()`.","message":"The `getHeartbeat()` method (camelCase) is deprecated in v1.0.0; use `get_heartbeat()` instead.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use from py_clob_client.clob_types import Credentials and pass Credentials object.","message":"In v1.0.0, the `Credentials` class was introduced and the constructor changed. Passing a raw private key string directly is no longer supported.","severity":"breaking","affected_versions":"<1.0.0 vs >=1.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use `from py_clob_client.client import ClobClient`.","cause":"Incorrect import path. `ClobClient` is under `py_clob_client.client`.","error":"AttributeError: module 'py_clob_client' has no attribute 'ClobClient'"},{"fix":"Create a Credentials object first: `creds = Credentials(private_key=key, chain_id=137)` then pass to ClobClient.","cause":"Passing private_key directly to ClobClient constructor (old style) instead of creating a Credentials object.","error":"py_clob_client.client.Credentials.__init__() got an unexpected keyword argument 'private_key'"},{"fix":"Check that environment variable PRIVATE_KEY is set correctly and chain_id is 137 for Polygon Mainnet.","cause":"Invalid or missing credentials (private key not set, incorrect chain_id, or expired signature).","error":"requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://clob.polymarket.com/..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}