HF PanelDocsv1.0.0

API: discount codes, announcements and help

Manage discount codes, send and list announcements, and search the help articles with the token API.

These endpoints work on the same data as the Discount codes, Announcements and Help articles screens.

bash
A=https://api.yourdomain.com:2087/v1
H="Authorization: Bearer hf_xxx"

Discount codes (administrators)

Method and path What it does
GET /v1/coupons Every code with its rules and uses.
POST /v1/coupons Make a code (needs a Read & change token).
GET /v1/coupons/{id} One code, by its id or its code.
PATCH /v1/coupons/{id} Change a code's rules; fields you leave out stay as they are.
DELETE /v1/coupons/{id} End a code. Its uses stay in the report.

The body fields are the screen's: code, kind (percent, amount, trial), value, duration (once, repeating, forever), months, max_uses, per_customer, starts and expires (YYYY-MM-DD), packages, periods and plans (lists), new_only, note and applies (hosting, licence, all).

bash
curl -s -H "$H" -H "Content-Type: application/json" -X POST $A/coupons \
  -d '{"code":"SPRING20","kind":"percent","value":20,"duration":"repeating","months":3,"per_customer":1}'

Announcements

Method and path Who What it does
GET /v1/announcements any token Staff: the announcements they sent (an administrator every one), with the counts. A customer: the ones sent to them.
POST /v1/announcements administrators and resellers Send an announcement now, or later with send_at.

Body: subject, body (simple Markdown), kind (news or service), audience (all, package, reseller, feature) with target (the package id, reseller id or feature key), banner and email (both on by default), banner_until (YYYY-MM-DD) and send_at (YYYY-MM-DD HH:MM, UTC). A reseller's announcement always goes to their own customers only.

GET /v1/kb/search?q=…&limit=5 returns the help articles the token's user may read that match the words: title, slug, excerpt and url. Customers never see staff-only articles, nor another reseller's.

bash
curl -s -H "$H" "$A/kb/search?q=email+on+my+phone"