Steam Web API/IEconService

From Valve Developer Community
< Steam Web API(Redirected from IEconService)
Jump to: navigation, search

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 - either assetid or currencyid will be set
  • currencyid - either assetid or currencyid will be set
  • classid - together with instanceid, uniquely identifies the display of the item
  • instanceid - together with classid, uniquely identifies the display of the item
  • amount - the amount offered in the trade, for stackable items and currency
  • missing - a boolean that indicates the item is no longer present in the user's inventory
  • est_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 offer
  • accountid_other - your partner in the trade offer
  • message - a message included by the creator of the trade offer
  • expiration_time - unix time when the offer will expire (or expired, if it is in the past)
  • trade_offer_state - see ETradeOfferState above
  • items_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 sent
  • time_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 offer
  • confirmation_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 with instanceid, uniquely identifies the display of the item
  • instanceid - together with classid, uniquely identifies the display of the item
  • new_assetid - the asset ID given to the item after the trade completed
  • new_contextid - the context ID the item was placed in
  • rollback_new_assetid - if the trade has been rolled back, the new asset ID given in the rollback
  • rollback_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 completed
  • new_contextid - the context ID the currency was placed in
  • rollback_new_currencyid - if the trade has been rolled back, the new currency ID given in the rollback
  • rollback_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 trade
  • steamid_other - the SteamID of your trade partner
  • time_init - unix timestamp of the time the trade started to commit
  • time_escrow_end - unix timestamp of the time the trade will leave escrow
  • status - see ETradeStatus above
  • assets_received - array of CEcon_GetTradeHistory_Response_Trade_TradedAsset showing the items received in the trade
  • assets_given - array of CEcon_GetTradeHistory_Response_Trade_TradedAsset showing the items given to the other party in the trade
  • currency_received - array of CEcon_GetTradeHistory_Response_Trade_TradedCurrency showing the items received in the trade
  • currency_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 if get_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 since time_historical_cutoff.
  • historical_only - return trade offers that are not in an active state.
  • time_historical_cutoff - a unix time value. when active_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 - if get_sent_offers was set, this will be an array of CEcon_TradeOffer values that you have sent.
  • trade_offers_received - if get_received_offers was set, this will be an array of CEcon_TradeOffer values that have been sent to you.
  • descriptions - if get_descriptions was set, this will be a list of item display information. This is associated with the data in the items_to_receive and items_to_give lists via the classid / 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 identifier
  • language - the language to use for item display information.

Output

  • offer - A CEcon_TradeOffer representing the offer
  • descriptions - if language was set, this will be a list of item display information. This is associated with the data in the items_to_receive and items_to_give lists via the classid / 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 true
  • start_after_time - The time of the last trade shown on the previous page of results, or the time of the first trade if navigating back
  • start_after_tradeid - The tradeid shown on the previous page of results, or the ID of the first trade if navigating back
  • navigating_back - Return the previous max_trades trades before the start time and ID
  • get_descriptions - If set, the item display data for the items included in the returned trades will also be returned
  • language - The language to use when loading item display data
  • include_failed - If set, trades in status k_ETradeStatus_Failed, k_ETradeStatus_RollbackFailed, k_ETradeStatus_RollbackAbandoned, and k_ETradeStatus_EscrowRollback will be included

Output

  • total_trades - total number of trades performed by the account
  • more - whether or not more are available
  • trades - array of CEcon_GetTradeHistory_Response_Trade
  • descriptions - if get_descriptions was set, this will be a list of item display information. This is associated with the data in the assets/currency_received and assets/currency_given lists via the classid / 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 the steamid_target account.
  • both_escrow - the higher of the two above escrow durations.