Guides

Make a shop and a category

Open a new shop through the API and start its first category with a report, in two calls.

Who may do it

Opening a shop needs two things on the key's maker's role:

  1. Open, rename and archive shops, and connect their systems, which is a Manager ability.
  2. A scope that covers every shop. A role limited to chosen shops cannot open a new one, because the new shop would sit outside it.

The CEO has both. Anybody else needs a role the CEO or a Manager set up that way.

1. Open the shop

curl -X POST https://panlytics.net/api/v1/shops \
  -H "Authorization: Bearer $PANLYTICS_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: open-harbour-2" \
  -d '{ "name": "Harbour 2", "city": "Helsinki" }'

name and city are required; branch and country are optional. The answer is 201 with the new shop:

201
{
  "id": 31,
  "name": "Harbour 2",
  "branch": "",
  "city": "Helsinki",
  "country": "Finland",
  "createdAt": "2026-10-25T09:00:00.000Z"
}

The shop appears in the app at once, for everybody whose role covers every shop. A retry with the same Idempotency-Key answers with this same shop instead of opening a second one. POST /v1/shops has every field and refusal.

2. Start its first category

A category starts with a report. Upload the shop's sales export with a category name and the days it covers, as Upload a report shows. Starting a category needs Edit the sheet and upload a report over the whole shop:

curl
curl -X POST https://panlytics.net/api/v1/shops/31/reports \
  -H "Authorization: Bearer $PANLYTICS_KEY" \
  -H "Idempotency-Key: harbour-2-soft-drinks" \
  -F "category=Soft drinks" \
  -F "periodDays=30" \
  -F "file=@soft-drinks.xlsx"

To rename the category later, or change the settings its figures use, send PATCH /v1/categories/{id}. See Changing a category safely.

Before you call

A shop cannot be deleted through the API. To remove one opened by mistake, a person archives it in the app. A shared demo account cannot open a shop (403 refused.demo).