FAQ - RoyalGr4pe/stockx-sdk GitHub Wiki
❓ FAQs – StockX Python SDK
Welcome to the Frequently Asked Questions (FAQs) page for the StockX SDK. Here, we cover common issues, how-tos, and tips to help you get the most out of the SDK.
🔐 Authentication
Q: How do I authenticate with the StockX API?
Use the setup()
function from the stockx.connection
module:
from stockx.connection import setup
setup({"api_key": "YOUR_API_KEY", "jwt": "YOUR_JWT_TOKEN"})
Make sure your api_key
and jwt
are valid and not expired.
⚙️ General Usage
asyncio
to call SDK functions?
Q: Do I need to use Yes. All API calls are asynchronous. Use asyncio.run()
to call them:
import asyncio
from stockx.orders import get_order_by_id
async def main():
result = await get_order_by_id("order_id_here")
print(result)
asyncio.run(main())
orderStatus
or listingStatuses
?
Q: Where can I find valid values for filters like Refer to the parameter documentation in the respective API pages:
Each field includes allowed values and format rules.
🧪 Testing
Q: Can I test the SDK without making real API calls?
Currently, no sandbox mode is available. All requests are live and affect your account. Consider using small page sizes or narrow date ranges for safer testing.
📦 Pagination
Q: How do I paginate results?
Use pageNumber
and pageSize
in the request:
await get_all_listings({
"pageNumber": 1,
"pageSize": 10
})
Keep incrementing pageNumber
until the API returns an empty list.
🐞 Errors
Q: I’m getting a 401 Unauthorized error. What’s wrong?
- Double-check your API Key and JWT.
- Ensure you're passing them via
setup()
. - Check if your token has expired.
Q: Why am I getting a 400 Bad Request?
Check:
- Parameter formats (e.g., no quotes/brackets around lists).
- Required fields are not missing.
- Date formats are
YYYY-MM-DD
.
🧾 Billing & Rate Limits
Q: Are there rate limits on the StockX API?
Yes. While StockX doesn’t publicly specify the exact rate limits, frequent 429 errors suggest you’re being throttled. Implement retry logic and avoid spamming requests.
🛠 Need More Help?
- Open an issue on GitHub
- Contact StockX support if the issue is specific to your account or API credentials.