Enquiries, reviews, marketing

Enquiries and answering them, comments and reviews with moderation, gift cards, bonus points, promotions and pages.

The resources on this page exist only when their module is installed. Whether a resource is there is visible in the shop’s openapi.json; without its module the address answers 404 No such resource.

Enquiries

The Enquiries module (torgash.enquiries), permission enquiries.manage. Everything a visitor asked: a callback, a product question, “tell me when it is back”, a message, the shop’s own form. A good job for a support agent.

GET   /api/v2/admin/enquiries
GET   /api/v2/admin/enquiries/{id}
PATCH /api/v2/admin/enquiries/{id}                   status, manager_id, notes
POST  /api/v2/admin/enquiries/{id}/actions/reply     answer
POST  /api/v2/admin/enquiries/{id}/actions/close     end the conversation

Filters:

ParameterWhat it does
awaiting_reply=1the queue: open enquiries the shop owes an answer to — nobody has answered yet, or the customer spoke last
statusnew, in_progress, done, rejected; several, comma-separated: status=new,in_progress
kindthe kind: callback, product_question, back_in_stock, message, form.<code> for the shop’s own form
subject_typewhat it is about (product and so on)
updated_afterchanged since a moment

Sorts: order[id], order[created_at], order[updated_at], order[answered_at].

{ "data": {
    "id": 1, "kind": "product_question", "kind_label": "Question about a product",
    "status": "new",
    "name": "Ivan Petrenko", "phone": "+380675550128", "email": "ivan@example.com",
    "subject": { "type": "product", "id": 2, "label": "Phone Beta 128GB",
                 "url": "https://shop.example/product/phone-beta-128" },
    "answers": [
      { "key": "name", "label": "Your name", "value": "Ivan Petrenko" },
      { "key": "question", "label": "Your question", "value": "Does it work with eSIM?" }
    ],
    "cart": null, "customer_ref": "fee6e105b4", "user_id": null, "locale": "en",
    "manager": null, "notes": null, "answered_at": null,
    "awaiting_reply": true, "can_be_answered": true, "locked": false,
    "attachments": [],
    "messages": [],
    "created_at": "2026-09-09T10:55:00+03:00", "updated_at": "…" } }
FieldWhat it is
answers[]what the person typed into the form — under the labels as they read then
messages[]the conversation after that, oldest first: author (shop / customer), author_name, body, attachments
subjectwhat it is about (a product, an order), when it is about anything
cartwhat was in the basket at the moment of asking
customer_refthe same reference this person’s orders carry — a CRM can treat both as one counterparty
awaiting_replythe shop owes an answer
can_be_answeredan answer will reach them: they left an email or have an account. false for a phone-only callback — call them; a reply would only be a line in the log
lockedthe conversation is over, nobody can add to it
attachments[]photos sent with the enquiry; the links are signed and open without signing in

Answer — the same code as the reply box in the admin: it stamps when the wait ended, moves a new enquiry into progress, makes whoever answered its manager (when it had none) and emails the customer.

curl -s -X POST https://shop.example/api/v2/admin/enquiries/1/actions/reply \
     -H "Authorization: Bearer $TG_TOKEN" -H 'Content-Type: application/json' \
     -d '{"body": "Yes, it supports eSIM. Shall we hold one for you?"}'

body is plain text, as the customer will read it.

Close — POST …/actions/close with no body: the enquiry is marked answered and locked; neither the customer nor the shop can add to it. Only the admin can reopen it.

PATCH writes status (new / in_progress / done / rejected), manager_id (a staff member’s id or null) and notes (an internal note the customer never sees). Rejecting (rejected) also locks the conversation.

Comments

The Comments module (torgash.comments), permission comments.moderate. Comments on pages and blog articles.

GET   /api/v2/admin/comments
GET   /api/v2/admin/comments/{id}
PATCH /api/v2/admin/comments/{id}         status

Filters: status (pending / approved / rejected), target_type (page, blog_post), target_id, updated_after. Fields: target_type, target_id, target (what it is about, in words), url, parent_id (a reply; threads are one level deep), author_name, author_email (never shown on the site), user_id, body, status, is_staff.

Moderation is PATCH {"status": "approved"} or "rejected"; the text is the author’s and is not changed.

Product reviews

The Reviews module (torgash.reviews), permission reviews.moderate.

GET   /api/v2/admin/reviews
GET   /api/v2/admin/reviews/{id}
PATCH /api/v2/admin/reviews/{id}                   status, moderation_note
POST  /api/v2/admin/reviews/{id}/actions/reply     the shop's public answer

Filters: status (pending / published / rejected, comma-separated is fine), product_id, verified=1 (bought the product), external_id, only (reviews — reviews alone, replies — answers alone; without it — both, as a moderation queue wants), updated_after. Sorts: order[id], order[created_at], order[updated_at], order[rating], order[helpful_yes].

{ "data": {
    "id": 1, "external_id": null, "product_id": 2, "product_sku": "ST-1002",
    "parent_id": null, "status": "pending",
    "author_name": "Anna", "user_id": 4, "is_staff": false, "verified": true,
    "rating": 4.5, "recommend": "yes",
    "body": "A month in — great for the money.",
    "pros": "Holds its charge", "cons": "Slippery case",
    "criteria": { "quality": 5, "value": 4 },
    "helpful_yes": 3, "helpful_no": 0,
    "photos": [ { "id": 7, "url": "https://shop.example/storage/…/photo.webp" } ],
    "replies": [ { "id": 3, "author_name": "The shop", "is_staff": true,
                   "body": "Thank you! A case is on its way to you.", "created_at": "…" } ],
    "moderation_note": null, "locale": "en", "created_at": "…", "updated_at": "…" } }
  • rating — 1 to 5; when the shop rates by criteria it is computed from criteria (keyed by the criteria’s codes).
  • verified — the author had bought the product when writing; a later cancellation does not retract it.
  • Only published reviews count towards a product’s average. PATCH {"status": "published"} goes through the module’s own moderation, so the product’s average is recomputed.
  • Answer ({"body": "…"}, plain text) — the answer is badged as the shop’s, the review is published (half a conversation on a page is worse than none) and the author is emailed.

Gift cards

The Gift cards module (torgash.giftcards), permission giftcards.manage.

GET   /api/v2/admin/giftcards
POST  /api/v2/admin/giftcards                      issue a card
GET   /api/v2/admin/giftcards/{id}
PATCH /api/v2/admin/giftcards/{id}                 expires_at, recipient_name, recipient_email, note
POST  /api/v2/admin/giftcards/{id}/actions/adjust     correct the balance
POST  /api/v2/admin/giftcards/{id}/actions/activate   activate a printed card
POST  /api/v2/admin/giftcards/{id}/actions/disable    switch it off
POST  /api/v2/admin/giftcards/{id}/actions/enable     switch it on
POST  /api/v2/admin/giftcards/{id}/actions/send       send the letter (again)

Filters: state (active / pending / redeemed / expired / disabled — worked out from the status, the balance and the date), code (the whole code in any spelling), batch (a printed batch), owner (an account id), order (the id of the order that bought it), updated_after. Sorts: order[id], order[balance], order[expires_at], order[created_at], order[updated_at].

{ "data": {
    "id": 1, "last4": "TXYZ", "state": "active",
    "initial_amount": "500.00", "balance": "350.00",
    "expires_at": "2027-10-30T23:59:59+03:00", "owner_user_id": null,
    "recipient": { "name": "Irina", "email": "irina@example.com", "sender": "The shop",
                   "deliver_at": null, "delivered_at": "2026-10-30T05:15:00+03:00" },
    "source": "issued", "order_id": null, "batch": null, "rules": null,
    "url": "https://shop.example/gift/h2XkVXV9…",
    "entries": [
      { "type": "issue", "amount": "500.00", "order_id": null, "note": null, "by": "Admin", "at": "…" },
      { "type": "redeem", "amount": "-150.00", "order_id": 31, "note": null, "by": null, "at": "…" }
    ] } }

The balance is the sum of the history (entries); it cannot be written, only corrected by an action. A card’s code is not shown in answers (last4 is how to name it), except once — in the answer to issuing it.

Issue:

curl -s -X POST https://shop.example/api/v2/admin/giftcards \
     -H "Authorization: Bearer $TG_TOKEN" -H 'Content-Type: application/json' \
     -d '{"amount": "500.00", "recipient_name": "Irina", "recipient_email": "irina@example.com",
          "sender_name": "The shop team", "message": "Happy birthday!",
          "deliver_at": "2026-11-15T09:00:00+02:00"}'
FieldWhat it is
amountthe value, a decimal string in the books currency ("500.00")
expires_atISO 8601; absent — the shop’s default term, null — never
recipient_name, recipient_email, sender_name, messageto whom and from whom; the letter goes to recipient_email at once or at deliver_at
owner_user_idput the card in an account: only it can spend the card
ruleslimits: categories (ids, subtrees included), shipping (may it pay for delivery), max_percent (no more than a share of the order), min_order (a decimal string)

The answer is 201 and the card with a code field: save it now, the API will not show it again.

Correct the balance: {"amount": "-50.00", "reason": "Part of the order returned"} — signed; the customer sees reason in the card’s history. It never goes below zero. activate — a printed card handed over at the till becomes money from now on. disable switches it off keeping the balance, enable switches it back on. PATCH expires_at moved forward revives an expired card.

Bonus points

The Points module (torgash.points), permission points.manage. A row is a customer’s account; its key is their user id.

GET  /api/v2/admin/points
GET  /api/v2/admin/points/{user_id}
POST /api/v2/admin/points/{user_id}/actions/adjust

Filters: min_balance, updated_after; sorts: order[balance], order[updated_at].

{ "data": { "user_id": 4, "balance": 500, "waiting": 120,
            "entries": [ { "type": "adjust", "points": 500, "order_id": null,
                           "note": "Welcome points", "expires_at": null, "at": "…" } ] } }

waiting — points of orders not yet in a crediting status. Give or take by hand: {"points": 200, "reason": "For a review with a photo"} (negative takes away; never below zero; the customer sees reason).

Promotions

The Promotions module (torgash.promotions), permission promotions.manage. Automatic discounts: the catalog zone (a product’s price changes) and cart (money off the order, free delivery, a gift). Conditions and tiers are built in the admin; through the API a promotion is switched on, scheduled and capped.

GET   /api/v2/admin/promotions
GET   /api/v2/admin/promotions/{id}
PATCH /api/v2/admin/promotions/{id}      enabled, starts_at, ends_at, usage_limit, priority

Filters: zone, enabled, status (running / paused / scheduled / ended / off — the switch, the dates and the repeating window together), updated_after.

The main fields:

FieldWhat it is
statusrunning; paused — within its dates but outside its repeating window; scheduled — not started yet; ended; off — switched off
schedulethe repeating window in words (“Mon, Fri 18:00–22:00”) or null
open_untilwhat a countdown counts to
combinereplace (competes on priority), stack_add (adds up), stack_multiply (applies to the already reduced price)
prioritylower goes first when two replace promotions want one product
usage_limit, used_counta cap on uses (cart zone only) and how many times it was used; the count may pass the cap by one under simultaneous orders
applies_when[]where it runs (storefront, language, who is looking) in words; empty — everywhere. Judged for the storefront named in X-Storefront
tiers[]tried top to bottom, the first match wins: match, discount_type, discount_value, discount (in words), conditions (in words)

Schedule a sale:

{ "enabled": true, "starts_at": "2026-11-27T00:00:00+02:00", "ends_at": "2026-11-30T23:59:59+02:00" }

starts_at: null — “already”, ends_at: null — “until switched off”, usage_limit: null — no cap (this does not reset used_count).

Pages

The Pages module (torgash.pages), permission pages.manage. “About us”, “Delivery and payment”, “Privacy policy”.

GET   /api/v2/admin/pages
GET   /api/v2/admin/pages/{id | slug}
PATCH /api/v2/admin/pages/{id | slug}      enabled, in_sitemap, position

Filters: enabled, in_sitemap, updated_after. Fields: slug (the address /page/{slug}; renaming it in the admin leaves a 301 behind), title, body (HTML as typed, with placeholders), rendered_body (in the request’s language with placeholders expanded — what the site prints; use it for an external storefront), page_title, meta_description, enabled, in_sitemap, position (the order in the admin list, not in a menu), shown_when (conditions of showing, in words).

A page’s text is not written through the API — it is edited in the admin.