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-periodsQuery Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
sku | string | Conditional | Filter by seller SKU |
asin | string | Conditional | Filter by ASIN |
parent_asin | string | Conditional | Filter 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:
| Field | Type | Description |
|---|---|---|
from_date | string | Start date of the cost period (Y-m-d) |
to_date | string | End date of the cost period (Y-m-d) |
cost_elements | array | Array of cost elements for this period |
Cost Element Fields:
| Field | Type | Description |
|---|---|---|
cost_element | string | Type of cost (e.g., Unit Cost, Shipping, Customs) |
amount | number | Cost amount per unit |
currency | string | Currency code |
provider | string | Supplier or provider name |
notes | string | Additional 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-periodsRequest Body:
| Field | Type | Required | Description |
|---|---|---|---|
sku | string | Yes | Seller SKU to update costs for |
data | array | Yes | Array of cost period objects |
Cost Period Object:
| Field | Type | Required | Description |
|---|---|---|---|
from_date | string | Yes | Start date (Y-m-d) |
to_date | string | Yes | End date (Y-m-d) |
cost_elements | array | Yes | Array of cost element objects |
Cost Element Object:
| Field | Type | Required | Description |
|---|---|---|---|
cost_element | string | Yes | Type of cost |
total_amount | number | Yes | Total amount for this cost element |
currency | string | Yes | Currency code |
units | integer | No | Number of units (to calculate per-unit cost) |
amount | number | No | Per-unit amount |
conversion_rate | number | No | Currency conversion rate |
provider | string | No | Supplier or provider name |
notes | string | No | Additional 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-periodsParameters: 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.