Permissions
This document explains how to manage and request permissions for accessing Amazon Seller data using the SP-API. It provides a step-by-step guide for understanding and handling permissions, so your app can interact with seller accounts on their behalf.
What are Permissions in SP-API?
Types of Permissions (Scopes)
sellingpartnerapi::orders
: Allows access to order-related datasellingpartnerapi::inventory
: Grants access to manage and retrieve inventory datasellingpartnerapi::products
: Allows access to product-related datasellingpartnerapi::reports
: Grants access to generate and retrieve reportssellingpartnerapi::shipping
: Allows access to manage shipping settings and fulfill orderssellingpartnerapi::finance
: Access to financial data like invoices and settlementssellingpartnerapi::notifications
: Allows your app to send notifications to the sellerStep-by-Step Guide to Handling Permissions
Step 1: Define Required Scopes for Your App
sellingpartnerapi::orders
and sellingpartnerapi::inventory
Step 2: Include Scopes in the Authorization URL
application_id
: Your app's ID (e.g., amzn1.sellerapps.app.123456)state
: A unique, random string to protect against CSRF attacksredirect_uri
: Your app's callback URIscope
: A space-separated list of required permissions
Step 3: Seller Logs In and Grants Permissions
redirect_uri
with the following parameters:state
: The same state string you sentcode
: The authorization code to exchange for tokens
Step 4: Handle Permissions in the Access Token Response
{
"access_token": "Atza|IwEBL0B1...",
"refresh_token": "Atzr|IwEBL0B1...",
"token_type": "bearer",
"expires_in": 3600,
"scope": "sellingpartnerapi::orders sellingpartnerapi::inventory"
}
scope
field in the response shows which permissions have been granted.Step 5: Access Seller Data Based on Granted Permissions
sellingpartnerapi::orders
scope to call the orders APIsellingpartnerapi::inventory
scope to retrieve inventory data
Step 6: Handle Revoked Permissions
{
"errors": [
{
"message": "Unauthorized",
"code": "Unauthorized",
"details": "The access token has expired or been revoked."
}
]
}
Best Practices for Handling Permissions
Request Minimal Scopes
Handle Permission Revocations
Secure Token Storage
Token Expiration Handling
Common Errors
Error Code | Description | Solution |
---|---|---|
invalid_scope | The requested scope is invalid or not available | Check if the scope is correctly specified |
access_denied | Seller denied access to requested permissions | Ensure the seller grants the required permissions |
unauthorized | Access token has expired or been revoked | Refresh the token or prompt the seller to reauthorize |