Developers
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.
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 } }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.
| Function | Takes | Answers |
|---|---|---|
pitra_bootstrap | Nothing | The shop’s name, its currency (ISO 4217), its time zone (IANA), and "contract": 1 |
pitra_query | kind (products, orders or customers), cursor, updated_since, limit (at most 50) | items, and next_cursor, or null after the last page |
pitra_query_report | from and to: dates in the shop’s time zone, both included | orders, the paid orders placed in those days that aren’t cancelled; takings, their total minus refunded; currency |
id, title, updated_at and variants (at least one). Optional: status (active, draft or archived), description, url, images.
id, price, and stock: a whole number, or null when it isn’t tracked. Optional: title, sku, compare_at_price, cost, options.
id, created_at and updated_at. Optional: name, email, phone, accepts_marketing.
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.
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.
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.
No function writes anything. Pitra never asks the shop to change, and your endpoint should do nothing but read.
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 on delivery order says "paid": false until the courier hands it over. Counting it before then puts money in the books nobody has collected.
Each call gets 10 seconds and at most 1 MB. Page the lists, 50 items at a time.
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