POST
/
v1
/
cogs_entries
curl --location --request POST 'https://api.stateset.com/v1/cogs_entries' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <token>' \
--data-raw '{
    "period": "2024-Q1",
    "product": "Widget A",
    "quantity_sold": 100,
    "cogs": 5000,
    "average_cost": 50,
    "ending_inventory_quantity": 500,
    "ending_inventory_value": 25000,
    "currency": "USD",
    "unit_selling_price": 75,
    "gross_sales": 7500,
    "cogs_method": "FIFO",
    "sale_date": "2024-03-15"
}'
{
  "id": 123,
  "message": "<string>"
}

Body

period
string
required

The accounting period for the COGS entry

product
string
required

The product associated with the COGS entry

quantity_sold
integer
required

The quantity of the product sold

cogs
number
required

The Cost of Goods Sold amount

average_cost
number
required

The average cost per unit

ending_inventory_quantity
number
required

The quantity of inventory remaining at the end of the period

ending_inventory_value
number
required

The value of the ending inventory

currency
string
required

The currency used for the financial calculations

exchange_rate_id
integer

Identifier for the related exchange rate

sale_transaction_id
integer

Identifier for the related sale transaction

unit_selling_price
number
required

The selling price per unit

gross_sales
number
required

The total gross sales amount

cogs_method
string
required

The method used to calculate COGS

product_category
string

The category of the product

sales_channel
string

The channel through which the sale was made

customer_segment
string

The segment of the customer who made the purchase

sale_date
string
required

The date of the sale

is_return
boolean

Indicates whether this entry is for a return

return_reason
string

The reason for the return, if applicable

cost_center
string

The cost center associated with the COGS entry

supplier_id
integer

Identifier for the related supplier

Response

id
integer

Unique identifier for the newly created COGS entry

message
string

A success message confirming the creation of the COGS entry

curl --location --request POST 'https://api.stateset.com/v1/cogs_entries' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <token>' \
--data-raw '{
    "period": "2024-Q1",
    "product": "Widget A",
    "quantity_sold": 100,
    "cogs": 5000,
    "average_cost": 50,
    "ending_inventory_quantity": 500,
    "ending_inventory_value": 25000,
    "currency": "USD",
    "unit_selling_price": 75,
    "gross_sales": 7500,
    "cogs_method": "FIFO",
    "sale_date": "2024-03-15"
}'
import requests
import json

url = "https://api.stateset.com/v1/cogs_entries"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Token <token>"
}
data = {
    "period": "2024-Q1",
    "product": "Widget A",
    "quantity_sold": 100,
    "cogs": 5000,
    "average_cost": 50,
    "ending_inventory_quantity": 500,
    "ending_inventory_value": 25000,
    "currency": "USD",
    "unit_selling_price": 75,
    "gross_sales": 7500,
    "cogs_method": "FIFO",
    "sale_date": "2024-03-15"
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())