Skip to main content

CSMarketAPI Client

Asynchronous Python client for CSMarketAPI — typed responses (Pydantic), enums for marketplaces/currencies, and convenient async context managers.

Highlights

  • Async & Fast: Use with async with CSMarketAPI(...)
  • Typed Models: All responses are Pydantic models
  • Enums: For Market, Currency and Phase
  • Modern Python: 3.13+, type hints everywhere

Installation

pip install csmarketapi

Requirements

  • Python 3.13+
  • CSMarketAPI API key

Quickstart

import asyncio
from csmarketapi import CSMarketAPI
from csmarketapi.enums import Market, Currency

async def main():
    async with CSMarketAPI("YOUR_API_KEY") as client:
        items = await client.get_items()
        print(f"Loaded {len(items.items)} items.")

asyncio.run(main())

Usage Examples

All methods are async and return Pydantic models.

Listings (Latest)

async with CSMarketAPI("YOUR_API_KEY") as client:
    res = await client.get_listings_latest_aggregated(
        market_hash_name="Chroma 2 Case",
        markets=list(Market),
        currency=Currency.USD,
    )
    print(res.market_hash_name, res.listings[0].market, res.listings[0].ask_price)

Sales (Latest)

async with CSMarketAPI("YOUR_API_KEY") as client:
    res = await client.get_sales_latest_aggregated(
        market_hash_name="Chroma 2 Case",
        markets=[Market.SKINPORT, Market.SKINBARON]
    )
    print(res.sales[0].market, res.sales[0].median_price)

Item Contents

async with CSMarketAPI("YOUR_API_KEY") as client:
    res = await client.get_item_contents(market_hash_name="Kilowatt Case")
    print(res.contents)

Account

async with CSMarketAPI("YOUR_API_KEY") as client:
    account = await client.get_account()
    print(account.plan, account.usage.remaining)

Error Handling & Tipps

  • Wrap API calls in try/except for network errors
  • Optional fields may be None
  • Use markets=list(Market) for all markets

License

MIT


Metadata

Release files for csmarketapi 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csmarketapi 3.0.0
File Size Uploaded
csmarketapi-3.0.0.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csmarketapi 3.0.0
File Interpreter ABI Platform
csmarketapi-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / csmarketapi-3.0.0.tar.gz

Download URL csmarketapi-3.0.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ce55be062d8695f5b8d391e1fb97340cb9ac7e033f13309f71dfc25f5f34ff3d
BLAKE2b-256 checksum
How to use checksums
f06425a1a05cc240184390059133a40276d630f0915fbbf7c71804d026e4e1b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / csmarketapi-3.0.0-py3-none-any.whl

Download URL csmarketapi-3.0.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf3b7fcd46d37468c6cf94a740e8de9efd4170a6be68161bf69d051c913d3f2b
BLAKE2b-256 checksum
How to use checksums
acc55b3be33b2244f5773a84d60b3465896cfc900f0f753721047f7a9a524e10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page