Skip to content

COGS (Cost of Goods Sold) Endpoints ​

Get Cost Periods ​

Retrieve cost periods for a specific product. You must specify the product by one of SKU, ASIN, or Parent ASIN.

GET /cogs/cost-periods

Query Parameters:

ParameterTypeRequiredDescription
skustringConditionalFilter by seller SKU
asinstringConditionalFilter by ASIN
parent_asinstringConditionalFilter by parent ASIN

At least one of sku, asin, or parent_asin is required. Plus an account selection parameter.

Example Request:

bash
curl -X GET "https://app.sellerlegend.com/api/cogs/cost-periods?account_title=My Store US&sku=MY-SKU-001" \
  -H "Authorization: Bearer {ACCESS_TOKEN}"

Response:

json
[
  {
    "from_date": "2025-01-01",
    "to_date": "2025-06-30",
    "cost_elements": [
      {
        "cost_element": "Unit Cost",
        "amount": 5.50,
        "currency": "USD",
        "provider": "Supplier ABC",
        "notes": "Bulk order Q1"
      },
      {
        "cost_element": "Shipping",
        "amount": 1.20,
        "currency": "USD",
        "provider": "FreightCo",
        "notes": "Sea freight"
      }
    ]
  }
]

Response Fields:

FieldTypeDescription
from_datestringStart date of the cost period (Y-m-d)
to_datestringEnd date of the cost period (Y-m-d)
cost_elementsarrayArray of cost elements for this period

Cost Element Fields:

FieldTypeDescription
cost_elementstringType of cost (e.g., Unit Cost, Shipping, Customs)
amountnumberCost amount per unit
currencystringCurrency code
providerstringSupplier or provider name
notesstringAdditional notes

Python SDK:

python
from sellerlegend_api import SellerLegendClient

client = SellerLegendClient(access_token="YOUR_ACCESS_TOKEN")

cost_periods = client.cogs.get_cost_periods(
    account_title="My Store US",
    sku="MY-SKU-001"
)

for period in cost_periods['data']:
    print(f"Period: {period['from_date']} to {period['to_date']}")
    for element in period['cost_elements']:
        print(f"  {element['cost_element']}: ${element['amount']}")

Update Cost Periods ​

Create or update cost periods for a product.

POST /cogs/cost-periods

Request Body:

FieldTypeRequiredDescription
skustringYesSeller SKU to update costs for
dataarrayYesArray of cost period objects

Cost Period Object:

FieldTypeRequiredDescription
from_datestringYesStart date (Y-m-d)
to_datestringYesEnd date (Y-m-d)
cost_elementsarrayYesArray of cost element objects

Cost Element Object:

FieldTypeRequiredDescription
cost_elementstringYesType of cost
total_amountnumberYesTotal amount for this cost element
currencystringYesCurrency code
unitsintegerNoNumber of units (to calculate per-unit cost)
amountnumberNoPer-unit amount
conversion_ratenumberNoCurrency conversion rate
providerstringNoSupplier or provider name
notesstringNoAdditional notes

Plus an account selection parameter.

Example Request:

bash
curl -X POST "https://app.sellerlegend.com/api/cogs/cost-periods?account_title=My Store US" \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "sku": "MY-SKU-001",
    "data": [
      {
        "from_date": "2025-01-01",
        "to_date": "2025-06-30",
        "cost_elements": [
          {
            "cost_element": "Unit Cost",
            "total_amount": 5500.00,
            "currency": "USD",
            "units": 1000,
            "amount": 5.50,
            "provider": "Supplier ABC",
            "notes": "Bulk order Q1"
          },
          {
            "cost_element": "Shipping",
            "total_amount": 1200.00,
            "currency": "USD",
            "units": 1000,
            "amount": 1.20,
            "provider": "FreightCo",
            "notes": "Sea freight"
          }
        ]
      }
    ]
  }'

Response:

json
{
  "status": "success",
  "message": "Cost periods updated successfully"
}

Python SDK:

python
response = client.cogs.update_cost_periods(
    account_title="My Store US",
    sku="MY-SKU-001",
    data=[
        {
            "dates": {
                "from_date": "2024-01-01",
                "to_date": "2024-12-31"
            },
            "cost_elements": [
                {
                    "cost_element": "Product Cost",
                    "provider": "Supplier Name",
                    "notes": "2024 pricing",
                    "total_amount": 25.00,
                    "currency": "USD",
                    "conversion_rate": "1.00",
                    "units": 1,
                    "amount": 25.00
                }
            ]
        }
    ]
)

print(f"Status: {response['status']}")

Delete Cost Periods ​

Delete all cost periods for the selected account.

DELETE /cogs/cost-periods

Parameters: An account selection parameter is required.

Example Request:

bash
curl -X DELETE "https://app.sellerlegend.com/api/cogs/cost-periods?account_title=My Store US" \
  -H "Authorization: Bearer {ACCESS_TOKEN}"

Response:

json
{
  "status": "success",
  "message": "Cost periods deleted successfully"
}

WARNING

This deletes all cost periods for the selected account. This action cannot be undone.