# Get COGS (cost of goods) per line for one order

> Eto API reference for `GET /api/v1/orders/{shop_id}/{receipt_id}/costs`. Base URL `https://eto.tools/api/v1/`. Authenticate with the `X-Eto-API-Key` header.

Part of the [Eto API reference](https://eto.tools/dev/docs/). The full reference in one file is at [llms-full.txt](https://eto.tools/dev/docs/llms-full.txt); the machine-readable schema is at [openapi.json](https://eto.tools/dev/docs/openapi.json).

## GET /api/v1/orders/{shop_id}/{receipt_id}/costs

Get COGS (cost of goods) per line for one order

- Operation ID: `order_costs`
- Slug: `order-costs`
- Category: Orders
- Authentication: API key only. Reads or writes data Eto holds for your own account.
- HTML: https://eto.tools/dev/docs/#ep-order-costs
- Markdown: https://eto.tools/dev/docs/orders/order-costs.md

Read the COGS (cost of goods sold, what the ordered items cost YOU) for a single order, broken down line by line. This is the only place the per-item costs are readable; GET /api/v1/orders/{shop_id}/{receipt_id} carries just the order-level total as `profit.cogs_cents`. Served from Eto's own database: zero Etsy calls. READ ONLY: there is no write endpoint. Costs are entered on the Orders page at eto.tools/dashboard/orders, per line or in bulk with Import COGS. Each entry in `lines` carries the raw stored fields, `item_cost_cents` (the cost of the whole line, null when unset) and `unit_costs_cents` (an optional per-unit list, null when unset), plus the resolved figure Eto itself uses everywhere: `cost_cents`, which is the sum of `unit_costs_cents` when that list is set and `item_cost_cents` otherwise. `configured` is false for a line with neither set; such a line reports cost_cents 0 and is EXCLUDED from `cogs_cents`, so an unpriced item never reads as a free one. `cogs_cents` totals the configured lines, `lines_configured`/`lines_total` say how many of each there are, and `has_cogs_configured` is true only when every line has a cost: check it before quoting the total as the order's full COGS. All amounts are integer cents in the order's own `currency`. Answers 403 STORE_NOT_CONNECTED when the shop is not a connected store of yours, and 404 ORDER_NOT_FOUND when the receipt is not one of that store's orders.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `shop_id` | path | `integer` | yes | Connected shop id |
| `receipt_id` | path | `integer` | yes | Etsy receipt id, from orders_list |

### Request

```bash
curl -X GET "https://eto.tools/api/v1/orders/12345678/987654321/costs" \
  -H "X-Eto-API-Key: eto_your_key"
```

```python
import requests

url = "https://eto.tools/api/v1/orders/12345678/987654321/costs"
headers = {"X-Eto-API-Key": "eto_your_key"}

response = requests.get(url, headers=headers, timeout=120)
response.raise_for_status()
print(response.json())
```

```javascript
const url = "https://eto.tools/api/v1/orders/12345678/987654321/costs";

const response = await fetch(url, {
  method: "GET",
  headers: {
    "X-Eto-API-Key": "eto_your_key",
  },
});
if (!response.ok) throw new Error(`Eto API ${response.status}`);
const data = await response.json();
```

### Response

```json
{
  "receipt_id": 3456789012,
  "shop_id": "12345678",
  "currency": "GBP",
  "lines": [
    {
      "transaction_id": 4123456789,
      "listing_id": 1789456123,
      "sku": "TEE-BLK-M",
      "title": "Organic cotton t-shirt",
      "quantity": 2,
      "item_cost_cents": 900,
      "unit_costs_cents": [450, 520],
      "cost_cents": 970,
      "configured": true
    },
    {
      "transaction_id": 4123456790,
      "listing_id": 1789456124,
      "sku": "MUG-01",
      "title": "Enamel mug",
      "quantity": 1,
      "item_cost_cents": null,
      "unit_costs_cents": null,
      "cost_cents": 0,
      "configured": false
    }
  ],
  "cogs_cents": 970,
  "lines_configured": 1,
  "lines_total": 2,
  "has_cogs_configured": false
}
```

### Errors

Failures answer with the shared error body described in the Errors section: `{"error": {"code", "status", "message", "hint", "docs"}}`. Branch on `code`, not on the message.
