Developers

Connect a shop built by hand

Pitra reads a shop built by hand through one endpoint you add to it: one secret, three functions, reading only. The shop’s owner sends you a page that tests each part as you build it.

One endpoint

Every call is a POST to the same address, with the function’s name in the body and the secret as a bearer token. Your endpoint answers with JSON.

POST  https://your-shop.com/api/pitra

    authorization: Bearer $PITRA_SECRET
    content-type: application/json

    { "functionName": "pitra_query",
      "parameters": { "kind": "orders", "cursor": null,
                      "updated_since": "2026-10-10T00:00:00Z", "limit": 50 } }

One secret

The page the owner sends you shows the secret once. Keep it in the server’s environment as PITRA_SECRET, never in the browser, and refuse any call that does not carry it with 401. A new one can be made on the same page, and the old one stops working at once.

Three functions

FunctionTakesAnswers
pitra_bootstrapNothingThe shop’s name, its currency (ISO 4217), its time zone (IANA), and "contract": 1
pitra_querykind (products, orders or customers), cursor, updated_since, limit (at most 50)items, and next_cursor, or null after the last page
pitra_query_reportfrom and to: dates in the shop’s time zone, both includedorders, the paid orders placed in those days that aren’t cancelled; takings, their total minus refunded; currency

What each item carries

A product

id, title, updated_at and variants (at least one). Optional: status (active, draft or archived), description, url, images.

A variant

id, price, and stock: a whole number, or null when it isn’t tracked. Optional: title, sku, compare_at_price, cost, options.

A customer

id, created_at and updated_at. Optional: name, email, phone, accepts_marketing.

An order

id, number, placed_at, updated_at, status (open, completed or cancelled), payment (cash_on_delivery, online or bank_transfer), paid, fulfillment (unfulfilled, in_progress, fulfilled, delivered or cancelled), subtotal, total and lines. Optional: customer_id, discount, tax, shipping, refunded, area, offer_codes.

A line

id, title, quantity and price. Optional: variant_id, sku, options.

Money is always a decimal string in the shop’s currency, like "12.500". Times carry their zone, like "2026-10-10T14:00:00Z". Every id is unique across the whole shop: a variant’s id is its own row, not its place in the product, and the same for an order’s lines.

How Pitra finds it

  1. The address saved on the page the owner sent you.
  2. The endpoint named in https://your-shop.com/.well-known/pitra.json, which must be https.
  3. https://your-shop.com/api/pitra.

Pitra asks in that order until pitra_bootstrap answers in the right shape. A page that answers every path with your app’s HTML is not an answer.

Four rules

Reading only

No function writes anything. Pitra never asks the shop to change, and your endpoint should do nothing but read.

Refuse strangers

A call without the secret, or with a wrong one, gets 401. Pitra checks this itself, with no secret and with a wrong one.

A cash order is owed until it is delivered

A cash on delivery order says "paid": false until the courier hands it over. Counting it before then puts money in the books nobody has collected.

Answer within 10 seconds

Each call gets 10 seconds and at most 1 MB. Page the lists, 50 items at a time.

Sent here by a shop?

The owner’s link opens a page written for their shop: the brief, the secret, and a checker that runs six checks as you build and says exactly what to change.

Talk to us about connecting