ebay-apiroute
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.modelstakes and returns typed pydantic models (api.inventory_item.models.get_inventory_item("SKU1")). - Sync and async: add
.aioto 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
marketplace_idis sent as theX-EBAY-C-MARKETPLACE-IDheader.sandbox=Trueswitches to eBay's sandbox hosts.- Getting tokens is up to your application. eBay's OAuth guide covers application tokens (the client credentials grant) and user tokens (the authorization code grant).
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.
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:
- 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.
- 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.
- Release (release-please) then updates its release PR. Merging that PR publishes a new version to PyPI.
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.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ebay_apiroute-0.1.0.tar.gz | 808.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ebay_apiroute-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.1 MB
Release files / ebay_apiroute-0.1.0.tar.gz
| Download URL | ebay_apiroute-0.1.0.tar.gz |
|---|---|
| Size | 808.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbbda587d626b95d419bc1dec675c959376dc27ca7f035acc63b0d3e6050671b
|
|
BLAKE2b-256 checksum How to use checksums |
b050545d6bdc664c59da3af80f527afd391add3096ef0c542d0092d463b9d246
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.1.0-py3-none-any.whl
| Download URL | ebay_apiroute-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23f8fc92e0ae03518a0cbbd9461b815a8f3ad97ec9998f9c752f99d8666a8688
|
|
BLAKE2b-256 checksum How to use checksums |
4d755211db466f005d7bd9cb257d0bb0eb45e8e75e3c1249eefeddf420cffb02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.1.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.