A Rust client library for Amazon Selling Partner API (SP-API), providing complete API coverage and type-safe interfaces.
- Complete API Coverage: Auto-generated API models from OpenAPI specifications covering nearly all Amazon SP-API endpoints
- Integrated Client: High-level client wrapper with convenient methods for common API operations
First, set up your Amazon SP-API credentials as environment variables:
export SPAPI_CLIENT_ID="your_client_id"
export SPAPI_CLIENT_SECRET="your_client_secret"
export SPAPI_REFRESH_TOKEN="your_refresh_token"
export SPAPI_SANDBOX="false" # or "true" for sandbox environment
use amazon_spapi::{
client::{SpapiClient, SpapiConfig},
models::fba_inventory::InventorySummary,
};
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
// Create client from environment variables
let client = SpapiClient::new(SpapiConfig::from_env()?)?;
// Get FBA inventory summaries
let inventory = client
.get_inventory_summaries(
"Marketplace",
amazon_spapi::marketplace_ids::US,
vec![amazon_spapi::marketplace_ids::US.to_string()],
Some(false),
None,
None,
None,
None,
)
.await?;
println!("Inventory summaries: {:?}", inventory);
Ok(())
}
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This is an unofficial Amazon SP-API Rust client library. Please ensure compliance with Amazon's terms of service and API limitations.