# CoinGlass Decrypt (`xeronsh/coinglass-decrypt`) > Pure Python decryption of CoinGlass (`capi.coinglass.com`) internal API responses using two-layer AES-128-ECB + gzip (`v=0/1/2` and legacy `v=55/66/77`), covering 136+ verified crypto market data endpoints without an API key or browser. ## Canonical Links - Documentation Site: https://xeronsh.github.io/coinglass-decrypt/ - Repository: https://github.com/xeronsh/coinglass-decrypt - Full LLM Reference (`llms-full.txt`): https://xeronsh.github.io/coinglass-decrypt/llms-full.txt - README: https://github.com/xeronsh/coinglass-decrypt/blob/main/README.md - Core Library (`decrypt.py`): https://github.com/xeronsh/coinglass-decrypt/blob/main/decrypt.py - Endpoint Catalog (`discovered_endpoints.py`): https://github.com/xeronsh/coinglass-decrypt/blob/main/discovered_endpoints.py - Examples (`example.py`): https://github.com/xeronsh/coinglass-decrypt/blob/main/example.py - Releases: https://github.com/xeronsh/coinglass-decrypt/releases - Sitemap: https://xeronsh.github.io/coinglass-decrypt/sitemap.xml ## Decryption Pipeline 1. Derive `Key0 = base64(seed)[:16]` from response header `v`: - `v="0"`: `seed = cache-ts-v2` request header (millisecond timestamp) - `v="1"`: `seed = urlparse(url).path` (universal across 136 verified endpoints) - `v="2"`: `seed = time` response header - `v="55"|"66"|"77"`: legacy static constants in `_KEY_TABLE` 2. Decrypt base64 `user` response header with `AES-128-ECB(Key0)` and `gzip.decompress` to obtain the 16-char inner AES key. 3. Decrypt base64 `JSON["data"]` body with `AES-128-ECB(actual_key)` and `gzip.decompress` to get plain JSON. ## Public Python API (`decrypt.py`) - `decrypt(encrypted_body: str, user_token_b64: str, v: str, url: str = "", *, cache_ts: str = "", time_header: str = "") -> Dict[str, Any]` - `fetch_and_decrypt(url: str, params: dict = None, timeout: int = 30) -> Dict[str, Any]` ## Dependencies & Runtime - Python `>= 3.10` - `requests`, `pycryptodome` ## Representative Verified Endpoints (`https://capi.coinglass.com`) - Spot RSI: `/api/spot/rsi/list` (`pageSize`, `pageNum`) - Futures Home Statistics: `/api/futures/home/statistics` - Futures Liquidations: `/api/futures/liquidation/chart`, `/api/futures/liquidation/today` - Long/Short Ratio: `/api/futures/longShortRate` - Funding Rates: `/api/fundingRate/list`, `/api/fundingRate/rank`, `/api/fundingRate/arbitrage-list` - Open Interest: `/api/openInterest/statistics`, `/api/openInterest/info` - Options: `/api/option/statistics` (see `discovered_endpoints.py` for full list) - ETF Flows: `/api/etf/flow` - Indices: `/api/index/cgdi` - Hyperliquid & Grayscale: listed in `discovered_endpoints.py`