openapi: 3.0.4
info:
title: DMarket trading Account Buy items API
description: 'Welcome to the DMarket Trading API section. Our JSON-based API enables you to manage your DMarket inventory through the methods featured below. In order to use the API, please generate your personal API keys in the account settings.
Request signature instructions
A valid HTTP request to the trading API must include 3 request headers:
1) X-Api-Key: public key (must be a hex string in lowercase)
To get you your own public key, use <https://dmarket.com/> (details : <https://dmarket.com/faq#tradingAPI>)
2) X-Sign-Date: timestamp or current time
Example: 1605619994. Must not be older than 2 minutes from the request time.
3) X-Request-Sign: signature
The Ed25519 signature scheme is used for signing requests and proving items’ origin and ownership through public-private key pairs. Private and public keys diversification is aimed to provide secure back-to-back communication and the ability to rotate keys in case of security breaches on any side of the integration.
To make a signature, take the following steps:
1) Build non-signed string formula (HTTP Method) + (Route path + HTTP query params) + (body string) + (timestamp) ). Example: POST/get-item?Amount=%220.25%22&Limit=%22100%22&Offset=%22150%22&Order=%22desc%22&1605619994)
2) After you’ve created a non-signed string with a default concatenation method, sign it with Ed25519 (NaCl <https://en.wikipedia.org/wiki/NaCl_(software)> "sign" is Ed25519) using your secret key.
3) Hex-encode the 64-byte Ed25519 signature
4) Add your signature string to HTTP request headers X-Request-Sign (dmar ed25519 signature)
You can check out examples on <https://github.com/dmarket/dm-trading-tools>.
DMarket uses rate limiting to control the rate of API requests. Please read FAQ for details <https://dmarket.com/faq#startUsingTradingAPI>.'
version: v2.0.0
x-logo:
url: logo.svg
backgroundColor: '#FFFFFF'
altText: DMarket logo
servers:
- url: https://api.dmarket.com
security:
- ApiKey: []
SignDate: []
RequestSign: []
tags:
- name: Buy items
description: Browse marketplace offers and buy orders (targets), and purchase items.
paths:
/marketplace-api/v1/targets-by-title/{game_id}/{title}:
get:
tags:
- Buy items
summary: Find buy orders (targets) by item title
description: 'Returns aggregated buy orders (targets) for a specific game and item title. Use this endpoint to see current demand: how many buy orders exist and at what prices.
Path parameters:
- game_id: Game identifier (e.g., csgo, dota2, rust).
- title: Exact in-game item title.
Response contains a list of orders with fields: amount (number of items requested), price (best price for that title and attributes), title, and attributes (quality/rarity/skin parameters, depending on the game).'
operationId: MarketAPI_GetTargetsByTitle
responses:
'200':
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceGetTargetsByTitleResponse'
default:
description: An unexpected error response
content:
application/json:
schema:
$ref: '#/components/schemas/runtimeError'
parameters:
- name: game_id
in: path
required: true
schema:
type: string
- name: title
in: path
required: true
schema:
type: string
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl 'https://api.dmarket.com/marketplace-api/v1/targets-by-title/a8db/AK-47%20%7C%20Redline%20%28Field-Tested%29' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\""
- lang: Python
label: Python (dm-trading-tools)
source: '# Full signing client: https://github.com/dmarket/dm-trading-tools
from dmarket_client import DMarketClient
client = DMarketClient(public_key="<public hex>", secret_key="<secret hex>")
result, err = client.call("GET", "/marketplace-api/v1/targets-by-title/a8db/AK-47%20%7C%20Redline%20%28Field-Tested%29")
print(result)'
/marketplace-api/v1/aggregated-prices:
post:
summary: Get aggregated market prices for item titles
description: 'Returns aggregated pricing for specified item titles, including best buy (order) and best sell (offer) prices and the total number of orders/offers per title. Use this to quickly assess market depth and price levels.
Request body:
- filter.game: Game identifier.
- filter.titles[]: List of exact item titles to aggregate.
- limit, cursor: Pagination controls.
Response:
- aggregatedPrices[]: For each title: orderBestPrice, orderCount, offerBestPrice, offerCount.
- nextCursor: Use to fetch the next page.'
operationId: MarketAPI_ListAggregatedPrices
responses:
'200':
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceListAggregatedPricesResponse'
default:
description: An unexpected error response.
content:
application/json:
schema:
$ref: '#/components/schemas/runtimeError'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceListAggregatedPricesRequest'
example:
filter:
game: a8db
titles:
- AK-47 | Redline (Field-Tested)
limit: '100'
required: true
tags:
- Buy items
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl -X POST 'https://api.dmarket.com/marketplace-api/v1/aggregated-prices' \\\n -H 'Content-Type: application/json' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\" \\\n -d '{\n \"filter\": {\n \"game\": \"a8db\",\n \"titles\": [\n \"AK-47 | Redline (Field-Tested)\"\n ]\n },\n \"limit\": \"100\"\n}'"
- lang: Python
label: Python (dm-trading-tools)
source: "# Full signing client: https://github.com/dmarket/dm-trading-tools\nfrom dmarket_client import DMarketClient\n\nclient = DMarketClient(public_key=\"<public hex>\", secret_key=\"<secret hex>\")\npayload = {\n \"filter\": {\n \"game\": \"a8db\",\n \"titles\": [\n \"AK-47 | Redline (Field-Tested)\"\n ]\n },\n \"limit\": \"100\"\n}\nresult, err = client.call(\"POST\", \"/marketplace-api/v1/aggregated-prices\", payload=payload)\nprint(result)"
/marketplace-api/v2/user/targets:
get:
tags:
- Buy items
summary: List user targets
description: 'Get the list of the current user''s targets. Prices are returned as integer cents. ''gameId'' param values are: CS2 - a8db, Team Fortress 2 - tf2, Dota 2 - 9a92, Rust - rust.'
operationId: GetUserTargetsV2
x-badges:
- name: NEW
color: '#04BA39'
parameters:
- name: gameId
in: query
description: 'Game identifier. One of: a8db (CS2), 9a92 (Dota 2), tf2, rust.'
required: true
schema:
type: string
enum:
- a8db
- 9a92
- tf2
- rust
- name: title
in: query
description: Filter targets by title prefix (case-insensitive).
required: false
schema:
type: string
- name: treeFilters
in: query
description: 'Attribute filters in comma-separated key=value format. Values must match how the attribute is stored (typically the lowercase Steam string; see allowed values below).
Supported common keys: `categoryPath`, `amount`, `status`. Filter by game, title, and price via the top-level `gameId`, `title`, and `priceFrom`/`priceTo` query parameters.
CS2 keys: `category`, `exterior`, `floatPart`, `isAdvanced`, `paintSeed`, `phase`.
Allowed CS2 values:
- `exterior`: `factory new`, `minimal wear`, `field-tested`, `well-worn`, `battle-scarred`, `not painted`
- `phase`: `phase-1`, `phase-2`, `phase-3`, `phase-4`, `ruby`, `sapphire`, `emerald`, `black-pearl`
- `floatPart`: `FN-0`..`FN-6`, `MW-0`..`MW-4`, `FT-0`..`FT-4`, `WW-0`..`WW-4`, `BS-0`..`BS-4` (bucketed float ranges per exterior)
- `category`: `stattrak_tm` (`_tm` is translated to the ™ symbol server-side), `souvenir`, `normal`, `★` (knives)
Multi-value: suffix key with `[]`, e.g. `exterior[]=factory new,exterior[]=minimal wear` (URL-encode the space as `%20`).
Negation: prefix key with `not_`, e.g. `not_exterior=factory new`.
Example: `categoryPath=rifle,exterior[]=factory new`.'
required: false
schema:
type: string
- name: priceFrom
in: query
description: Lower bound of the target price range in cents (inclusive).
required: false
schema:
type: integer
format: int64
- name: priceTo
in: query
description: Upper bound of the target price range in cents (inclusive).
required: false
schema:
type: integer
format: int64
- name: orderBy
in: query
description: 'Sort field. Supported values: `price`, `title`, `createdAt`.'
required: false
schema:
type: string
enum:
- price
- title
- createdAt
- name: orderDir
in: query
description: Sort direction. Defaults to `asc` when `orderBy` is set.
required: false
schema:
type: string
enum:
- asc
- desc
- name: limit
in: query
description: Number of items to return per page. Range 1..100.
required: true
schema:
type: integer
format: int32
minimum: 1
maximum: 100
- name: cursor
in: query
description: Pagination cursor returned from a previous response.
required: false
schema:
type: string
maxLength: 500
responses:
'200':
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/marketplacev2GetUserTargetsResponse'
default:
description: An unexpected error response
content:
application/json:
schema:
$ref: '#/components/schemas/runtimeError'
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl -G 'https://api.dmarket.com/marketplace-api/v2/user/targets' \\\n --data-urlencode 'gameId=a8db' \\\n --data-urlencode 'title=AK-47' \\\n --data-urlencode 'treeFilters=categoryPath=rifle,exterior[]=factory new' \\\n --data-urlencode 'orderBy=price' \\\n --data-urlencode 'orderDir=asc' \\\n --data-urlencode 'limit=10' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\""
- lang: Python
label: Python (dm-trading-tools)
source: "# Full signing client: https://github.com/dmarket/dm-trading-tools\nfrom dmarket_client import DMarketClient\n\nclient = DMarketClient(public_key=\"<public hex>\", secret_key=\"<secret hex>\")\npayload = {\n \"gameId\": \"a8db\",\n \"title\": \"AK-47\",\n \"treeFilters\": \"categoryPath=rifle,exterior[]=factory new\",\n \"orderBy\": \"price\",\n \"orderDir\": \"asc\",\n \"limit\": 10\n}\nresult, err = client.call(\"GET\", \"/marketplace-api/v2/user/targets\", payload=payload)\nprint(result)"
/marketplace-api/v1/user-targets/closed:
get:
tags:
- Buy items
summary: List user closed targets
description: Get the list of the user’s closed targets. The price amount format is in USD, i.e. 0.5 is 50 cents.
operationId: GetUserClosedTargets
parameters:
- name: Limit
in: query
description: Limits number of returned closed targets in response.
required: false
style: form
explode: true
schema:
type: string
format: uint64
- name: OrderDir
in: query
required: false
style: form
explode: true
schema:
type: string
default: desc
enum:
- desc
- asc
- name: TargetCreated.From
in: query
required: false
schema:
type: string
format: int64
example: '1730419200'
- name: TargetCreated.To
in: query
required: false
schema:
type: string
format: int64
example: '1730419200'
- name: TargetClosed.From
in: query
required: false
schema:
type: string
format: int64
example: '1730419200'
- name: TargetClosed.To
in: query
required: false
schema:
type: string
format: int64
example: '1730419200'
- name: Cursor
description: Cursor is next page identifier.
in: query
required: false
schema:
type: string
- name: Finalization.From
in: query
required: false
schema:
type: string
format: int64
example: '1730419200'
- name: Finalization.To
in: query
required: false
schema:
type: string
format: int64
example: '1730419200'
- name: Status
in: query
required: false
schema:
type: array
items:
type: string
enum:
- successful
- reverted
- trade_protected
responses:
'200':
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceGetUserClosedTargetsResponse'
default:
description: An unexpected error response
content:
application/json:
schema:
$ref: '#/components/schemas/runtimeError'
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl -G 'https://api.dmarket.com/marketplace-api/v1/user-targets/closed' \\\n --data-urlencode 'Limit=10' \\\n --data-urlencode 'OrderDir=desc' \\\n --data-urlencode 'Status=successful' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\""
- lang: Python
label: Python (dm-trading-tools)
source: "# Full signing client: https://github.com/dmarket/dm-trading-tools\nfrom dmarket_client import DMarketClient\n\nclient = DMarketClient(public_key=\"<public hex>\", secret_key=\"<secret hex>\")\npayload = {\n \"Limit\": 10,\n \"OrderDir\": \"desc\",\n \"Status\": \"successful\"\n}\nresult, err = client.call(\"GET\", \"/marketplace-api/v1/user-targets/closed\", payload=payload)\nprint(result)"
/marketplace-api/v1/user-targets/create:
post:
tags:
- Buy items
summary: Create targets
description: 'The request for target creation requires the following fields: "GameID" param (values are: CS2 - a8db, Team Fortress 2 - tf2, Dota 2 - 9a92, Rust - rust) and array of "Targets". The price amount format is in USD, i.e. 0.5 is 50 cents, "Title" - full item name.
Also, additional attributes ("Attrs" field in #/components/schemas/marketplaceCreateTargetRequest) for each item such as "phase", "floatPartValue" and "paintSeed" are available. You can check possible values of additional attributes here.
Limitations: maximum "Amount" value is 100; maximum quantity of targets in one request is 100; maximum number of created targets for one game is individual for each user and can be different for each game. You can contact our customer support team to find out your Target''s limit.'
operationId: CreateTargets
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceCreateTargetsRequest'
example:
GameID: a8db
Targets:
- Amount: '1'
Price:
Currency: USD
Amount: 10.5
Title: AK-47 | Redline (Field-Tested)
Attrs:
floatPartValue: FT-0
required: true
responses:
'200':
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceCreateTargetsResponse'
default:
description: An unexpected error response
content:
application/json:
schema:
$ref: '#/components/schemas/runtimeError'
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl -X POST 'https://api.dmarket.com/marketplace-api/v1/user-targets/create' \\\n -H 'Content-Type: application/json' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\" \\\n -d '{\n \"GameID\": \"a8db\",\n \"Targets\": [\n {\n \"Amount\": \"1\",\n \"Price\": {\n \"Currency\": \"USD\",\n \"Amount\": 10.5\n },\n \"Title\": \"AK-47 | Redline (Field-Tested)\",\n \"Attrs\": {\n \"floatPartValue\": \"FT-0\"\n }\n }\n ]\n}'"
- lang: Python
label: Python (dm-trading-tools)
source: "# Full signing client: https://github.com/dmarket/dm-trading-tools\nfrom dmarket_client import DMarketClient\n\nclient = DMarketClient(public_key=\"<public hex>\", secret_key=\"<secret hex>\")\npayload = {\n \"GameID\": \"a8db\",\n \"Targets\": [\n {\n \"Amount\": \"1\",\n \"Price\": {\n \"Currency\": \"USD\",\n \"Amount\": 10.5\n },\n \"Title\": \"AK-47 | Redline (Field-Tested)\",\n \"Attrs\": {\n \"floatPartValue\": \"FT-0\"\n }\n }\n ]\n}\nresult, err = client.call(\"POST\", \"/marketplace-api/v1/user-targets/create\", payload=payload)\nprint(result)"
/marketplace-api/v1/user-targets/delete:
post:
tags:
- Buy items
summary: Remove targets
description: Remove targets.
operationId: DeleteTargets
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceDeleteTargetsRequest'
example:
Targets:
- TargetID: d4e5f6a7-b8c9-0123-def0-456789012345
required: true
responses:
'200':
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/marketplaceDeleteTargetsResponse'
default:
description: An unexpected error response
content:
application/json:
schema:
$ref: '#/components/schemas/runtimeError'
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl -X POST 'https://api.dmarket.com/marketplace-api/v1/user-targets/delete' \\\n -H 'Content-Type: application/json' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\" \\\n -d '{\n \"Targets\": [\n {\n \"TargetID\": \"d4e5f6a7-b8c9-0123-def0-456789012345\"\n }\n ]\n}'"
- lang: Python
label: Python (dm-trading-tools)
source: "# Full signing client: https://github.com/dmarket/dm-trading-tools\nfrom dmarket_client import DMarketClient\n\nclient = DMarketClient(public_key=\"<public hex>\", secret_key=\"<secret hex>\")\npayload = {\n \"Targets\": [\n {\n \"TargetID\": \"d4e5f6a7-b8c9-0123-def0-456789012345\"\n }\n ]\n}\nresult, err = client.call(\"POST\", \"/marketplace-api/v1/user-targets/delete\", payload=payload)\nprint(result)"
/marketplace-api/v2/offers:
get:
tags:
- Buy items
summary: List marketplace offers
description: 'Get the list of offers currently available for purchase on the DMarket storefront. Prices are returned as integer cents. ''gameId'' param values are: CS2 - a8db, Team Fortress 2 - tf2, Dota 2 - 9a92, Rust - rust.'
operationId: GetMarketplaceOffersV2
x-badges:
- name: NEW
color: '#04BA39'
parameters:
- name: gameId
in: query
description: 'Game identifier. One of: a8db (CS2), 9a92 (Dota 2), tf2, rust.'
required: true
schema:
type: string
enum:
- a8db
- 9a92
- tf2
- rust
example: a8db
- name: title
in: query
description: Filter offers by title prefix (case-insensitive).
required: false
schema:
type: string
- name: treeFilters
in: query
description: 'Attribute filters in comma-separated key=value format. Values must match how the attribute is stored (typically the lowercase Steam string; see allowed values below).
Supported common keys: `categoryPath`, `type`, `tradeLockFrom`, `tradeLockTo`. Filter by game, title, and price via the top-level `gameId`, `title`, and `priceFrom`/`priceTo` query parameters.
CS2 keys: `exterior`, `paintSeed`, `floatPart`, `phase`, `category`, `collection`, `charmName`, `charmExists`, `sticker`, `isProskin`, `fadePercentFrom`, `fadePercentTo`.
TF2 keys: `exterior`, `collection`, `isCraftable`. Dota 2 keys: `hero`.
Allowed CS2 values:
- `exterior`: `factory new`, `minimal wear`, `field-tested`, `well-worn`, `battle-scarred`, `not painted`
- `phase`: `phase-1`, `phase-2`, `phase-3`, `phase-4`, `ruby`, `sapphire`, `emerald`, `black-pearl`
- `floatPart`: `FN-0`..`FN-6`, `MW-0`..`MW-4`, `FT-0`..`FT-4`, `WW-0`..`WW-4`, `BS-0`..`BS-4` (bucketed float ranges per exterior)
- `category`: `stattrak_tm` (`_tm` is translated to the ™ symbol server-side), `souvenir`, `normal`, `★` (knives)
Allowed TF2 exterior values: `factory new`, `minimal wear`, `field-tested`, `well-worn`, `battle-scarred`, `battle scarred`.
Multi-value: suffix key with `[]`, e.g. `exterior[]=factory new,exterior[]=minimal wear` (URL-encode the space as `%20`).
Negation: prefix key with `not_`, e.g. `not_exterior=factory new`. Negation is not supported for `charmName`/`sticker`.
Ranges: `fadePercentFrom=10,fadePercentTo=90`. Steam trade-lock filtering uses `tradeLockFrom`/`tradeLockTo` (remaining lock in days; `tradeLockFrom` is inclusive, `tradeLockTo` is exclusive).
Existence check: `charmExists=true` / `charmExists=false`.
Charm and sticker filters (`charmName`, `sticker[]`, `charmExists`) apply to CS2 offers only.
Example: `categoryPath=rifle,exterior[]=factory new,exterior[]=minimal wear`.'
required: false
schema:
type: string
example: categoryPath=rifle,exterior[]=factory new
- name: priceFrom
in: query
description: Lower bound of the offer price range in cents (inclusive).
required: false
schema:
type: integer
format: int64
- name: priceTo
in: query
description: Upper bound of the offer price range in cents (inclusive).
required: false
schema:
type: integer
format: int64
- name: orderBy
in: query
description: 'Sort field. Supported values: `price`, `title`, `float`, `createdAt`.'
required: false
schema:
type: string
enum:
- price
- title
- float
- createdAt
- name: orderDir
in: query
description: Sort direction. Defaults to `asc` when `orderBy` is set.
required: false
schema:
type: string
enum:
- asc
- desc
- name: limit
in: query
description: Number of items to return per page. Range 1..100.
required: true
schema:
type: integer
format: int32
minimum: 1
maximum: 100
- name: cursor
in: query
description: Pagination cursor returned from a previous response.
required: false
schema:
type: string
maxLength: 500
responses:
'200':
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/marketplacev2GetMarketplaceOffersResponse'
example:
items:
- offerId: f7c1b8e2-9a3d-4e6f-bb12-3a5c9d0e1f23
priceCents: 1599
createdAt: '2026-06-17T10:30:00Z'
locked: false
attributes:
title: AK-47 | Redline (Field-Tested)
gameId: a8db
categoryPath: rifle/ak-47
tradable: true
cs2Attributes:
exterior: field-tested
floatValue: 0.2356
paintSeed: 412
total: 128
cursor: eyJvZmZzZXQiOjEwfQ==
default:
description: An unexpected error response
content:
application/json:
schema:
$ref: '#/components/schemas/runtimeError'
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl -G 'https://api.dmarket.com/marketplace-api/v2/offers' \\\n --data-urlencode 'gameId=a8db' \\\n --data-urlencode 'title=AK-47' \\\n --data-urlencode 'treeFilters=categoryPath=rifle,exterior[]=factory new' \\\n --data-urlencode 'priceFrom=500' \\\n --data-urlencode 'priceTo=5000' \\\n --data-urlencode 'orderBy=price' \\\n --data-urlencode 'orderDir=asc' \\\n --data-urlencode 'limit=10' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\""
- lang: Python
label: Python (dm-trading-tools)
source: "# Full signing client: https://github.com/dmarket/dm-trading-tools\nfrom dmarket_client import DMarketClient\n\nclient = DMarketClient(public_key=\"<public hex>\", secret_key=\"<secret hex>\")\npayload = {\n \"gameId\": \"a8db\",\n \"title\": \"AK-47\",\n \"treeFilters\": \"categoryPath=rifle,exterior[]=factory new\",\n \"priceFrom\": 500,\n \"priceTo\": 5000,\n \"orderBy\": \"price\",\n \"orderDir\": \"asc\",\n \"limit\": 10\n}\nresult, err = client.call(\"GET\", \"/marketplace-api/v2/offers\", payload=payload)\nprint(result)"
/exchange/v1/offers-buy:
patch:
tags:
- Buy items
summary: Buy offers
description: 'Buy the selected offers from the market. As the result of the operation: the offer is removed, the items are transferred to the buyer, the purchase amount is transferred to the seller, the fee is transferred to DMarket. The price amount format is in coins (cents for USD).'
operationId: buyOffers
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/entity.OfferBuyRequest'
example:
offers:
- offerId: c3d4e5f6-a7b8-9012-cdef-345678901234
price:
amount: '4999'
currency: USD
type: dmarket
required: true
responses:
'200':
description: No content
content:
application/json:
schema:
$ref: '#/components/schemas/entity.OfferBuyResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/rest.ErrorRepresentation'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/rest.ErrorRepresentation'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/rest.ErrorRepresentation'
default:
description: No content
content:
application/json:
schema:
$ref: '#/components/schemas/entity.OfferBuyResponse'
x-codeSamples:
- lang: Shell
label: cURL
source: "# Sign the request and set the three auth headers — reference clients: https://github.com/dmarket/dm-trading-tools\ncurl -X PATCH 'https://api.dmarket.com/exchange/v1/offers-buy' \\\n -H 'Content-Type: application/json' \\\n -H \"X-Api-Key: $DMARKET_PUBLIC_KEY\" \\\n -H \"X-Sign-Date: $TIMESTAMP\" \\\n -H \"X-Request-Sign: dmar ed25519 $SIGNATURE\" \\\n -d '{\n \"offers\": [\n {\n \"offerId\": \"c3d4e5f6-a7b8-9012-cdef-345678901234\",\n \"price\": {\n \"amount\": \"4999\",\n \"currency\": \"USD\"\n },\n \"type\": \"dmarket\"\n }\n ]\n}'"
- lang: Python
label: Python (dm-trading-tools)
source: "# Full signing client: https://github.com/dmarket/dm-trading-tools\nfrom dmarket_client import DMarketClient\n\nclient = DMarketClient(public_key=\"<public hex>\", secret_key=\"<secret hex>\")\npayload = {\n \"offers\": [\n {\n \"offerId\": \"c3d4e5f6-a7b8-9012-cdef-345678901234\",\n \"price\": {\n \"amount\": \"4999\",\n \"currency\": \"USD\"\n },\n \"type\": \"dmarket\"\n }\n ]\n}\nresult, err = client.call(\"PATCH\", \"/exchange/v1/offers-buy\", payload=payload)\nprint(result)"
components:
schemas:
marketplaceCreateTargetsRequest:
type: object
properties:
GameID:
type: string
description: GameID of same assets in one single target entity.
Targets:
type: array
description: List of targets to create.
items:
$ref: '#/components/schemas/marketplaceCreateTargetRequest'
ListAggregatedPricesResponseAggregatedPrice:
type: object
properties:
title:
type: string
orderBestPrice:
$ref: '#/components/schemas/commonMoney'
orderCount:
type: string
format: int64
offerBestPrice:
$ref: '#/components/schemas/commonMoney'
offerCount:
type: string
format: int64
.dmOffersFailReason:
required:
- code
properties:
code:
type: string
rest.ErrorRepresentation:
required:
- code
- message
properties:
code:
type: string
message:
# --- truncated at 32 KB (47 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/dmarket/refs/heads/main/openapi/dmarket-buy-items-api-openapi.yml