Metadata-Version: 2.4
Name: apimatic-wm-v4-sdk
Version: 0.0.5
Summary: This is a sample SDK generated by APIMatic
License-Expression: MIT
License-File: LICENSE
Keywords: apimatic,sdksio
Author: developer sdksio
Author-email: developer+sdksio@apimatic.io
Maintainer: APIMatic
Maintainer-email: support@apimatic.io
Requires-Python: >=3.10
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: certifi (>=2024.7.4)
Requires-Dist: httpx2 (>=2.13.1,<3.0.0)
Requires-Dist: pydantic[email] (>=2.11.0,<3.0.0)
Requires-Dist: typing-extensions (>=4.13.0,<5.0.0)
Project-URL: Documentation, https://apimatic.io
Description-Content-Type: text/markdown

# Walmart APIs SDK

[![Built with APIMatic][apimatic-badge]][apimatic-url] [![License: MIT][license-badge]][license-url] [![Python 3.10+][python-badge]][python-url]

The Walmart APIs SDK for Python provides access to the Walmart APIs REST APIs from Python applications.

> [!TIP]
> **Looking for a specific signature, model, enum, or error type?** This SDK ships a generated
> **[SDK map](sdk-map.md)** -- a lookup index of the SDK's entire Python surface. Consult it before
> scanning the source tree; details under [SDK map](#sdk-map).

The Walmart Marketplace APIs use OAuth for token-based authentication and authorization.<Br /> We also introduced OAuth 2.0 for solution providers to enable new authorizations using authorization code grant type. Sellers can now connect with solution provider apps seamlessly through this new Walmart's OAuth 2.0 user experience. Refer to the [Guide section](/doc/us/mp/us-mp-auth2/#606) for comprehensive instructions. Existing seller connections using the previous authorization method will remain operational., The Advertising API provides comprehensive advertising solutions for Walmart sellers, including:

## Search Engine Marketing (SEM)
Search Engine Marketing allows you to promote your listings through Google Shopping Ads and reach customers who are searching on Google for products like yours.

## Walmart Seller Affiliate Program (WSR)
The Attribution Reports API provides sellers with detailed performance analytics and item-level metrics for their affiliate marketing campaigns. This API enables sellers to track campaign effectiveness, monitor click-through rates, conversions, and revenue attribution across different campaign hierarchies.<br><b style='color:green;'>Market availability: US only</b>

## Authentication
All API requests require authentication using Walmart's standard OAuth 2.0 authentication.
Include the following headers with each request:
- `WM_SEC.ACCESS_TOKEN`: Your access token
- `WM_CONSUMER.CHANNEL.TYPE`: Consumer Channel Type received during onboarding
- `WM_SVC.NAME`: Walmart Service Name
- `WM_QOS.CORRELATION_ID`: Unique request correlation ID

## Rate Limits
- 10 requests per second per seller
- 1000 requests per hour per seller

## Data Freshness
Performance data is updated daily. Data for the current day may be incomplete., Assortment recommendations help sellers understand customer demand in Walmart and the external market by providing personalized item recommendations. These insights are generated by leveraging demand signals like: 
*   Internal and external search 
*   Best Sellers
*   Trending items

The assortment recommendations API can be used to view customer favorites (In-demand items), demand trends, filter, reject, and bulk download the recommendations. These recommended items can be set up using the [Item Setup API](https://developer.walmart.com/api/us/mp/items).
Sellers need to provide API access key on [developer portal](https://developer.walmart.com/account/generateKey) for ‘Analytics & Growth’ to solution providers and channel partners to be able to access Assortment Growth APIs., Endpoints for creating and tracking Ship with Walmart (SWW) shipment-protection claims., The Dispute Management APIs allows you to raise a dispute and check the status of an item under dispute.

Throttling: These APIs are limited to an aggregated total of 10 transactions per minute (TPM) per seller., Feeds are constructed to handle bulk functions. A feed consists of an HTTP request with an attached file. Once you upload the Feeds, you can use the Feed ID to track the status of the feeds and the status of the item within those Feeds., The Insights Management API provides sellers with actionable information to optimize their listings:
*   Sellers can locate best-selling items with Trending Items API so they can add those to their catalog of item offerings.
*   Sellers can find out reasons why items go unpublished, fix the issue and republish those items.
*   Sellers can use Listing Quality APIs to gather listing quality metrics about their items and find out any post-production issues that they can fix.
*   Sellers can obtain their overall Listing Quality score, and locate any categories that show items with listing quality issues., Maintaining up-to-date inventory for your items on Walmart.com ensures a great experience for your customers and greater sales opportunities for you., This API allows the retrieval of Lag Time for an item with a given SKU., Notifications Management API, The On Request Reports API allows you to request reports immediately about your items for faster retrieval. You can request the report, check status on the report availability, and then download the report URL when report is ready. You can also get a list of all reports requested., These APIs are specifically designed for payment use cases within the Walmart Marketplace., The price is a fundamental building block for your listing on Walmart.com. You can use the price management APIs to set up and manage the price for a given item, Sellers can set regular or promotional prices for their items. Setting the Promotional prices is an option to create unique pricing for events such as clearance sales or to call out a comparison price, APIs for providing recommendations to sellers., Please transition ASAP to using onRequest Reports (https://developer.walmart.com/doc/us/us-mp/us-mp-onrequestreports/). On July 29th, all PreGenerated reports other than recon report will be retired and only available onRequest. 
The Pregenerated Reports API allows you to obtain any pregenerated report that you need, including: item, item performance, buy box, CAP, promotions, reconciliation, return item override, shipping program and shipping configuration., The Reviews Acceleration API provides sellers with capability to view and enroll items into review accelerator programs:

*   Sellers can view their eligible product catalog that can be enrolled into Review Accelerator program(RAP) using Get RAP post-purchase items API
*   Sellers can view their currently enrolled products using Get RAP post-purchase items API
*   Sellers can leverage Get RAP post-purchase items API to get all products that have attained target reviews after enrolment into the program
*   Sellers can filter the products on the basis of category and price. They can also sort based on item priority and search using product name and SKU
*   Sellers can enroll a product/multiple products into the program using update item status API, Use the rich media management APIs to upload, link, delink, and manage 360-spin images and videos for Walmart Marketplace items. After registration, use your consumer ID and private key to authenticate and begin integration., SEO recommendations powered by Walmart AI-LLM model to optimize SEO traffic. This will help sellers enhance their product listings with keywords suggestions, improved content, optimized meta descriptions, and actionable insights, driving more organic traffic and increasing visibility and sales., The Ship With Walmart (SWW) APIs enables walmart.com sellers to buy shipping at competitively discounted rates directly from Walmart to ship their goods to US customers., The Simplified Shipping Settings APIs allows sellers to manage all the simplified shipping configuration for better shipping and delivery promise experience, API for bulk enrollment/unenrollment of items in Walmart Plus program

---

## Installation

To install the Python SDK from PyPI, with whichever package manager your project uses:

```bash
pip install apimatic-wm-v4-sdk
```

```bash
uv add apimatic-wm-v4-sdk
```

```bash
poetry add apimatic-wm-v4-sdk
```

To install from the SDK source instead, give the tool a path containing a slash — a bare folder name is looked up on PyPI, and resolves to whatever project holds that name there:

```bash
pip install <path-to-sdk>
```

---

## Quick Start

### Synchronous client

Construct `WalmartApisClient` with keyword arguments, and call `close()` when you are done. Every argument is optional; the full list is in the [SDK map](sdk-map.md).

```python
from walmart_apis import WalmartApisClient
from walmart_apis.core import BasicAuthCredentials

client = WalmartApisClient(
    basic_auth=BasicAuthCredentials(username="YOUR_USERNAME", password="YOUR_PASSWORD"),
    bearer_auth="YOUR_BEARER_TOKEN",
    access_token="YOUR_API_KEY",
    environment="production",
)

# TODO: call endpoints here -- see api-reference.md

client.close()
```

Alternatively, scope it -- `with WalmartApisClient(...) as client:` closes the pool on exit; see [Best Practices](#best-practices).

`Client` is exported as an alias of `WalmartApisClient`, so `from walmart_apis import Client` also works.

The SDK accepts every model-typed input in two interchangeable spellings, both type-checked: the typed model, or a plain dict with the same keys -- the `OrDict` and `Model | ModelDict` unions in the [SDK map](sdk-map.md). Pick whichever suits the call site: the dict form needs no import, while the model form adds a keyword-checked constructor and editor completion.

### Asynchronous client

`AsyncWalmartApisClient` mirrors `WalmartApisClient` with **identical method names**, and every endpoint method is a coroutine. It takes the same arguments, with some differences -- for example, the transport argument is `custom_async_http_client`.

```python
from asyncio import run

from walmart_apis import AsyncWalmartApisClient
from walmart_apis.core import BasicAuthCredentials


async def main() -> None:
    client = AsyncWalmartApisClient(
        basic_auth=BasicAuthCredentials(username="YOUR_USERNAME", password="YOUR_PASSWORD"),
        bearer_auth="YOUR_BEARER_TOKEN",
        access_token="YOUR_API_KEY",
        environment="production",
    )
    # TODO: call endpoints here, awaiting each -- see api-reference.md
    await client.aclose()


run(main())
```

Alternatively, scope it -- `async with AsyncWalmartApisClient(...) as client:` closes the pool on exit. Only the async spelling is `aclose`, matching httpx2; see [Best Practices](#best-practices).

`AsyncClient` is the exported alias. Each client accepts **only** its own transport argument; passing the other's is a `TypeError` at runtime and an error under mypy.

---

## Usage

Two generated references cover the SDK; each answers a different question:

| Reference | For |
| --- | --- |
| **[API Reference](api-reference.md)** | Usage guidance for a single **parsed** operation: `client.<group>.<operation>(...)` returns the typed payload and raises `ApiError` on any non-2xx, with `.error` the typed error body, or `RawError` for a status the operation does not document. |
| **[Raw API Reference](raw-api-reference.md)** | The same for the **raw** variant: `client.<group>.with_raw_response.<operation>(...)` returns `ApiResult[T, E]` and never raises for an API error. |

Both API references carry every one of the 117 operations, with a sync and an async sample and a parameter table each.

## SDK map

This SDK ships a generated **SDK map** -- [`sdk-map.md`](sdk-map.md) -- a deterministic, lookup-oriented table of contents of the SDK's Python surface, generated by APIMatic alongside this SDK.

Consult the map before scanning or grepping the source: it answers call-level contract questions by lookup, and for anything it does not carry -- model shapes, enum values, an endpoint's route or behavioural prose -- it names the one source file to read. How to read the map itself, including the SDK-wide defaults its rows rely on, is stated at the top of [`sdk-map.md`](sdk-map.md).

## Logging

The SDK logs every HTTP exchange through Python's standard `logging` module, under the `walmart_apis` logger, and configures nothing itself: with no logging set up, nothing is printed unless `WALMART_APIS_LOG` is set. Turn it on as for any library:

```python
import logging

logging.basicConfig()  # your application's handler; the root stays at WARNING
logging.getLogger("walmart_apis").setLevel(logging.INFO)  # the SDK's lines; DEBUG adds the dumps that logging_options turns on
```

Or set one environment variable before the process starts, for a run you cannot edit: `WALMART_APIS_LOG=info` writes the request and response lines, `WALMART_APIS_LOG=debug` adds the request headers, the request body and the response headers. If your application has configured logging, its handlers and format are used; otherwise the SDK writes to stderr.

Choose the detail with `logging_options`, a `LoggingOptions` from `walmart_apis.core`:

```python
from walmart_apis import WalmartApisClient
from walmart_apis.core import LoggingOptions

client = WalmartApisClient(
    logging_options=LoggingOptions(log_request_headers=True, log_response_headers=True, log_request_body=True)
)
```

A plain dict with the same keys is accepted too, as for every model-typed argument (see [Quick Start](#quick-start)): `logging_options={"log_request_headers": True}`.

| Option | Default | Effect |
| --- | --- | --- |
| `log_request_headers` | `False` | Log the sent headers at DEBUG, masked. |
| `log_response_headers` | `False` | Log the received headers at DEBUG, masked. |
| `log_request_body` | `False` | Log the request body at DEBUG: its text when in memory, a description when streamed. |
| `body_size_limit` | `32768` | Bytes of a logged body kept before it is cut. |
| `redaction_placeholder` | `"REDACTED"` | What a hidden value prints as. |
| `unmask_headers` | none | Header names to show although they are not on the safe list. |
| `mask_headers` | none | Header names to hide although they are on the safe list. |
| `mask_keys` | 11 credential names | Query and form keys whose values are always hidden; naming a set replaces the default. |

A single call can be quietened with `request_options={"log_level": logging.WARNING}`: records below that level are not written for that call. It never turns on a record the client's options leave off. Header, query and form values print `REDACTED` unless known safe; a JSON body is printed as sent, so enable `log_request_body` only where its content may be logged; a response body is never logged. The levels and every field are under **Logging** in the SDK map.

## Best Practices

> [!TIP]
> Use a **single `WalmartApisClient` instance** for the lifetime of your application and reuse it across
> all requests. Each instance owns its own connection pool, so an instance per request forfeits
> connection reuse and leaks pools that are never closed.

Match the disposal to the client's lifetime: an application-lifetime client is closed once at shutdown with `close()` / `aclose()`; where the lifetime fits a block, `with WalmartApisClient() as client:` / `async with AsyncWalmartApisClient() as client:` releases it automatically. Both are idempotent, but a closed client is not reusable: the next call raises. The client closes **whatever transport it holds**, including one you supplied via `custom_http_client` / `custom_async_http_client`; if you intend to reuse your own transport across clients, don't hand its lifetime to a `with` block.

**Retries are on by default**: a failed idempotent request — a retryable status or no response at all — is sent again up to three times before the call gives up. Pass `retry_options=0` to turn it off, for instance in a test that stubs an error response; the policy and its defaults are under **Retries** in the SDK map.

## License

This SDK is distributed under the [MIT License][license-url].

---

## Support

Refer to the [API reference](api-reference.md) for detailed information on available operations with code samples.

---

[license-url]: LICENSE
[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg
[apimatic-url]: https://www.apimatic.io
[apimatic-badge]: https://www.apimatic.io/hubfs/Built-with-APIMatic-badge.svg
[python-url]: https://www.python.org/downloads/
[python-badge]: https://img.shields.io/badge/python-3.10%2B-blue.svg

