Practical SellerMagnetAPI Code Examples

Jumpstart your integration with real-world code snippets for SellerMagnetAPI endpoints, tailored for Python, Node.js, and cURL.

Endpoint Code Examples

Explore use-case-driven code examples for each SellerMagnetAPI endpoint, complete with detailed descriptions and sample responses.

Use Case

Fetch detailed analytics for an Amazon product, such as sales trends and ranking, to inform pricing or inventory decisions. Ideal for market research tools.

Endpoint: /amazon-product-statistics

Method: GET

Parameters
Name Type Required Description
asin text Yes Product ASIN (e.g., "B08N5WRWNW")
marketplaceId text Yes Marketplace ID
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_amazon_product_statistics(api_key, asin, marketplaceId, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-product-statistics"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
        "asin": asin,
        
        "marketplaceId": marketplaceId,
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_amazon_product_statistics(
        api_key="YOUR_API_KEY",
        
        asin="Product ASIN "B08N5WRWNW"",
        
        marketplaceId="A1PA6795UKMFR9",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchAmazonProductStatistics(apiKey, asin, marketplaceId, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-product-statistics`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
        asin: asin,
        
        marketplaceId: marketplaceId,
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchAmazonProductStatistics(
            'YOUR_API_KEY',
            
            "Product ASIN "B08N5WRWNW"",
            
            "A1PA6795UKMFR9",
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-product-statistics"
PARAMS="asin=Product%20ASIN%20%22B08N5WRWNW%22&marketplaceId=A1PA6795UKMFR9&api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-product-statistics",
    "data": {
        "result": "Sample data for Amazon Product Statistics",
        "details": {
            
            "asin": "Product ASIN "B08N5WRWNW"",
            
            "marketplaceId": "A1PA6795UKMFR9",
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                
Use Case

Convert ASIN to EAN or vice versa to manage cross-marketplace product listings or integrate with external databases.

Endpoint: /amazon-asin-converter

Method: GET

Parameters
Name Type Required Description
asin text Yes ASIN or EAN to convert (e.g., "B08N5WRWNW" or "9781234567890")
marketplaceId text Yes Marketplace ID
conversion_direction text Yes Conversion direction: "asin-to-ean" or "ean-to-asin"
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_amazon_asin_converter(api_key, asin, marketplaceId, conversion_direction, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-asin-converter"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
        "asin": asin,
        
        "marketplaceId": marketplaceId,
        
        "conversion_direction": conversion_direction,
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_amazon_asin_converter(
        api_key="YOUR_API_KEY",
        
        asin="ASIN or EAN to convert "B08N5WRWNW" or "9781234567890"",
        
        marketplaceId="A1PA6795UKMFR9",
        
        conversion_direction="asin-to-ean",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchAmazonASINConverter(apiKey, asin, marketplaceId, conversion_direction, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-asin-converter`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
        asin: asin,
        
        marketplaceId: marketplaceId,
        
        conversion_direction: conversion_direction,
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchAmazonASINConverter(
            'YOUR_API_KEY',
            
            "ASIN or EAN to convert "B08N5WRWNW" or "9781234567890"",
            
            "A1PA6795UKMFR9",
            
            "asin-to-ean",
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-asin-converter"
PARAMS="asin=ASIN%20or%20EAN%20to%20convert%20%22B08N5WRWNW%22%20or%20%229781234567890%22&marketplaceId=A1PA6795UKMFR9&conversion_direction=asin-to-ean&api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-asin-converter",
    "data": {
        "result": "Sample data for Amazon ASIN Converter",
        "details": {
            
            "asin": "ASIN or EAN to convert "B08N5WRWNW" or "9781234567890"",
            
            "marketplaceId": "A1PA6795UKMFR9",
            
            "conversion_direction": "asin-to-ean",
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                
Use Case

Retrieve seller feedback to evaluate supplier reliability or monitor competitor performance, useful for dropshipping or sourcing platforms.

Endpoint: /amazon-seller-review

Method: GET

Parameters
Name Type Required Description
sellerId text Yes Seller ID (e.g., "A1B2C3D4E5F6G7")
marketplaceId text Yes Marketplace ID
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_get_amazon_seller_review(api_key, sellerId, marketplaceId, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-seller-review"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
        "sellerId": sellerId,
        
        "marketplaceId": marketplaceId,
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_get_amazon_seller_review(
        api_key="YOUR_API_KEY",
        
        sellerId="Seller ID "A1B2C3D4E5F6G7"",
        
        marketplaceId="A1PA6795UKMFR9",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchGetAmazonSellerReview(apiKey, sellerId, marketplaceId, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-seller-review`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
        sellerId: sellerId,
        
        marketplaceId: marketplaceId,
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchGetAmazonSellerReview(
            'YOUR_API_KEY',
            
            "Seller ID "A1B2C3D4E5F6G7"",
            
            "A1PA6795UKMFR9",
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-seller-review"
PARAMS="sellerId=Seller%20ID%20%22A1B2C3D4E5F6G7%22&marketplaceId=A1PA6795UKMFR9&api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-seller-review",
    "data": {
        "result": "Sample data for Get Amazon Seller Review",
        "details": {
            
            "sellerId": "Seller ID "A1B2C3D4E5F6G7"",
            
            "marketplaceId": "A1PA6795UKMFR9",
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                
Use Case

Access product details like price, images, and descriptions to build product comparison tools or enrich e-commerce catalogs.

Endpoint: /amazon-product-lookup

Method: GET

Parameters
Name Type Required Description
asin text Yes Product ASIN (e.g., "B08N5WRWNW")
marketplaceId text Yes Marketplace ID
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_get_amazon_product(api_key, asin, marketplaceId, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-product-lookup"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
        "asin": asin,
        
        "marketplaceId": marketplaceId,
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_get_amazon_product(
        api_key="YOUR_API_KEY",
        
        asin="Product ASIN "B08N5WRWNW"",
        
        marketplaceId="A1PA6795UKMFR9",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchGetAmazonProduct(apiKey, asin, marketplaceId, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-product-lookup`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
        asin: asin,
        
        marketplaceId: marketplaceId,
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchGetAmazonProduct(
            'YOUR_API_KEY',
            
            "Product ASIN "B08N5WRWNW"",
            
            "A1PA6795UKMFR9",
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-product-lookup"
PARAMS="asin=Product%20ASIN%20%22B08N5WRWNW%22&marketplaceId=A1PA6795UKMFR9&api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-product-lookup",
    "data": {
        "result": "Sample data for Get Amazon Product",
        "details": {
            
            "asin": "Product ASIN "B08N5WRWNW"",
            
            "marketplaceId": "A1PA6795UKMFR9",
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                
Use Case

Analyze multiple offers for a product to identify the best price or seller, perfect for price tracking or arbitrage applications.

Endpoint: /amazon-product-offers

Method: GET

Parameters
Name Type Required Description
asin text Yes Product ASIN
marketplaceId text Yes Marketplace ID
count number No Number of offers (max 20, default 10)
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_get_amazon_product_offers(api_key, asin, marketplaceId, count, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-product-offers"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
        "asin": asin,
        
        "marketplaceId": marketplaceId,
        
        "count": count,
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_get_amazon_product_offers(
        api_key="YOUR_API_KEY",
        
        asin="asin",
        
        marketplaceId="A1PA6795UKMFR9",
        
        count="30",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchGetAmazonProductOffers(apiKey, asin, marketplaceId, count, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-product-offers`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
        asin: asin,
        
        marketplaceId: marketplaceId,
        
        count: count,
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchGetAmazonProductOffers(
            'YOUR_API_KEY',
            
            "asin",
            
            "A1PA6795UKMFR9",
            
            "30",
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-product-offers"
PARAMS="asin=asin&marketplaceId=A1PA6795UKMFR9&count=30&api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-product-offers",
    "data": {
        "result": "Sample data for Get Amazon Product Offers",
        "details": {
            
            "asin": "asin",
            
            "marketplaceId": "A1PA6795UKMFR9",
            
            "count": "30",
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                
Use Case

Retrieve a list of Amazon marketplaces to configure region-specific API requests or display marketplace options in your app.

Endpoint: /amazon-get-marketplaces

Method: GET

Parameters
Name Type Required Description
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_get_amazon_marketplaces(api_key, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-get-marketplaces"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_get_amazon_marketplaces(
        api_key="YOUR_API_KEY",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchGetAmazonMarketplaces(apiKey, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-get-marketplaces`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchGetAmazonMarketplaces(
            'YOUR_API_KEY',
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-get-marketplaces"
PARAMS="api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-get-marketplaces",
    "data": {
        "result": "Sample data for Get Amazon Marketplaces",
        "details": {
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                
Use Case

Curate lists of top-selling products in a category to power recommendation engines or trend analysis dashboards.

Endpoint: /amazon-bestsellers

Method: GET

Parameters
Name Type Required Description
category_id text Yes Category ID (e.g., "electronics")
marketplaceId text Yes Marketplace ID
count number No Number of results (max 50, default 30)
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_get_amazon_bestsellers(api_key, category_id, marketplaceId, count, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-bestsellers"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
        "category_id": category_id,
        
        "marketplaceId": marketplaceId,
        
        "count": count,
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_get_amazon_bestsellers(
        api_key="YOUR_API_KEY",
        
        category_id="Category ID "electronics"",
        
        marketplaceId="A1PA6795UKMFR9",
        
        count="30",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchGetAmazonBestsellers(apiKey, category_id, marketplaceId, count, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-bestsellers`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
        category_id: category_id,
        
        marketplaceId: marketplaceId,
        
        count: count,
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchGetAmazonBestsellers(
            'YOUR_API_KEY',
            
            "Category ID "electronics"",
            
            "A1PA6795UKMFR9",
            
            "30",
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-bestsellers"
PARAMS="category_id=Category%20ID%20%22electronics%22&marketplaceId=A1PA6795UKMFR9&count=30&api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-bestsellers",
    "data": {
        "result": "Sample data for Get Amazon Bestsellers",
        "details": {
            
            "category_id": "Category ID "electronics"",
            
            "marketplaceId": "A1PA6795UKMFR9",
            
            "count": "30",
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                
Use Case

Identify deal-heavy categories to target promotional campaigns or optimize product listings for maximum visibility.

Endpoint: /amazon-deals-categories

Method: GET

Parameters
Name Type Required Description
marketplaceId text Yes Marketplace ID
api_key text Yes Your API key
Code Examples
Python
Node.js
cURL
import requests
from time import sleep

def fetch_get_amazon_deals_categories(api_key, marketplaceId, max_retries=3):
    # API endpoint and headers
    url = "https://sellermagnet-api.com/amazon-deals-categories"
    headers = {
        "Authorization": f"Bearer ${api_key}",
        "Content-Type": "application/json"
    }

    # Query parameters
    params = {
        
        "marketplaceId": marketplaceId,
        
    }

    # Retry logic for robust requests
    for attempt in range(max_retries):
        try:
            response = requests.get(url, headers=headers, params=params, timeout=10)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Attempt ${attempt + 1} failed: ${e}")
            if attempt + 1 == max_retries:
                raise Exception("Max retries reached")
            sleep(2 ** attempt)  # Exponential backoff
    return {}

# Example usage
try:
    result = fetch_get_amazon_deals_categories(
        api_key="YOUR_API_KEY",
        
        marketplaceId="A1PA6795UKMFR9",
        
    )
    print(result)
except Exception as e:
    print(f"Error: ${e}")
                                    
const axios = require('axios');

async function fetchGetAmazonDealsCategories(apiKey, marketplaceId, retries = 3) {
    const url = `https://sellermagnet-api.com/amazon-deals-categories`;
    const headers = {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    };
    const params = {
        
        marketplaceId: marketplaceId,
        
    };

    for (let attempt = 0; attempt < retries; attempt++) {
        try {
            const response = await axios.get(url, { headers, params, timeout: 10000 });
            return response.data;
        } catch (error) {
            console.error(`Attempt ${attempt + 1} failed: ${error.message}`);
            if (attempt + 1 === retries) throw new Error('Max retries reached');
            await new Promise(resolve => setTimeout(resolve, 2 ** attempt * 1000));
        }
    }
}

// Example usage
(async () => {
    try {
        const result = await fetchGetAmazonDealsCategories(
            'YOUR_API_KEY',
            
            "A1PA6795UKMFR9",
            
        );
        console.log(result);
    } catch (error) {
        console.error(`Error: ${error.message}`);
    }
})();
                                    
#!/bin/bash

API_KEY="YOUR_API_KEY"
URL="https://sellermagnet-api.com/amazon-deals-categories"
PARAMS="marketplaceId=A1PA6795UKMFR9&api_key=YOUR_API_KEY"

# Make the API request with retry logic
for i in {1..3}; do
    RESPONSE=$(curl -s -X GET "${URL}?${PARAMS}" \
        -H "Authorization: Bearer ${API_KEY}" \
        -H "Content-Type: application/json")
    if [ $? -eq 0 ]; then
        echo "${RESPONSE}"
        exit 0
    else
        echo "Attempt $i failed"
        sleep $((2 ** $i))
    fi
done
echo "Error: Max retries reached"
exit 1
                                    
Example Response
{
    "success": true,
    "endpoint": "/amazon-deals-categories",
    "data": {
        "result": "Sample data for Get Amazon Deals Categories",
        "details": {
            
            "marketplaceId": "A1PA6795UKMFR9",
            
            "api_key": "YOUR_API_KEY",
            
            "timestamp": "2025-06-06T13:59:00Z"
        }
    },
    "message": "Request processed successfully"
}
                                

Need Advanced Integration?

Contact our team for custom solutions, high-volume API access, or dedicated support tailored to your business.

Get in Touch