REST API reference
Server-to-server API for managing referrals: list and inspect them, create them from your own systems, and report conversions. All endpoints are JSON over HTTPS.
Authentication
Every request must carry your API key in the X-API-Key header. Keys look like oft_ followed by 32 hex characters and are issued in your partner dashboard.
curl https://offertown.gr/api/v1/partners/referrals \
-H "X-API-Key: oft_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"- The key identifies your partner account — there is no
partnerIdparameter anywhere in the API, and supplying one is rejected. - Keep the key server-side only. If it leaks, rotate it from the dashboard.
- Missing or invalid keys return
401; keys for partners that aren’t approved yet return403.
Rate limits
- Write requests are limited to 30 per minute per IP.
- Conversion reporting is additionally limited to 60 per minute per partner.
- Exceeding a limit returns
429with aRetry-Afterheader andretryAfterMsin the body. Back off and retry — all write endpoints are idempotent, so retries are safe.
Errors
All errors share one shape:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Human-readable description",
"fields": [{ "field": "friendEmail", "message": "Invalid email" }],
"retryAfterMs": 12000
}
}| HTTP | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | Malformed query parameter or body field. |
| 401 | MISSING_API_KEY / INVALID_API_KEY | No key, or the key doesn’t resolve. |
| 403 | PARTNER_NOT_APPROVED | Valid key, but the partner account isn’t approved. |
| 404 | NOT_FOUND / INVALID | Referral doesn’t exist or isn’t yours. For vouchers, INVALID means the code is unknown or not yours — those two cases are indistinguishable. |
| 409 | DUPLICATE_CONVERSION / ALREADY_REDEEMED / EXPIRED / UNAVAILABLE | The referral was already converted under a different transaction ID. A voucher redeem returns ALREADY_REDEEMED when the stored invoice reference differs, or UNAVAILABLE when the voucher cannot be redeemed yet. EXPIRED is the same status when the voucher is past its expiry. |
| 429 | RATE_LIMITED / VOUCHER_ENUMERATION_LOCKED | Slow down; retry after the indicated delay. |
| 500 | INTERNAL_ERROR | Something went wrong on our side. |
The referral object
{
"referralId": "jx7…", // stable ID, use it in URLs
"referralCode": "a1b2c3d4", // the referrer's 8-char share code
"status": "pending", // clicked | pending | converted | expired
// | not_customer
"friendEmail": "ana@example.com",
"friendName": "Ana",
"friendPhone": "+306901234567", // present when captured on the form
"friendPostCode": "11146", // "
"friendAddress": "Panepistimiou 1", // "
"friendCity": "Athens", // "
"consentAt": 1765467600000, // epoch ms — consent checkbox time on
// Offertown forms; submission time for
// programmatic captures without one
"sourceUrl": "https://…", // page the friend was captured on
"createdAt": 1765467600000, // epoch ms
"convertedAt": null, // epoch ms when converted
"conversionValue": null, // decimal string of cents, e.g. "12999"
"currency": "EUR",
"referrerEmail": "nikos@example.com", // the referrer's account email
"referrerName": "Nikos",
"externalSourceId": null, // your identifier for the referral
"metadata": {}, // free-form, up to 4 KiB
"rewardsCancelledAt": null // epoch ms, set only once the
// conversion's rewards were cancelled
}A friend who applies through the widget or an Offertown page appears in the API once they confirm their email. Until then the referral is not listed and its ID answers 404. Creating the referral yourself with the same friendEmail via POST /referrals counts as confirmation.
not_customer means the lead was closed because the friend did not become a customer, by your team in the dashboard or by your system with …/close (see Close a lead as not a customer). It is final until your team reopens it in the dashboard, when it is pending again; the API does not reopen a lead. While it is not_customer, a conversion for it is refused like any lead that is not pending. Creating the same friend again for the same referrer returns the existing referral instead of a new one (see Create a referral).
List referrals
| Query parameter | Description |
|---|---|
status | clicked | pending | converted | expired | not_customer |
referrerEmail | Exact-match filter on the referrer’s email. |
dateFrom / dateTo | Creation window, epoch milliseconds. |
search | Free-text search (max 256 chars). |
sortBy / sortOrder | createdAt, convertedAt, or conversionValue; asc or desc. |
page / pageSize | Pagination; default 1 / 25, max page size 100. |
{
"data": [ { …referral } ],
"pagination": { "page": 1, "pageSize": 25, "total": 137, "truncated": false }
}Create a referral
Registers a referral you captured yourself (your own form, support flow, or import).
{
"referrerIdentifier": "a1b2c3d4",
"friendEmail": "ana@example.com",
"friendName": "Ana",
"externalSourceId": "lead_991",
"metadata": { "campaign": "spring" }
}referrerIdentifier (the referrer’s share code or email) and friendEmail are required. friendName, externalSourceId (your reference) and metadata (up to 4 KiB) are optional.
{
"data": {
"referralId": "jx7…",
"referralCode": "a1b2c3d4",
"status": "pending",
"referrerEmail": "maria@example.com",
"referrerName": "Maria",
"friendEmail": "ana@example.com",
"friendName": "Ana",
"currency": "EUR",
"createdAt": 1765467600000,
"externalSourceId": "lead_991",
"metadata": "{\"campaign\":\"spring\"}",
"idempotent": false
}
}Idempotency: this call makes no second referral for the same friend from the same referrer. When the referral already exists, the call answers 200 with that referral and idempotent: true, and status is its status now, for example converted, not always pending.
- Re-posting with an
externalSourceIdyou used before, for the same referrer and friend, returns that referral. The sameexternalSourceIdwith another referrer or friend answers409 CONFLICT. - Without an
externalSourceId, or with one not used before, a friend who already has a referral from this referrer gets no second one: the existing referral is returned unchanged. TheexternalSourceIdyou sent is not added to it; set it with the update call below if you need it. If the friend’s only referral from this referrer is still waiting for them to confirm their email, your call counts as confirmation: that referral is returned, nowpending, with yourexternalSourceIdandmetadataadded.
Get a referral
Returns the full referral object.
Update a referral
Only metadata and externalSourceId are writable. Everything else — status, conversion data, the friend’s identity — is read-only and rejected if present in the body.
{
"externalSourceId": "lead_991",
"metadata": { "crmStage": "won" }
}Report a conversion
Marks the referral converted and starts the reward flow (your approval, the hold period, then funding). Until the hold ends you can still cancel; see below.
When your program gives the friend a reward, you decide the friend’s reward and the referrer’s apart in the partner dashboard: you can pay the referrer and reject the friend’s reward for a contract that does not qualify for it. The friend’s reward is charged only if you approve it. The API reports and cancels conversions; it does not approve or reject rewards.
“Approve” can be unavailable on both lines of a conversion that reads “Waiting for the friend to create their Offertown account”: the friend has not created their Offertown account yet, and the friend got an email asking them to. Rejecting the friend’s reward releases the referrer’s reward, which you can then approve.
{
"conversionValue": 12999,
"currency": "EUR",
"externalTransactionId": "order_77",
"metadata": { "planName": "Fiber 100", "customerId": "C-1" }
}conversionValue, currency and externalTransactionId are required; metadata is optional. conversionValue is an amount in cents, a whole number of 0 or more (you decide what it represents; send the same thing every time). currency is EUR only. externalTransactionId is your order ID, 1 to 128 characters.
metadata is a JSON object of up to 4096 characters, for example the plan’s name (planName) and your customer ID (customerId). It is kept on the referral, replacing any metadata set earlier, is returned when you read the referral, and is shown to your reward approvers on the conversion’s card on the Rewards page.
{
"data": {
"referralId": "jx7…",
"status": "converted"
}
}- Idempotency: replays with the same
externalTransactionIdreturn the same answer. Reporting a conversion for an already-converted referral with a different transaction ID — or reusing a transaction ID on another referral — returns409 DUPLICATE_CONVERSION. - Send
conversionValuein cents (integer); reading the referral returns it as a decimal string.
Cancel a conversion’s rewards
Use this when a converted sale or contract later fails. It cancels the referrer’s reward, expires the friend’s reward if it hasn’t been used, and reverses the commission. The referral keeps its converted status. If the rewards haven’t been created yet, none will be.
Cancel works until the hold period ends. The hold starts when you approve the reward in the partner dashboard and lasts your program’s maturityDays. A new program starts with 3 days, and you can set 0 to 90 on Program Settings. During the hold you are not charged for the reward, and you can cancel it here or in the dashboard. With 0 days, an approval is final at once, so this call answers 409 REWARD_MATURED as soon as you approve.
After a cancel the referral still reads status: "converted"; its rewardsCancelledAt field (epoch ms) marks the cancellation.
{
"externalTransactionId": "order_77",
"reason": "Order cancelled by the customer",
"referrerMessage": "The order was returned, so no reward is due.",
"friendMessage": "You returned the order, so the offer does not apply."
}{
"data": {
"referralId": "jx7…",
"rewardsCancelled": 2,
"idempotent": false
}
}externalTransactionIdandreasonare required, and any field not listed here is rejected with400 VALIDATION_ERROR.externalTransactionId(1–128 characters after trimming) must be the one you sent to…/convert.reasonis 1–500 characters after a line break or tab becomes a space, other control characters are removed and whitespace is collapsed. It is kept for your records and is never shown to the referrer or the friend.referrerMessageandfriendMessageare optional, cleaned the same way and 1–500 characters each.referrerMessageis read only by the referrer andfriendMessageonly by the friend, each on their own pages as “Their reason: …”. Leave one out, or send it empty, and that person reads only that the reward was cancelled. A message is ignored when this call does not end that person’s reward.rewardsCancelledcounts the rewards this call cancelled (referrer and friend); the commission is not counted.- Idempotency: once a conversion’s rewards are cancelled, repeating the call returns
200withrewardsCancelled: 0andidempotent: true. A repeat does not change the messages stored by the first call. 409 REWARD_MATURED: a reward for this conversion is already owed — its hold period has ended, it has been paid, or a charge for it is in progress. Nothing is changed.409 NOT_CONVERTED: the referral has no conversion.409 TRANSACTION_MISMATCH: theexternalTransactionIddiffers from the conversion’s.404 NOT_FOUND: no such referral for your account.- Limited to 60 referral writes per minute per partner.
Close a lead as not a customer
Use this when your system knows that the friend of a pending lead will not become a customer. The result is the same as closing the lead on the Leads page of your dashboard: the referral becomes not_customer, and the referrer and the friend each get an email that the application ended without a reward. No reward, charge or balance is created or changed.
The API cannot reopen a lead. A lead closed by mistake is reopened by an Admin of your team on the Leads page, and is pending again.
{
"reason": "outside_service_area",
"note": "The address is outside our network"
}reason | Meaning | Shown to |
|---|---|---|
outside_service_area | Outside the service area | The referrer and the friend |
did_not_sign | Did not sign | The referrer and the friend |
already_customer | Already a customer | The friend only |
duplicate | Duplicate application | The referrer and the friend |
not_eligible | Not eligible | Neither |
other | Another reason; send a note | The referrer and the friend |
{
"data": {
"referralId": "jx7…",
"status": "not_customer",
"idempotent": false
}
}reasonis required and must be one of the six codes above.noteis optional, at most 500 characters after trimming, and required whenreasonisother. Any other field is rejected with400 VALIDATION_ERROR.- The note is for your team: it shows on the Leads page of your dashboard. It is never shown to the referrer or the friend, never sent in an email and never returned by the API. Reading the referral returns
status: "not_customer"without the reason or the note. - Idempotency: repeating the call for a lead already closed with the same
reasonreturns200withidempotent: true, changes nothing and sends no second email. A differentreasonreturns409 ALREADY_CLOSED. 409 ALREADY_CONVERTED: the referral was converted.409 EXPIRED: the referral expired.409 NOT_PENDING: the friend has only clicked the link and has not applied.404 NOT_FOUND: no such referral for your account, including a friend who has not confirmed their email yet.- Limited to 60 referral writes per minute per partner.
Look up a voucher
The two voucher endpoints serve vouchers issued on or before 16 October 2026 only. Rewards are now taken as brand codes from Offertown, so no new vouchers are issued; an outstanding voucher can be redeemed until it is used or expires.
Returns whether a voucher issued for your account can be redeemed. The customer’s first name is the only personal data included. Send a code of at most 64 characters.
{
"data": {
"code": "VCH-AB12CD",
"valid": true,
"amountCents": 2500,
"currency": "EUR",
"expiresAt": "2026-12-24T00:00:00.000Z",
"customerName": "Nikos"
}
}A voucher that is already redeemed, expired, or held returns 200 with valid: false and reason ALREADY_REDEEMED, EXPIRED, or UNAVAILABLE. An unknown code, or a code that belongs to another partner, returns 404 { "error": { "code": "INVALID" } }.
Redeem a voucher
Redeems the voucher and records your invoice number. Use a reference that is unique across your journals, the same way externalTransactionId is unique for conversions. Odoo invoice names are unique only per journal.
{
"partnerReference": "INV/2026/00042"
}{
"data": {
"code": "VCH-AB12CD",
"amountCents": 2500,
"currency": "EUR",
"partnerReference": "INV/2026/00042",
"idempotent": false
}
}partnerReferenceis required, 1–64 characters, with no control characters. A missing or invalid value is400 VALIDATION_ERRORon fieldpartnerReference.- Repeating the redeem with the same reference returns
idempotent: trueand does not schedule a second payout. A different reference on an already-redeemed voucher is409 ALREADY_REDEEMED. - Expired or held vouchers return
409 EXPIREDor409 UNAVAILABLE. - Each unknown code counts toward a limit shared with your dashboard. After more than 12 unknown codes in 5 minutes, lookups and redemptions return
429 VOUCHER_ENUMERATION_LOCKEDwith aRetry-Afterheader for up to 15 minutes, on the dashboard as well. Send codes exactly as the customer received them.
A typical integration
- Capture referred friends with the widget (or create referrals via
POST /referralsfrom your backend). - When an order completes in your system, look up the referral (by your
externalSourceIdor the friend’s email via the list endpoint) and call…/convertwith the order ID asexternalTransactionId. - Approve conversions in your partner dashboard, the friend’s reward and the referrer’s each on its own; rewards mature and are funded automatically.