DMarket API
A TypeScript wrapper for the DMarket API, allowing you to easily interact with the DMarket trading platform.
Installation
npm install node-dmarket
Usage
import { DMarketService } from "node-dmarket";
// Initialize the API client
const apiKey = "YOUR_API_KEY";
const apiSecret = "YOUR_API_SECRET";
const gameId = "a8db"; // a8db for CS:GO, tf2 for TF2, 9a92 for Dota 2, rust for Rust
const dmarket = new DMarketService(apiKey, apiSecret, gameId);
// Example: Search market items
dmarket
.searchMarketItems("item name", { limit: 10 })
.then((res) => {
console.log("result: ", res);
})
.catch((err) => {
console.log("err: ", err);
});
Features
- Full TypeScript support with comprehensive type definitions
- Handles authentication automatically
- Support for all major DMarket API endpoints:
- Marketplace operations
- Inventory management
- Trading
- Account information
- And more...
API Methods
getUserAccount()
- /account/v1/usergetUserBalance()
- /account/v1/balancesearchMarketItems(title, params)
- /exchange/v1/market/itemsgetLastSales(title, limit)
- /trade-aggregator/v1/last-salesgetAggregatedPrices(title)
- /price-aggregator/v1/aggregated-pricesgetMarketDepth(title, filters, aggregatedData)
- /marketplace-api/v1/market-depthgetUserInventoryApi(params)
- /marketplace-api/v1/user-inventorysyncUserInventory(game)
- /marketplace-api/v1/user-inventory/syncdepositAssets(assetIds)
- /marketplace-api/v1/deposit-assetsgetDepositStatus(depositId)
- /marketplace-api/v1/deposit-status/depositIdwithdrawAssets(assets, requestId)
- /exchange/v1/withdraw-assetsgetUserItems(params)
- /exchange/v1/user/itemsgetUserOffersApi(params)
- /marketplace-api/v1/user-offerscreateUserOffers(offers)
- /marketplace-api/v1/user-offers/createeditUserOffers(offers)
- /marketplace-api/v1/user-offers/editdeleteOffersApi(offers, force)
- /exchange/v1/offersgetUserClosedOffers(params)
- /marketplace-api/v1/user-offers/closedgetOffersByTitle(title, limit, cursor)
- /exchange/v1/offers-by-titlebuyOffers(offers)
- /exchange/v1/offers-buygetUserTargets(params)
- /marketplace-api/v1/user-targetsgetUserClosedTargets(params)
- /marketplace-api/v1/user-targets/closedcreateTargets(targets)
- /marketplace-api/v1/user-targets/createdeleteTargets(targetIds)
- /marketplace-api/v1/user-targets/deletegetTargetsByTitle(title)
- /marketplace-api/v1/targets-by-title/gameId/titlegetCustomizedFees(offerType, limit, offset)
- /exchange/v1/customized-fees
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Getting DMarket API Keys
To get your DMarket API keys:
- Go to DMarket.com
- Log in to your account
- Navigate to Settings
- Find the Trading API section
- Generate your API keys (public and secret keys)
Please refer to the DMarket FAQ for more details.