Steam Web API/IEconService
The IEconService interface provides methods related to inventory and trading. See the Steam Web API page for more information about Web APIs.
Common Values
ETradeOfferState
These are the different states for a trade offer:
Name | Value | Comment |
k_ETradeOfferStateInvalid | 1 | Invalid |
k_ETradeOfferStateActive | 2 | This trade offer has been sent, neither party has acted on it yet. |
k_ETradeOfferStateAccepted | 3 | The trade offer was accepted by the recipient and items were exchanged. |
k_ETradeOfferStateCountered | 4 | The recipient made a counter offer |
k_ETradeOfferStateExpired | 5 | The trade offer was not accepted before the expiration date |
k_ETradeOfferStateCanceled | 6 | The sender cancelled the offer |
k_ETradeOfferStateDeclined | 7 | The recipient declined the offer |
k_ETradeOfferStateInvalidItems | 8 | Some of the items in the offer are no longer available (indicated by the missing flag in the output) |
k_ETradeOfferStateCreatedNeedsConfirmation | 9 | The offer hasn't been sent yet and is awaiting email/mobile confirmation. The offer is only visible to the sender. |
k_ETradeOfferStateCanceledBySecondFactor | 10 | Either party canceled the offer via email/mobile. The offer is visible to both parties, even if the sender canceled it before it was sent. |
k_ETradeOfferStateInEscrow | 11 | The trade has been placed on hold. The items involved in the trade have all been removed from both parties' inventories and will be automatically delivered in the future. |
ETradeOfferConfirmationMethod
These are the different methods in which a trade offer can be confirmed.
Name | Value | Comment |
k_ETradeOfferConfirmationMethod_Invalid | 0 | Invalid |
k_ETradeOfferConfirmationMethod_Email | 1 | An email was sent with details on how to confirm the trade offer |
k_ETradeOfferConfirmationMethod_MobileApp | 2 | The trade offer may be confirmed via the mobile app |
ETradeStatus
Tracks the status of a trade after a trade offer has been accepted.
Name | Value | Comment |
k_ETradeStatus_Init | 0 | Trade has just been accepted/confirmed, but no work has been done yet |
k_ETradeStatus_PreCommitted | 1 | Steam is about to start committing the trade |
k_ETradeStatus_Committed | 2 | The items have been exchanged |
k_ETradeStatus_Complete | 3 | All work is finished |
k_ETradeStatus_Failed | 4 | Something went wrong after Init, but before Committed, and the trade has been rolled back |
k_ETradeStatus_PartialSupportRollback | 5 | A support person rolled back the trade for one side |
k_ETradeStatus_FullSupportRollback | 6 | A support person rolled back the trade for both sides |
k_ETradeStatus_SupportRollback_Selective | 7 | A support person rolled back the trade for some set of items |
k_ETradeStatus_RollbackFailed | 8 | We tried to roll back the trade when it failed, but haven't managed to do that for all items yet |
k_ETradeStatus_RollbackAbandoned | 9 | We tried to roll back the trade, but some failure didn't go away and we gave up |
k_ETradeStatus_InEscrow | 10 | Trade is in escrow |
k_ETradeStatus_EscrowRollback | 11 | A trade in escrow was rolled back |
CEcon_Asset
appid
contextid
assetid
- eitherassetid
orcurrencyid
will be setcurrencyid
- eitherassetid
orcurrencyid
will be setclassid
- together withinstanceid
, uniquely identifies the display of the iteminstanceid
- together withclassid
, uniquely identifies the display of the itemamount
- the amount offered in the trade, for stackable items and currencymissing
- a boolean that indicates the item is no longer present in the user's inventoryest_usd
- a string that represent Steam's determination of the item's value, in whole USD pennies. How this is determined is unknown.
CEcon_TradeOffer
Both GetTradeOffers and GetTradeOffer return this structure:
tradeofferid
- a unique identifier for the trade offeraccountid_other
- your partner in the trade offermessage
- a message included by the creator of the trade offerexpiration_time
- unix time when the offer will expire (or expired, if it is in the past)trade_offer_state
- see ETradeOfferState aboveitems_to_give
- array of CEcon_Asset, items you will give up in the trade (regardless of who created the offer)items_to_receive
- array of CEcon_Asset, items you will receive in the trade (regardless of who created the offer)is_our_offer
- boolean to indicate this is an offer you created.time_created
- unix timestamp of the time the offer was senttime_updated
- unix timestamp of the time the trade_offer_state last changed.from_real_time_trade
- boolean to indicate this is an offer automatically created from a real-time trade.escrow_end_date
- unix timestamp of when the trade hold period is supposed to be over for this trade offerconfirmation_method
- the confirmation method that applies to the user asking about the offer. See ETradeOfferConfirmationMethod above.
CEcon_GetTradeHistory_Response_Trade_TradedAsset
A traded item returned by GetTradeHistory
appid
contextid
assetid
amount
classid
- together withinstanceid
, uniquely identifies the display of the iteminstanceid
- together withclassid
, uniquely identifies the display of the itemnew_assetid
- the asset ID given to the item after the trade completednew_contextid
- the context ID the item was placed inrollback_new_assetid
- if the trade has been rolled back, the new asset ID given in the rollbackrollback_new_contextid
- if the trade has been rolled back, the context ID the new asset was placed in
CEcon_GetTradeHistory_Response_Trade_TradedCurrency
A traded currency returned by GetTradeHistory
appid
contextid
currencyid
amount
classid
new_currencyid
- the currency ID given after the trade completednew_contextid
- the context ID the currency was placed inrollback_new_currencyid
- if the trade has been rolled back, the new currency ID given in the rollbackrollback_new_contextid
- if the trade has been rolled back, the context ID the new asset was placed in
CEcon_GetTradeHistory_Response_Trade
A trade returned by GetTradeHistory
tradeid
- a unique identifier for the tradesteamid_other
- the SteamID of your trade partnertime_init
- unix timestamp of the time the trade started to committime_escrow_end
- unix timestamp of the time the trade will leave escrowstatus
- see ETradeStatus aboveassets_received
- array of CEcon_GetTradeHistory_Response_Trade_TradedAsset showing the items received in the tradeassets_given
- array of CEcon_GetTradeHistory_Response_Trade_TradedAsset showing the items given to the other party in the tradecurrency_received
- array of CEcon_GetTradeHistory_Response_Trade_TradedCurrency showing the items received in the tradecurrency_given
- array of CEcon_GetTradeHistory_Response_Trade_TradedCurrency showing the items given to the other party in the trade
GetTradeOffers (v1)
This API gets a list of trade offers (up to a maximum of 500 sent or 1000 received regardless of time_historical_cutoff) for the account associated with the WebAPI key. You cannot call this API for accounts other than your own.
Input
Either get_sent_offers
or get_received_offers
(or both) must be set. active_only
and historical_only
are optional, if neither is passed it is equivalent to both being set.
get_sent_offers
- return the list of offers you've sent to other people.get_received_offers
- return the list of offers you've received from other people.get_descriptions
- return item display information for any items included in the returned offers.language
- needed ifget_descriptions
is set, the language to use for item descriptions.active_only
- return only trade offers in an active state (offers that haven't been accepted yet), or any offers that have had their state change sincetime_historical_cutoff
.historical_only
- return trade offers that are not in an active state.time_historical_cutoff
- a unix time value. whenactive_only
is set, inactive offers will be returned if their state was updated since this time. Useful to get delta updates on what has changed. WARNING: If not passed, this will default to the time your account last viewed the trade offers page. To avoid this behavior use a very low or very high date.
Output
trade_offers_sent
- ifget_sent_offers
was set, this will be an array of CEcon_TradeOffer values that you have sent.trade_offers_received
- ifget_received_offers
was set, this will be an array of CEcon_TradeOffer values that have been sent to you.descriptions
- ifget_descriptions
was set, this will be a list of item display information. This is associated with the data in theitems_to_receive
anditems_to_give
lists via theclassid
/instanceid
identifier pair.
GetTradeOffer (v1)
This API gets details about a single trade offer. The trade offer must have been sent to or from the account associated with the WebAPI key. You cannot call this API for accounts other than your own.
Input
tradeofferid
- the trade offer identifierlanguage
- the language to use for item display information.
Output
offer
- A CEcon_TradeOffer representing the offerdescriptions
- iflanguage
was set, this will be a list of item display information. This is associated with the data in theitems_to_receive
anditems_to_give
lists via theclassid
/instanceid
identifier pair.
DeclineTradeOffer (v1)
Decline a trade offer that was sent to you. The trade offer must have been sent to the account associated with the WebAPI key. You cannot call this API for accounts other than your own. This accepts only POST requests.
Input
tradeofferid
- the trade offer identifier
Output
(just the usual success/error fields)
CancelTradeOffer (v1)
Cancel a trade offer that you sent. The trade offer must have been sent by the account associated with the WebAPI key. You cannot call this API for accounts other than your own. This accepts only POST requests.
Input
tradeofferid
- the trade offer identifier
Output
(just the usual success/error fields)
GetTradeHistory (v1)
Gets a history of trades that you have been involved in as identified by the account associated with the WebAPI key. You cannot call this API for accounts other than your own.
Input
10
- The number of trades to return information for, limit 500 if get_descriptions is false and 100 if get_descriptions is truestart_after_time
- The time of the last trade shown on the previous page of results, or the time of the first trade if navigating backstart_after_tradeid
- The tradeid shown on the previous page of results, or the ID of the first trade if navigating backnavigating_back
- Return the previous max_trades trades before the start time and IDget_descriptions
- If set, the item display data for the items included in the returned trades will also be returnedlanguage
- The language to use when loading item display datainclude_failed
- If set, trades in statusk_ETradeStatus_Failed
,k_ETradeStatus_RollbackFailed
,k_ETradeStatus_RollbackAbandoned
, andk_ETradeStatus_EscrowRollback
will be included
Output
total_trades
- total number of trades performed by the accountmore
- whether or not more are availabletrades
- array of CEcon_GetTradeHistory_Response_Tradedescriptions
- ifget_descriptions
was set, this will be a list of item display information. This is associated with the data in theassets/currency_received
andassets/currency_given
lists via theclassid
/instanceid
identifier pair.
GetTradeHoldDurations(v1)
Returns the estimated hold duration and end date that a trade with a user would have. You cannot call this API for accounts other than your own.
Input
steamid_target
- the 64-bit steamid of the other user in a potential trade.trade_offer_access_token
- the access token in the trade offer URL of the other user. If your account is friends with the target, this may be omitted or incorrect and you will still receive a valid response.
Output
All output fields are a document with a single member, escrow_end_duration_seconds
.
my_escrow
- the duration of the escrow caused by your account.their_escrow
- the duration of the escrow caused by thesteamid_target
account.both_escrow
- the higher of the two above escrow durations.