Skip to main content

ebay-apiroute

CI Build

Python clients for eBay's REST APIs and its Trading API, generated with apiroute from the API specs eBay publishes, and kept current by a weekly build.

  • Two layers: every call works with plain dicts (api.inventory_item.get_inventory_item("SKU1")), and .models takes and returns typed pydantic models (api.inventory_item.models.get_inventory_item("SKU1")).
  • Sync and async: add .aio to any call for the async version.
  • Lazy loading: only the APIs, sections and models you use are imported, so a script that calls one endpoint stays fast, though the package covers 30 APIs and about 1,400 models.

Installation

pip install ebay-apiroute    # or: uv add ebay-apiroute

It needs Python 3.10 or newer.

REST APIs

Every REST client takes an OAuth access token. The token can be a string, or a function that returns the current one, which suits code that refreshes tokens.

from ebay_apiroute.sell.inventory import SellInventoryApi

api = SellInventoryApi(token="v^1.1#i^1#...", marketplace_id="EBAY_US")

item = api.inventory_item.get_inventory_item("SKU1")  # a dict
item = api.inventory_item.models.get_inventory_item("SKU1")  # InventoryItemWithSkuLocaleGroupid
items = await api.inventory_item.models.aio.get_inventory_items(limit="25")

sandbox = SellInventoryApi(token=refreshing_token, sandbox=True)  # api.sandbox.ebay.com

Trading API

The Trading API is SOAP. Its client sends your token in the RequesterCredentials SOAP header, and adds the call name, site, application ID and API version to each request, as eBay's SOAP endpoint requires.

from ebay_apiroute.trading import TradingApi

trading = TradingApi(token="AgAAAA...", app_id="MyApp-PRD-...", site_id=0)
response = trading.get_item(body={"ItemID": "123456789", "DetailLevel": "ReturnAll"})
response = trading.models.get_item(body={"ItemID": "123456789"})  # GetItemResponseType

Bodies and responses use the xmltodict shape:

  • child elements are keys
  • "@name" is an attribute
  • "#text" is an element's text

A SOAP fault raises apiroute.soap.SoapFault. The API version comes from the WSDL (ebay_apiroute.trading_version.TRADING_VERSION); pass version= to override it.

APIs

API Import Docs
Browse API from ebay_apiroute.buy.browse import BuyBrowseApi docs
Deal API from ebay_apiroute.buy.deal import BuyDealApi docs
Feed API (Buy) from ebay_apiroute.buy.feed import BuyFeedApi docs
Buy Marketing API from ebay_apiroute.buy.marketing import BuyMarketingApi docs
Buy Offer API from ebay_apiroute.buy.offer import BuyOfferApi docs
Order API from ebay_apiroute.buy.order import BuyOrderApi docs
Catalog API from ebay_apiroute.commerce.catalog import CommerceCatalogApi docs
Charity API from ebay_apiroute.commerce.charity import CommerceCharityApi docs
Feedback API from ebay_apiroute.commerce.feedback import CommerceFeedbackApi docs
Identity API from ebay_apiroute.commerce.identity import CommerceIdentityApi docs
Media API from ebay_apiroute.commerce.media import CommerceMediaApi docs
Message API from ebay_apiroute.commerce.message import CommerceMessageApi docs
Notification API from ebay_apiroute.commerce.notification import CommerceNotificationApi docs
Taxonomy API from ebay_apiroute.commerce.taxonomy import CommerceTaxonomyApi docs
Translation API from ebay_apiroute.commerce.translation import CommerceTranslationApi docs
VeRO API from ebay_apiroute.commerce.vero import CommerceVeroApi docs
Developer Analytics API from ebay_apiroute.developer.analytics import DeveloperAnalyticsApi docs
Account API from ebay_apiroute.sell.account import SellAccountApi docs
Analytics API (Sell) from ebay_apiroute.sell.analytics import SellAnalyticsApi docs
Feed API (Sell) from ebay_apiroute.sell.feed import SellFeedApi docs
Finances API from ebay_apiroute.sell.finances import SellFinancesApi docs
Fulfillment API from ebay_apiroute.sell.fulfillment import SellFulfillmentApi docs
Inventory API from ebay_apiroute.sell.inventory import SellInventoryApi docs
Logistics API from ebay_apiroute.sell.logistics import SellLogisticsApi docs
Marketing API from ebay_apiroute.sell.marketing import SellMarketingApi docs
Metadata API from ebay_apiroute.sell.metadata import SellMetadataApi docs
Negotiation API from ebay_apiroute.sell.negotiation import SellNegotiationApi docs
Recommendation API from ebay_apiroute.sell.recommendation import SellRecommendationApi docs
Stores API from ebay_apiroute.sell.stores import SellStoresApi docs
Trading API from ebay_apiroute.trading import TradingApi docs

Errors raise apiroute.UnexpectedResponse, which carries the .response. For retries, transports and other client options, see apiroute's README.

Retries are off unless you turn them on, for example with api.with_options(retries=3), or retries = Retries(...) in a subclass. Once on, failed connections are always retried. After a read timeout, though, only calls that are safe to repeat are retried: REST GET, PUT (eBay's create-or-replace) and DELETE, and the Trading API's read-only calls (Get*, and the Verify* calls, which validate without listing). Writes such as REST POSTs and Trading's AddItem aren't, so an offer or a listing can't be created twice.

How this repository stays up to date

Nothing under src/ebay_apiroute/ is written by hand except auth.py and __init__.py. Everything else is generated from the API descriptions listed in apis.yaml:

  1. Every Monday, the Build workflow does the following:
    • Upgrades apiroute to its newest release.
    • Downloads each spec again into specs/, the committed copy of what eBay publishes.
    • Regenerates the clients with apiroute generate.
    • Runs the lint and tests.
  2. If anything changed, it commits the result to main:
    • feat(specs): ... when eBay changed a spec, which produces a minor release.
    • fix(codegen): ... when only a newer apiroute changed the generated code, which produces a patch release.
  3. Release (release-please) then updates its release PR, tests it, merges it and publishes the new version to PyPI. No one has to do anything: a new eBay spec or apiroute release reaches PyPI on its own once the tests pass.

CI checks every push. It lints, runs the tests on Python 3.10 to 3.14, and regenerates from the committed specs to confirm the committed code matches them exactly.

Because specs/ is committed, git log -p specs/ shows exactly what eBay changed and when.

Development

uv sync
uv run python scripts/generate.py --fetch      # download the latest specs, regenerate everything
uv run python scripts/generate.py --only trading   # regenerate one API from its committed spec
uv run pytest
uv run ruff check . && uv run ruff format --check .

To add an API, add an entry to apis.yaml, run scripts/generate.py --fetch, then commit the spec and the generated code. The table above updates itself. Auth lives in src/ebay_apiroute/auth.py, which the generated clients extend.

License

MIT

Metadata

Release files for ebay-apiroute 0.3.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 ebay-apiroute 0.3.0
File Size Uploaded Provenance Actions
ebay_apiroute-0.3.0.tar.gz 801.3 kB Without provenance Details for ebay_apiroute-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ebay-apiroute 0.3.0
File Interpreter ABI Platform Actions
ebay_apiroute-0.3.0-py3-none-any.whl Python 3 none any Details for ebay_apiroute-0.3.0-py3-none-any.whl

Total release size: 3.1 MB

Release files / ebay_apiroute-0.3.0.tar.gz

Download URL ebay_apiroute-0.3.0.tar.gz
Size 801.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2473c8ec0f5c51906a79e98585911d5f9a3e7bd97877dc5a259ca06cb405157f
BLAKE2b-256 checksum
How to use checksums
da48edd7a8e1aa260a439c460104e31bea799cefd63295a5b4ea1c23cba711e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ebay_apiroute-0.3.0-py3-none-any.whl

Download URL ebay_apiroute-0.3.0-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ef49a55391de73d51ff3247385d4b199658ff1c9b16182f575f1011433d20b99
BLAKE2b-256 checksum
How to use checksums
023442a9dac37d90c72a18f71f1151fc0681de51cb19dd176b10a1ae4a49d77a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ebay-apiroute 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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