> ## Documentation Index
> Fetch the complete documentation index at: https://docs.merchantspring.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Profitability

> Retrieve store and product profit & loss, and manage unit COGS.

The Profitability endpoints return profit & loss (P\&L) data and let you manage the unit cost of goods sold (COGS) that feeds those calculations.

## Profit & loss

Store P\&L:

* [`POST /profitability/storeProfitAndLoss`](/api-reference/profitability/get-a-store-profit-and-loss) — a store-level P\&L: total revenue, total expenses, and the cost breakdown (fees, COGS, advertising).

Product P\&L:

* [`POST /profitability/productProfitAndLoss`](/api-reference/profitability/retrieve-single-or-multiple-product-profit-and-loss-details) — P\&L for one or more products.

See each endpoint's reference page for the exact request body and response schema.

## Managing unit COGS

Runs as an **asynchronous job** — submit the update, then poll for completion.

<Steps>
  <Step title="Submit the update">
    [`POST /profitability/directCosts`](/api-reference/profitability/update-unit-cogs) — submit the unit COGS to update. The response identifies the job.
  </Step>

  <Step title="Poll the job">
    [`GET /profitability/directCostsJobStatus`](/api-reference/profitability/get-the-status-of-a-unit-cogs-update-job) — check the status until the job is complete.
  </Step>
</Steps>

```bash theme={null}
# 1. Submit the COGS update
curl -X POST "https://mm-api.merchantspring.io/profitability/directCosts" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "channelId": "YOUR_CHANNEL_ID",
  "merchantId": "YOUR_MERCHANT_ID",
  "fromDate": 0,
  "directCosts": [
    {
      "sellerSku": "string",
      "cogs": 0,
      "cogsCurrency": "string",
      "shippingCost": 0,
      "shippingCostCurrency": "string"
    }
  ]
}'

# 2. Poll for completion — use the jobId from step 1; repeat until jobStatus is COMPLETED or FAILED
curl -X GET "https://mm-api.merchantspring.io/profitability/directCostsJobStatus?merchantId=YOUR_MERCHANT_ID&channelId=YOUR_CHANNEL_ID&jobId=YOUR_JOB_ID" \
  -H "x-api-key: YOUR_API_KEY"
```

<Note>
  Updated COGS values are reflected in subsequent profitability and channel-profit-and-loss results once the job completes.
</Note>
