---
title: "The lines of one count, with the difference"
method: GET
path: "/api/v1/stocktakes/{stocktake_id}/table"
tags: ["stocktakes"]
---

# The lines of one count, with the difference

`GET /api/v1/stocktakes/{stocktake_id}/table`

## Request

- Base URL: `https://api.app.tightly.io`
- URL: `https://api.app.tightly.io/api/v1/stocktakes/{stocktake_id}/table`
- Auth: HTTP bearer

One page of the lines in a count. Each row is one variant at one location: `system_quantity` (the level snapshotted when the count was created), `counted_quantity`, `variance` and `variance_value`, with `sku`, `product_title`, `variant_title`, `location_name` and `unit_cost` for display.

`counted_quantity`, `variance` and `variance_value` are null on a line nobody has counted yet. That null is not a zero: a line counted at exactly system stock carries `variance: 0`, and the two are opposite statements about a shelf. `line_scope` narrows the page: `differences` returns only counted lines whose count differs from system (so it excludes the matched lines AND the uncounted ones), and `uncounted` returns only the lines nobody has counted, which is the work left to do on a count part way through. `variance_only=true` is the older spelling of `line_scope=differences` and still works.

`unit_cost` is null where no cost is on file, and a counted line with no cost is valued at zero, so `variance_value: 0` beside a null `unit_cost` means not priced rather than no money at stake.

`search` matches product title and SKU. `sort_args` takes `product_title`, `sku`, `location_name`, `system_quantity`, `counted_quantity`, `variance` or `variance_value`, prefixed `-` for descending. `limit` defaults to 25. For variance measured across posted counts and attributed to a supplier rather than listed line by line, use get_stock_variance_by_supplier.

Scope: `stocktakes:read`.

## Path parameters

- `stocktake_id` integer, required

## Query parameters

- `search` string
- `limit` integer
- `offset` integer
- `line_scope` 'all' | 'differences' | 'uncounted'
- `variance_only` boolean
- `sort_args` string

## Headers

- `Tightly-Version` string

## Response `200`

One page of the count's lines, system against counted.

- object
  - `data` GetStocktakeLinesTablePayload
    - `filtered_max_size` integer, required
    - `max_size` integer, required
    - `offset` integer, required
    - `rows` StocktakeLineRow[], required
      - `counted_quantity` integer, nullable
      - `id` string, required
      - `location_id` string, required
      - `location_name` string, nullable
      - `product_title` string, nullable
      - `sku` string, nullable
      - `system_quantity` integer, required
      - `unit_cost` number, nullable
      - `variance` integer, nullable
      - `variance_value` number, nullable
      - `variant_id` string, required
      - `variant_image` string, nullable
      - `variant_title` string, nullable
    - `size` integer, required
  - `message` object: severity, service and desc.

## Other responses

- `401`: No usable key: malformed, unknown, revoked, expired or stopped. One refusal covers all five, telling a caller which is which maps the surface for them. A request with no Authorization header at all is refused 400 before any key is looked for.
- `403`: The key may not reach this operation. `scope_missing` when the key does not hold Stocktakes; `organization_mismatch` when the path names an organisation that is not the key's; `ip_not_allowed` when the caller's address is outside the key's allowlist.
- `404`: No count with this id in this organisation.
- `429`: The key has spent its allowance for this minute. 600 reads and 120 writes a minute, counted per key, refused calls included. `Retry-After` says how long to wait.
- `503`: The database is briefly out of reach, which is what a failover or a full connection pool looks like from outside. Wait the seconds `Retry-After` names and send the request again. A read is safe to repeat. A write is not, because the connection was lost in the middle of it, so read the object back before sending it a second time. Branch on the status rather than on `code`, which is `POSTGRES_UNAVAILABLE` from one of the two seams that raise this and `SERVICE_UNAVAILABLE` from the other.

---

[API](https://skmtc.dev/tightly/apis/tightly-api.md) · [All operations](https://skmtc.dev/tightly/apis/tightly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/tightly/apis/tightly-api/revisions/199f7eb35afb?raw)
