Partner docs · v1.1
Know the moment your customers claim
Liffio tells your system when a customer claims the perk you gave them, so you never send a second link to someone who already has it.
How it works
From link to claim in five steps
The status changes as your customer moves through the claim. You only need to act on the last one.
- 1You send a link
A signed link with your customer's ref, or a code.
not_claimed - 2They open it
We hold the perk for them for 30 minutes.
pending - 3They sign up
They sign up or log in to Liffio by email, then connect Instagram.
pending - 4Perk applied
Their offer starts: free time right away, or the discount waits for their first payment.
claimed - 5We tell you
A
claim.claimedclaim.claimedwebhook. Stop sending links. Later payments sendclaim.paid.
Claim links · signed
Create a claim link for each customer
A signed link is a short token (a JWT) that says which customer it's for. You make it on your server with your link signing secret (lfp_sk_...), which your Liffio contact gives you once. It's separate from the webhook secret.
The link
https://liffio.com/claim/your-partner-slug#t=<token>The token goes after #t=, not ?t=. The part after # never reaches any server or log, so the token stays private.
What goes in the token
partnerstringrequiredYour partner slug, exactly as in your claim URL.
refstring · 1 to 200requiredYour own id for this customer, for example your user id. Use the same ref for the same customer every time. It comes back to you in webhooks and the status API.
iatunix secondsrequiredWhen you made the link.
expunix secondsrequiredWhen the link stops working. No later than your link lifetime after iat. Liffio tells you yours: 7 days unless agreed otherwise, and never more than 365.
offerstringoptionalWhich of your offers this customer gets, for example starter-2m. Liffio gives you the list. Leave it out to use your default offer. A name that isn't on your list (or one that was retired) makes the link invalid.
sourcestring · max 64optionalWhere the link came from, for example newsletter-nov. Lowercase letters, numbers, - and _ (we lowercase it for you). Shows up in your reports. It doesn't change the offer, and a source that breaks these rules is dropped while the link still works.
Sign with HS256; any other algorithm is refused. Any other fields in the token are ignored, so a token can never choose a plan or a length.
Rules
- 1Sign on your server only. Never put the secret in a web page, an app or an email template.
- 2No personal data in
ref. No emails or phone numbers: the ref is readable inside the link. Use an internal id. - 3Check before you send. Call the status API and only send a link when the status is
not_claimed. - 4One perk per ref. A new link for a ref that already claimed only shows your customer "already claimed".
What your customer sees
The perk page, held for them for 30 minutes while they sign up.
"This link isn't valid": wrong secret, wrong partner, a missing field, or an offer that isn't on your list.
"This offer link is no longer active": your program is paused, ended or full, or signed links are turned off for you.
"This link has expired": past exp, or exp is further from iat than your link lifetime.
"Already claimed": this ref already has the perk.
Liffio checks in that order: not valid, then no longer active, then expired, then already claimed.
Using codes too? You can use signed links, unique codes and a shared code together. Liffio turns on the ones you need. For codes, share liffio.com/claim/your-partner-slug#code=LF-XXXX-XXXX-XXXX so the code fills in by itself, or let customers type it at liffio.com/redeem. That page takes any partner's code and switches to your offer once it finds the code. Codes need no signing.
const jwt = require("jsonwebtoken");
function claimLink(ref) {
const token = jwt.sign(
{
partner: "your-partner-slug",
ref,
// offer: "starter-2m", optional, one of your offers
// source: "newsletter-nov", optional, for your reports
},
process.env.LIFFIO_LINK_SECRET,
{ algorithm: "HS256", expiresIn: "7d" } // iat is added for you
);
return `https://liffio.com/claim/your-partner-slug#t=${token}`;
}
claimLink("123456789");// header
{ "alg": "HS256", "typ": "JWT" }
// payload
{
"partner": "your-partner-slug",
"ref": "123456789",
"iat": 1793952000,
"exp": 1794556800,
"offer": "starter-2m",
"source": "newsletter-nov"
}Statuses
Five statuses, one simple rule
Webhooks and the status API use the same words. Only not_claimed means it's OK to send a link.
Never claimed, or a 30 minute hold ran out.
OK to send a linkOn the 30 minute hold, or the customer is signing up.
Wait, check laterThe perk was applied, even after the free time ends.
Stop sending linksTheir Instagram account already used a Liffio perk, or they already pay for Liffio.
Stop sending linksLiffio cancelled this claim.
Stop, ask LiffioWebhooks · push
We POST to you when a claim changes
Give your Liffio contact an https URL, and we tell you about claims and payments. You get a signing secret (whsec_...) once, to check every request really came from us.
Events
Pick one to see its payload.
No events are sent for a link being opened or a hold running out. Use the status API for those.
Revenue share. claim.paid is sent for every payment from a customer you brought. payment.earning is your cut (excluding GST, after any discount, in the payment's currency), or null when that payment doesn't earn (no revenue share, or the first payment came after your window). Earnings sit on_hold for 20 days, then become available. A refund sends claim.refunded and the earning becomes clawed_back.
What we do with your reply
2xx within 10 s4xx, 5xx, timeout, server down3xx)The reply body is ignored. A plain 200 OK is enough.
Your side
- 1Check the signature and reject anything that fails.
- 2Skip duplicates. Retries reuse the same
Liffio-Event-Id. - 3Save the status against
data.ref(ordata.code). - 4Reply 200 fast and do slow work afterwards.
Events can arrive out of order. Trust data.status, not the order they arrive in.
POST https://your-server.example/liffio-webhook
Content-Type: application/json
User-Agent: Liffio-Webhooks/1.0
Liffio-Event-Id: evt_3f9a1c7e5b2d4a6c8e0f1a2b
Liffio-Signature: t=1793963201,v1=5f2b9c...{
"id": "evt_3f9a1c7e5b2d4a6c8e0f1a2b",
"type": "claim.claimed",
"created_at": "2026-11-06T10:00:01Z",
"data": {
"ref": "123456789",
"code": null,
"status": "claimed",
"claimed_at": "2026-11-06T10:00:00Z",
"plan": "starter",
"access_ends_at": "2026-12-06T10:00:00Z",
"pending_until": null
}
}data has the same six fields as the status API, plus code, and payment on paid and refunded- Try 1right away
- Try 2+1 min
- Try 3+5 min
- Try 4+30 min
- Try 5+2 h
- Try 6+6 h
- Try 7+24 h
- FailedLiffio can resend
Security
Check every webhook is really from Liffio
v1 is an HMAC-SHA256 of <t>.<raw body> with your signing secret, in hex. Use the raw body, before parsing JSON.
- 1Read
tand everyv1from theLiffio-Signatureheader. - 2Reject old requests. If
tis more than 5 minutes from now, drop it. - 3Compute the HMAC of
t, a dot, and the raw body. - 4Compare safely with a constant-time compare. Any matching
v1passes.
When Liffio rotates your secret, the header carries two v1= values for 24 hours. The code here accepts either, so nothing breaks.
const crypto = require("crypto");
function isFromLiffio(rawBody, header, secret) {
const parts = header.split(",");
const t = Number((parts.find((p) => p.startsWith("t=")) || "").slice(2));
// reject anything older than 5 minutes
if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false;
const expected = crypto
.createHmac("sha256", secret)
.update(`${t}.${rawBody}`)
.digest("hex");
return parts
.filter((p) => p.startsWith("v1="))
.map((p) => p.slice(3))
.some((s) =>
s.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected))
);
}Status API · pull
Ask about one customer, any time
Call it from your server just before you send a link, or to catch a webhook you missed. Your API key (lf_partner_...) comes from your Liffio contact.
https://api.liffio.com/partner/v1/claims/{ref}Headers
AuthorizationstringrequiredBearer lf_partner_.... Server side only, never in a web page or app.
Path
refstring · max 200requiredYour customer reference, URL-encoded (a space becomes %20, a slash %2F). A ref we've never seen returns not_claimed, not a 404.
Responses
Always the same six fields. Fields that don't apply are null.
{"error":"invalid_ref"} The ref is empty or too long.
{"error":"unauthorized"} Key missing, wrong or revoked.
{"error":"rate_limited"} Over 60 a minute. Wait the seconds in Retry-After.
Using codes? Look up by code
https://api.liffio.com/partner/v1/codes/{code}Same key, same limit, same six fields, with code (as issued) in place of ref, plus code_state: active, expired or voided. Works for one-time codes. A shared code is used by many customers, so it returns 400 {"error":"shared_code"}. A code that isn't yours returns 404 {"error":"unknown_code"}, and one that isn't a code at all 400 {"error":"invalid_code"}.
curl https://api.liffio.com/partner/v1/claims/123456789 \
-H "Authorization: Bearer $LIFFIO_API_KEY"{
"ref": "123456789",
"status": "claimed",
"claimed_at": "2026-11-06T10:00:00Z",
"plan": "starter",
"access_ends_at": "2026-12-06T10:00:00Z",
"pending_until": null
}Good to know
Limits and rules
Status API requests per key. Headers show what's left.
Time your server has to reply to a webhook.
Per webhook, over about 33 hours.
Every time ends in Z. 10:00Z is 3:30 PM in India.
