Partner API Documentation
Complete guide to integrating SP3ND.shop into your platform
Quick Navigation
Getting Started
Step 1: Apply for Partnership
Submit your application to become a SP3ND partner:
- Visit the application page or call the
applyForPartnershipfunction - Provide your company name, contact email, website, and description
- Specify your expected order volume (low/medium/high)
- Wait for approval from our team
Step 2: Create Your Partner Account
Once approved, you'll receive an email with instructions:
- Visit
https://sp3nd.shop/partner-api/signup - Sign up using the email address from your application
- After signing in, view your API credentials in the dashboard
- ⚠️ IMPORTANT: Save your API Secret immediately - it won't be shown again!
Step 3: Get Your API Credentials
Your credentials are available in the dashboard:
- API Key: Your public identifier (always visible)
- API Secret: Your private authentication token (shown only once during initial setup)
- If you need to regenerate your secret, use the "Regenerate Secret" button in the dashboard
Authentication
Required Headers
All API requests (except application endpoints) require these headers:
Authentication Flow
- Your system includes both headers in the request
- SP3ND validates the API key exists and is approved
- SP3ND verifies the API secret matches the hashed version
- If valid, the request proceeds; otherwise, you receive a 401 Unauthorized error
Security Best Practices
- Never expose your API Secret in client-side code or public repositories
- Store credentials securely (environment variables, secrets manager)
- Use HTTPS for all API requests
- Regenerate your secret immediately if it's compromised
- Rotate secrets periodically (every 90 days recommended)
API Endpoints
Base URL
Cart Management
POST /createPartnerCartRequires AuthCreate a shopping cart with items (destination-aware eBay shipping supported)
{ items: [...], shipping_address?, ship_to_country?, ship_to_postal_code? }POST /addItemToPartnerCart/{cartId}Requires AuthAdd single item to cart (auto-scrapes product details, increases quantity if exists; eBay is destination-aware)
{ product_url, quantity, shipping_address?, ship_to_country?, ship_to_postal_code? }PATCH /updateCartItemQuantity/{cartId}/{itemId}Requires AuthUpdate item quantity in cart
{ quantity }DELETE /removeCartItem/{cartId}/{itemId}Requires AuthRemove item from cart
PATCH /updateCartShippingAddress/{cartId}Requires AuthUpdate shipping address, reprice eBay shipping, and calculate tax automatically
{ shipping_address: {...} }POST /addItemsToPartnerCart/{cartId}LegacyAdd multiple items to cart (legacy - use addItemToPartnerCart instead)
GET /getPartnerCart/{cartId}Requires AuthGet cart details and totals
Order Management
POST /createPartnerOrderRequires AuthCreate order from cart with shipping address
{ cart_id, shipping_address, customer_email, test }test: true to create test orders (hidden from admin by default, don't affect stats)GET /getPartnerOrdersRequires AuthList your orders with optional filters (status, user_wallet, customer_email)
limit, offset, status, user_wallet, customer_emailGET /getPartnerOrder/{orderId}Requires AuthGet single order details with full tracking information
/getPartnerOrder/{orderId} or /getPartnerOrder/{orderNumber}Payment Processing
POST /createPartnerTransactionRequires AuthCreate payment transaction with memo for order tracking
Important:
- Memo format must be exactly:
SP3ND Order: {order_number} - Recipient address: use the
recipient_addressreturned by createPartnerOrder - SP3ND checks for payments every minute automatically
Dashboard & Analytics
GET /getPartnerDashboardRequires AuthGet usage metrics, fees, and revenue share stats
GET /getPartnerKeysRequires AuthView your API key (secret never returned)
Integration Flow
Complete Order Flow
- Partner creates cart with itemsUse simple format: just product_url and quantityFor eBay items, include destination via shipping_address or ship_to_country + ship_to_postal_codeSP3ND auto-scrapes product details (title, price, ASIN, image)Returns:
cart_id - Partner adds more items (optional)Use
addItemToPartnerCart- auto-scrapes product detailsIf item exists, quantity is increased automaticallyUpdates cart totals - Partner updates shipping address (optional but recommended)Use
updateCartShippingAddressto calculate tax/VATeBay shipping is repriced for the new postal codeIf undeliverable, the API returns409 EBAY_UNDELIVERABLETax is automatically calculated based on shipping address - Partner creates order from cartReturns:
order_idandorder_numberOrder status: "Created"Settest: truefor test orders during integration - Partner creates payment transactionReturns payment attempt detailsCustomer sends payment with memo
- SP3ND system detects payment (checks every minute)Order status: "Paid"SP3ND processes order
- Order status updates automatically"Ordered" → "Shipped" → "Delivered"Estimated delivery dates extracted from Amazon emailsPartner can query order status anytime with
getPartnerOrdersorgetPartnerOrder
Status Progression
Code Examples
JavaScript/TypeScript Example
// Helper function to make authenticated requests
async function makeAuthenticatedRequest(endpoint, method = 'GET', body = null) {
const url = `https://us-central1-sp3nddotshop-prod.cloudfunctions.net/\${endpoint}`;
const options = {
method,
headers: {
'Content-Type': 'application/json',
'X-API-Key': API_KEY,
'X-API-Secret': API_SECRET,
},
};
if (body) {
options.body = JSON.stringify(body);
}
const response = await fetch(url, options);
return await response.json();
}
// Create a cart (simple format - just URL and quantity)
async function createCart(productUrl, quantity = 1) {
return await makeAuthenticatedRequest('createPartnerCart', 'POST', {
items: [{ product_url: productUrl, quantity }]
});
}
// Or create cart with full product details
async function createCartWithDetails(items) {
return await makeAuthenticatedRequest('createPartnerCart', 'POST', { items });
}
// Add item to cart (auto-scrapes product details)
async function addItemToCart(cartId, productUrl, quantity = 1) {
return await makeAuthenticatedRequest(`addItemToPartnerCart/\${cartId}`, 'POST', {
product_url: productUrl,
quantity
});
}
// Update cart shipping address (calculates tax automatically)
async function updateCartShippingAddress(cartId, shippingAddress) {
return await makeAuthenticatedRequest(`updateCartShippingAddress/\${cartId}`, 'PATCH', {
shipping_address: shippingAddress
});
}
// Create an order
async function createOrder(cartId, shippingAddress, customerEmail, isTest = false) {
return await makeAuthenticatedRequest('createPartnerOrder', 'POST', {
cart_id: cartId,
shipping_address: shippingAddress,
customer_email: customerEmail,
test: isTest, // Set to true for test orders
});
}
// Create payment transaction
async function createPayment(orderId, orderNumber, amount, recipientAddress, customerWallet) {
return await makeAuthenticatedRequest('createPartnerTransaction', 'POST', {
order_id: orderId,
order_number: orderNumber,
amount: amount,
currency: 'USD',
memo: `SP3ND Order: \${orderNumber}`,
recipient_address: recipientAddress, // from the createPartnerOrder response
sender_address: customerWallet,
});
}
// Get orders (with optional filters)
async function getOrders(limit = 50, status = null, userWallet = null, customerEmail = null) {
const params = new URLSearchParams({ limit: limit.toString() });
if (status) params.append('status', status);
if (userWallet) params.append('user_wallet', userWallet);
if (customerEmail) params.append('customer_email', customerEmail);
return await makeAuthenticatedRequest(`getPartnerOrders?\${params}`);
}
// Get single order by order_id or order_number
async function getOrder(orderIdOrNumber) {
return await makeAuthenticatedRequest(`getPartnerOrder/\${orderIdOrNumber}`, 'GET');
}Complete Order Flow Example
async function processOrder(productUrls, shippingAddress, customerEmail, customerWallet, isTest = false) {
try {
// 1. Create cart (start with first item)
const cartResult = await createCart(productUrls[0], 1);
const cartId = cartResult.cart.cart_id;
// 2. Add additional items one by one
for (let i = 1; i < productUrls.length; i++) {
await addItemToCart(cartId, productUrls[i], 1);
}
// 3. Update shipping address (calculates tax automatically)
await updateCartShippingAddress(cartId, shippingAddress);
// 4. Create order
const orderResult = await createOrder(cartId, shippingAddress, customerEmail, isTest);
const orderId = orderResult.order.order_id;
const orderNumber = orderResult.order.order_number;
const totalAmount = orderResult.order.total_amount;
// 5. Create payment transaction
const paymentResult = await createPayment(
orderId,
orderNumber,
totalAmount,
orderResult.order.recipient_address,
customerWallet
);
// 6. Return order details to customer
return {
orderId,
orderNumber,
totalAmount,
memo: paymentResult.memo,
recipientAddress: paymentResult.recipient_address,
};
} catch (error) {
console.error('Error processing order:', error);
throw error;
}
}Error Handling
Common Error Codes
| Status Code | Error | Description |
|---|---|---|
400 | Bad Request | Invalid request parameters |
401 | Unauthenticated | Missing or invalid API credentials |
403 | Permission Denied | Partner account not approved or suspended |
409 | Conflict | eBay item undeliverable for destination |
404 | Not Found | Resource (cart, order, etc.) not found |
410 | Gone | Cart has expired |
500 | Internal Server Error | Server-side error |
Error Response Format
{
error: "Error message describing what went wrong"
}Best Practices
Cart Management
- Create carts close to when orders will be placed (30 min expiry)
- Validate items before creating carts
- Handle cart expiration gracefully
Order Management
- Always create orders from valid carts
- Include customer email for notifications
- Provide accurate shipping addresses
- Monitor order status regularly
Payment Processing
- Use exact memo format:
SP3ND Order: {order_number} - Use correct treasury wallet address
- Wait for payment confirmation
- Handle payment failures gracefully
Security
- Never expose API secrets in client-side code
- Use environment variables or secrets manager
- Rotate secrets periodically
- Monitor API usage for suspicious activity
Support
For questions or issues:
- Email: support@sp3nd.shop
- Dashboard: View your dashboard
- Check your dashboard for API usage metrics and status