# POST /v1/shops/{id}/netvisor/reports

> Read the shop's Netvisor and file it as a report.

Markdown twin of https://panlytics.net/developers/api/netvisor-report (last updated 2026-10-25). Every page of the Panlytics developer docs is listed at https://panlytics.net/developers/llms.txt, and all of them are in one file at https://panlytics.net/developers/llms-full.txt. The site guide is https://panlytics.net/llms.txt.

## What it does

Reads the source again (never a plan you send back) and files the result as the category's next report, through the same pipeline as an upload. An earlier report read from the same source on the same day is replaced. Needs the sheet ability over the whole shop, and is written to the audit log. Read the plan first and tell the person its warnings. Send an Idempotency-Key header so a retry never files it twice.

## Who may call it

A key whose maker's role holds `sheet` (edit the sheet and upload a report), after the fence, for the shop or category it names.

## Request

```http
POST https://panlytics.net/api/v1/shops/{id}/netvisor/reports
```

### Parameters

| Name | In | Type | Required | What it is |
| --- | --- | --- | --- | --- |
| `id` | path | integer | Yes | The shop's id. |
| `Authorization` | header | string | Yes | Bearer, a space, then the key. |
| `Idempotency-Key` | header | string | No | Any string up to 255 characters, new for each new request. The same key with the same request within 24 hours answers with the first answer again and does nothing twice. |

### Body

Sent as `application/json`.

| Field | Type | Required | What it is |
| --- | --- | --- | --- |
| `productGroup` | string | No | Only this Netvisor product group. Left out, the whole company. |

> [!TIP]
> Send an `Idempotency-Key` header with a new value for each new request. A retry with the same key and the same request answers with the first answer and does nothing twice. See [Idempotency and retries](https://panlytics.net/developers/api#idempotency-and-retries).

### Example request

```bash title="curl"
curl -X POST https://panlytics.net/api/v1/shops/12/netvisor/reports \
  -H "Authorization: Bearer $PANLYTICS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "productGroup": "Beverages"
}'
```
```python title="Python"
import os
import uuid

import requests

response = requests.post(
    "https://panlytics.net/api/v1/shops/12/netvisor/reports",
    headers={"Authorization": f"Bearer {os.environ['PANLYTICS_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
    json={
      "productGroup": "Beverages"
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
```
```typescript title="TypeScript"
const response = await fetch("https://panlytics.net/api/v1/shops/12/netvisor/reports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PANLYTICS_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "productGroup": "Beverages"
  }),
});
if (!response.ok) throw new Error(`Panlytics answered ${response.status}`);
console.log(await response.json());
```

## Response

`201`: Created. The answer is what was made, as JSON.

| Field | Type | Always there | What it is |
| --- | --- | --- | --- |
| `reportId` | integer | Yes | The new report's id. |
| `categoryId` | integer or null | Yes | The category it was filed under. |
| `shopId` | integer | Yes | The shop. |
| `category` | string | Yes | The category's name. |
| `rows` | integer | Yes | How many products the report holds. |
| `fixes` | integer | Yes | How many values the cleaner repaired or worked out on the way in. |
| `plan` | object | Yes | What was read, as the plan describes it. |
| `plan.companyName` | string | Yes | The Netvisor company's name. |
| `plan.windowDays` | integer | Yes | Days the report covers. Never longer than the source will serve. |
| `plan.periodAsked` | integer | Yes | The period the category was set up with, when it differs. |
| `plan.category` | string | Yes | The category the report would be filed under. |
| `plan.coverage` | object | Yes | How much of what the report needs the source holds. |
| `plan.coverage.seen` | integer | Yes | Products the source returned, before anything was left out. |
| `plan.coverage.notForSale` | integer | Yes | Left out because they are drafts or archived. |
| `plan.coverage.rows` | integer | Yes | Rows the report will carry. |
| `plan.coverage.withBarcode` | integer | Yes | Rows with a barcode. |
| `plan.coverage.withCost` | integer | Yes | Rows with a cost price. |
| `plan.coverage.withStockTracking` | integer | Yes | Rows whose stock is tracked. |
| `plan.coverage.withSales` | integer | Yes | Rows that sold at least one piece in the period. |
| `plan.coverage.withAvailability` | integer | Yes | Rows with a measured count of days out of stock. |
| `plan.availability` | object | Yes | Whether days out of stock were measured. Fewer days than the window make every count a floor. |
| `plan.availability.measured` | boolean | Yes | True when days out of stock were measured. |
| `plan.availability.daysObserved` | integer | Yes | Over how many days of history. |
| `plan.availability.firstDay` | string or null | Yes | The first day observed, or null. |
| `plan.warnings[]` | string[] | Yes | Everything to know before trusting the figures, in full sentences, in the order they matter. |
| `plan.groups[]` | object[] | Yes | Every product group on offer, with its count of products. |
| `plan.groups[].label` | string | Yes | The product group. |
| `plan.groups[].products` | integer | Yes | Its products. |
| `plan.invoices` | integer | Yes | Sales invoices in the window. |

### Example response

```json title="201"
{
  "reportId": 311,
  "categoryId": 40,
  "shopId": 12,
  "category": "Beverages",
  "rows": 412,
  "fixes": 37,
  "plan": {
    "companyName": "Harbour Oy",
    "category": "Beverages",
    "groups": [
      {
        "label": "Beverages",
        "products": 412
      }
    ],
    "invoices": 920,
    "windowDays": 30,
    "periodAsked": 30,
    "coverage": {
      "seen": 420,
      "notForSale": 8,
      "rows": 412,
      "withBarcode": 400,
      "withCost": 380,
      "withStockTracking": 412,
      "withSales": 350,
      "withAvailability": 412
    },
    "availability": {
      "measured": true,
      "daysObserved": 30,
      "firstDay": "2026-09-27"
    },
    "warnings": [
      "Waste is not recorded in this source, so the figures assume none."
    ]
  }
}
```

## Errors

A refusal is JSON with a `code`, a sentence in `error`, and a `requestId` when the fault is ours. Read the code, not the sentence. Every code is listed on [Errors](https://panlytics.net/developers/security/errors).

| Status | Code | When | What to do |
| --- | --- | --- | --- |
| 400 | `api.invalid` | A path id, a query parameter, a header or a body field is missing or not valid. `detail` names the field. | Read that endpoint in the API reference, correct the field and call again. |
| 401 | `api.key_missing` | The call had no Authorization header. | Send the key in the Authorization header as Bearer, then call again. |
| 401 | `api.key_refused` | The key is wrong, revoked, past its end, or its maker or company no longer allows it (developer mode off, the maker removed or switched off, or the maker's role lost the developer ability). | Ask the person who gave you the key to make a new one. |
| 401 | `api.wrong_key_kind` | This key does not open these endpoints. | Use the key these endpoints were made for, or ask the person who gave you the key. |
| 403 | `refused` | The key's maker may not do this here: their role lacks the ability, or the shop or category is outside their reach. | Ask the CEO for a role that allows it, or call it for a shop or category the role reaches. |
| 403 | `auth.not_fresh` | This step needs you to prove it is you. | Confirm your password or passkey, then try again. |
| 403 | `refused.demo` | The key belongs to a shared demo account, which may not change anything. | Use a key made in a real company account. |
| 404 | `not_found.said` | Nothing with that id in the key's company. An id of another company answers the same. | Check the id. List the shop or category it belongs to and take the id from there. |
| 409 | `source.none` | No source is connected to this shop. | Connect one from Sources, then try again. |
| 409 | `report.empty` | That came back with nothing in it. | Check the source has data for the period, then try again. |
| 409 | `api.idempotency_conflict` | That Idempotency-Key was sent before with a different request. | Send a new key with a new request, or send the first request again unchanged. |
| 409 | `api.idempotency_busy` | The first request with that Idempotency-Key is still running. | Wait a few seconds, then send it again. |
| 422 | `source.said` |  | Check the source's settings, then try again. |
| 429 | `api.rate_limited` | The key made more than 120 calls in this minute. Wait the seconds in Retry-After. | Wait the seconds in Retry-After, then call again. |
| 429 | `source.busy` | That is a lot of reads from this source in one hour. | Give it a few minutes and press again. |
| 500 | `server` | Something failed on our side. The answer carries a requestId to quote. | Try again in a minute; if it keeps happening, report it. |
| 502 | `report.failed` | That report could not be worked out. | Try again; if it keeps happening, report it. |
| 503 | `developer.unavailable` | API keys are not set up on this deployment yet. | Report it, and we will switch them on. |
