REST endpoints for referrals in ServFlo: 13 operations with parameters, request and response fields, permissions and curl examples.
Base URL: https://app.servflo.ai/api. Every call needs Authorization: Bearer sfk_… (Authentication ); {organizationId} ($ORGANIZATION_ID in the examples) is your business's id .
GET /organizations/{organizationId}/marketing/referrals/program
On/off, the rewards for the referrer and the new customer, the terms, what counts as a conversion and the cap per referrer. Read-only.
Permission marketing.read (Owner, Admin, Dispatcher)Risk read, OAuth scope servflo.read. Read: reads only.MCP tool referrals_program (toolset marketing)
curl "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/program" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields Field Type Description enabledboolean referrerRewardKindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. referrerRewardCentsinteger referrerRewardNotestring or null friendRewardKindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. friendRewardCentsinteger friendRewardNotestring or null headlinestring or null termsstring or null conversionenum One of FIRST_PAID_INVOICE, FIRST_COMPLETED_JOB. rewardCapinteger or null rewardCapPeriodDaysinteger updatedAtstring (date-time) or null
PATCH /organizations/{organizationId}/marketing/referrals/program
Changes the fields sent. Turning it on gives every customer a link (/ref/{code}, the {{links.referral}} merge field, the portal) and turns on the "Referral reward thank-you" automation the first time.
Permission marketing.manage (Owner, Admin)Risk write, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.MCP tool referrals_updateProgram (toolset marketing)
Field Type Required Description enabledboolean No On: customers get a link and rewards are issued. referrerRewardKindenum No What the customer who referred gets: ACCOUNT_CREDIT (a credit line on an invoice), DISCOUNT, GIFT_CARD (sent by hand) or NONE. One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. referrerRewardCentsinteger No 0–1000000. referrerRewardNotestring or null No e.g. "$50 Amazon gift card". Up to 200 characters. friendRewardKindenum No What the new customer gets on their first invoice. One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. friendRewardCentsinteger No 0–1000000. friendRewardNotestring or null No Up to 200 characters. headlinestring or null No The landing page's headline. Up to 120 characters. termsstring or null No Up to 4000 characters. conversionenum No When a referral counts: the first paid invoice (default) or first completed job. One of FIRST_PAID_INVOICE, FIRST_COMPLETED_JOB. rewardCapinteger or null No At most this many rewarded referrals per referrer per period; null = no cap. 1–1000. rewardCapPeriodDaysinteger No 1–3650.
curl -X PATCH "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/program" \
-H "Authorization: Bearer $SERVFLO_API_KEY " \
-H "Content-Type: application/json" \
-d '{"enabled":true,"referrerRewardKind":"ACCOUNT_CREDIT","referrerRewardCents":12500}'
200: the answer's fields Field Type Description enabledboolean referrerRewardKindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. referrerRewardCentsinteger referrerRewardNotestring or null friendRewardKindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. friendRewardCentsinteger friendRewardNotestring or null headlinestring or null termsstring or null conversionenum One of FIRST_PAID_INVOICE, FIRST_COMPLETED_JOB. rewardCapinteger or null rewardCapPeriodDaysinteger updatedAtstring (date-time) or null
GET /organizations/{organizationId}/marketing/referrals
Who referred whom, newest first: status (PENDING, CONVERTED, REJECTED with the reason), the request it came in as, and the rewards. Read-only.
Permission marketing.read (Owner, Admin, Dispatcher)Risk read, OAuth scope servflo.read. Read: reads only.MCP tool referrals_list (toolset marketing)
Name In Type Required Description statusquery enum No One of PENDING, CONVERTED, REJECTED. referrerCustomerIdquery string No limitquery integer No 1–200. offsetquery integer No
curl "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields Field Type Description totalinteger itemsarray of object items[].idstring items[].statusenum One of PENDING, CONVERTED, REJECTED. items[].sourcestring items[].rejectReasonstring or null SELF_REFERRAL, EXISTING_CUSTOMER, DUPLICATE or STAFF. items[].codestring or null items[].referrerobject items[].referrer.idstring items[].referrer.namestring items[].referredobject or null items[].referred.idstring items[].referred.namestring items[].friendNamestring or null items[].friendEmailstring or null items[].friendPhonestring or null items[].requestobject or null items[].request.idstring items[].request.identifierstring items[].request.statusstring items[].convertedAtstring (date-time) or null items[].rewardWithheldboolean Converted, but the referrer had reached the cap. items[].createdAtstring (date-time) items[].rewardsarray of object items[].rewards[].idstring items[].rewards[].referralIdstring items[].rewards[].customerIdstring items[].rewards[].partyenum One of REFERRER, FRIEND. items[].rewards[].kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. items[].rewards[].amountCentsinteger items[].rewards[].notestring or null items[].rewards[].statusenum One of ISSUED, APPLIED, VOID. items[].rewards[].invoiceIdstring or null items[].rewards[].issuedAtstring (date-time) items[].rewards[].appliedAtstring (date-time) or null items[].rewards[].voidedAtstring (date-time) or null items[].rewards[].descriptionstring
POST /organizations/{organizationId}/marketing/referrals
Staff record that one customer referred another ("referred by"). Refused for the same person or one sharing their email, phone or address (400) and for a customer already referred (409). Someone who already paid the business is recorded as REJECTED (existing customer); otherwise the new customer's reward is issued.
Permission marketing.manage (Owner, Admin)Risk write, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.MCP tool referrals_create (toolset marketing)
Field Type Required Description referrerCustomerIdstring Yes The customer who referred. referredCustomerIdstring Yes The new customer.
curl -X POST "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals" \
-H "Authorization: Bearer $SERVFLO_API_KEY " \
-H "Content-Type: application/json" \
-d '{"referrerCustomerId":"referrerCustomer_id","referredCustomerId":"referredCustomer_id"}'
201: the answer's fields Field Type Description idstring statusenum One of PENDING, CONVERTED, REJECTED. sourcestring rejectReasonstring or null SELF_REFERRAL, EXISTING_CUSTOMER, DUPLICATE or STAFF. codestring or null referrerobject referrer.idstring referrer.namestring referredobject or null referred.idstring referred.namestring friendNamestring or null friendEmailstring or null friendPhonestring or null requestobject or null request.idstring request.identifierstring request.statusstring convertedAtstring (date-time) or null rewardWithheldboolean Converted, but the referrer had reached the cap. createdAtstring (date-time) rewardsarray of object rewards[].idstring rewards[].referralIdstring rewards[].customerIdstring rewards[].partyenum One of REFERRER, FRIEND. rewards[].kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. rewards[].amountCentsinteger rewards[].notestring or null rewards[].statusenum One of ISSUED, APPLIED, VOID. rewards[].invoiceIdstring or null rewards[].issuedAtstring (date-time) rewards[].appliedAtstring (date-time) or null rewards[].voidedAtstring (date-time) or null rewards[].descriptionstring
GET /organizations/{organizationId}/marketing/referrals/report
Referrals, conversions and the conversion rate, rewards issued / applied / outstanding, and the top referrers, over the last days (default: all time). Read-only.
Permission marketing.read (Owner, Admin, Dispatcher)Risk read, OAuth scope servflo.read. Read: reads only.MCP tool referrals_report (toolset marketing)
Name In Type Required Description daysquery integer No 1–3650.
curl "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/report" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields Field Type Description totalinteger pendinginteger convertedinteger rejectedinteger conversionRatenumber rewardsobject rewards.issuedCentsinteger rewards.appliedCentsinteger rewards.outstandingCentsinteger rewards.countinteger topReferrersarray of object topReferrers[].customerIdstring topReferrers[].namestring topReferrers[].referralsinteger topReferrers[].convertedinteger
GET /organizations/{organizationId}/marketing/referrals/{referralId}
One referral with its rewards. Read-only.
Permission marketing.read (Owner, Admin, Dispatcher)Risk read, OAuth scope servflo.read. Read: reads only.MCP tool referrals_get (toolset marketing)
Name In Type Required Description referralIdpath string Yes A referral id, from GET /marketing/referrals.
curl "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/{referralId}" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields Field Type Description idstring statusenum One of PENDING, CONVERTED, REJECTED. sourcestring rejectReasonstring or null SELF_REFERRAL, EXISTING_CUSTOMER, DUPLICATE or STAFF. codestring or null referrerobject referrer.idstring referrer.namestring referredobject or null referred.idstring referred.namestring friendNamestring or null friendEmailstring or null friendPhonestring or null requestobject or null request.idstring request.identifierstring request.statusstring convertedAtstring (date-time) or null rewardWithheldboolean Converted, but the referrer had reached the cap. createdAtstring (date-time) rewardsarray of object rewards[].idstring rewards[].referralIdstring rewards[].customerIdstring rewards[].partyenum One of REFERRER, FRIEND. rewards[].kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. rewards[].amountCentsinteger rewards[].notestring or null rewards[].statusenum One of ISSUED, APPLIED, VOID. rewards[].invoiceIdstring or null rewards[].issuedAtstring (date-time) rewards[].appliedAtstring (date-time) or null rewards[].voidedAtstring (date-time) or null rewards[].descriptionstring
POST /organizations/{organizationId}/marketing/referrals/{referralId}/link
For a pending referral whose request was handled by hand: the customer it became. The fraud guards run again; the new customer's reward is issued.
Permission marketing.manage (Owner, Admin)Risk write, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.MCP tool referrals_link (toolset marketing)
Name In Type Required Description referralIdpath string Yes A referral id, from GET /marketing/referrals.
Field Type Required Description customerIdstring Yes
curl -X POST "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/{referralId}/link" \
-H "Authorization: Bearer $SERVFLO_API_KEY " \
-H "Content-Type: application/json" \
-d '{"customerId":"customer_id"}'
200: the answer's fields Field Type Description idstring statusenum One of PENDING, CONVERTED, REJECTED. sourcestring rejectReasonstring or null SELF_REFERRAL, EXISTING_CUSTOMER, DUPLICATE or STAFF. codestring or null referrerobject referrer.idstring referrer.namestring referredobject or null referred.idstring referred.namestring friendNamestring or null friendEmailstring or null friendPhonestring or null requestobject or null request.idstring request.identifierstring request.statusstring convertedAtstring (date-time) or null rewardWithheldboolean Converted, but the referrer had reached the cap. createdAtstring (date-time) rewardsarray of object rewards[].idstring rewards[].referralIdstring rewards[].customerIdstring rewards[].partyenum One of REFERRER, FRIEND. rewards[].kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. rewards[].amountCentsinteger rewards[].notestring or null rewards[].statusenum One of ISSUED, APPLIED, VOID. rewards[].invoiceIdstring or null rewards[].issuedAtstring (date-time) rewards[].appliedAtstring (date-time) or null rewards[].voidedAtstring (date-time) or null rewards[].descriptionstring
POST /organizations/{organizationId}/marketing/referrals/{referralId}/reject
A pending referral earns nothing; the new customer's unused reward is voided.
Permission marketing.manage (Owner, Admin)Risk write, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.MCP tool referrals_reject (toolset marketing)
Name In Type Required Description referralIdpath string Yes A referral id, from GET /marketing/referrals.
curl -X POST "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/{referralId}/reject" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields Field Type Description idstring statusenum One of PENDING, CONVERTED, REJECTED. sourcestring rejectReasonstring or null SELF_REFERRAL, EXISTING_CUSTOMER, DUPLICATE or STAFF. codestring or null referrerobject referrer.idstring referrer.namestring referredobject or null referred.idstring referred.namestring friendNamestring or null friendEmailstring or null friendPhonestring or null requestobject or null request.idstring request.identifierstring request.statusstring convertedAtstring (date-time) or null rewardWithheldboolean Converted, but the referrer had reached the cap. createdAtstring (date-time) rewardsarray of object rewards[].idstring rewards[].referralIdstring rewards[].customerIdstring rewards[].partyenum One of REFERRER, FRIEND. rewards[].kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. rewards[].amountCentsinteger rewards[].notestring or null rewards[].statusenum One of ISSUED, APPLIED, VOID. rewards[].invoiceIdstring or null rewards[].issuedAtstring (date-time) rewards[].appliedAtstring (date-time) or null rewards[].voidedAtstring (date-time) or null rewards[].descriptionstring
POST /organizations/{organizationId}/marketing/referrals/check
Runs what the engine does every few seconds: links referrals to the customers their requests became and converts the ones whose customer paid (or completed a job), issuing rewards once.
Permission marketing.manage (Owner, Admin)Risk write, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.MCP tool referrals_check (toolset marketing)
Field Type Required Description nowstring (date-time) No Tests only: act as of this moment (ISO 8601). Refused when NODE_ENV=production.
curl -X POST "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/check" \
-H "Authorization: Bearer $SERVFLO_API_KEY " \
-H "Content-Type: application/json" \
-d '{"now":"2026-11-03T15:00:00Z"}'
200: the answer's fields Field Type Description linkedinteger convertedinteger rejectedinteger
GET /organizations/{organizationId}/marketing/referrals/rewards
Rewards earned (ISSUED), used (APPLIED: a credit line on an invoice, or the gift card sent) and voided, newest first. Read-only.
Permission marketing.read (Owner, Admin, Dispatcher)Risk read, OAuth scope servflo.read. Read: reads only.MCP tool referrals_rewards (toolset marketing)
Name In Type Required Description statusquery enum No One of ISSUED, APPLIED, VOID. customerIdquery string No
curl "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/rewards" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields An array of objects:
Field Type Description idstring referralIdstring customerIdstring partyenum One of REFERRER, FRIEND. kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. amountCentsinteger notestring or null statusenum One of ISSUED, APPLIED, VOID. invoiceIdstring or null issuedAtstring (date-time) appliedAtstring (date-time) or null voidedAtstring (date-time) or null descriptionstring customerNamestring
POST /organizations/{organizationId}/marketing/referrals/rewards/{rewardId}/apply
Money: a credit or discount goes on one of the rewarded customer's DRAFT invoices without payments as a credit line (never more than the invoice), lowering what they owe; a gift card is marked as sent. Applying it again to the same invoice changes nothing; to another, 409.
Permission marketing.manage (Owner, Admin)Risk sensitive, OAuth scope servflo.sensitive. Sensitive: moves money, deletes, sends or shows something to a customer, or grants or revokes access.MCP tool referrals_applyReward (toolset marketing)Approval Over MCP, this tool asks for your OK first (in the AI app when it supports it, otherwise in ServFlo). See Approvals .
Name In Type Required Description rewardIdpath string Yes A referral reward id, from GET /marketing/referrals/rewards.
Field Type Required Description invoiceIdstring or null No
curl -X POST "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/rewards/{rewardId}/apply" \
-H "Authorization: Bearer $SERVFLO_API_KEY " \
-H "Content-Type: application/json" \
-d '{"invoiceId":"invoice_id"}'
200: the answer's fields Field Type Description idstring referralIdstring customerIdstring partyenum One of REFERRER, FRIEND. kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. amountCentsinteger notestring or null statusenum One of ISSUED, APPLIED, VOID. invoiceIdstring or null issuedAtstring (date-time) appliedAtstring (date-time) or null voidedAtstring (date-time) or null descriptionstring
POST /organizations/{organizationId}/marketing/referrals/rewards/{rewardId}/void
An unused reward is cancelled; it can no longer be applied.
Permission marketing.manage (Owner, Admin)Risk sensitive, OAuth scope servflo.sensitive. Sensitive: moves money, deletes, sends or shows something to a customer, or grants or revokes access.MCP tool referrals_voidReward (toolset marketing)Approval Over MCP, this tool asks for your OK first (in the AI app when it supports it, otherwise in ServFlo). See Approvals .
Name In Type Required Description rewardIdpath string Yes A referral reward id, from GET /marketing/referrals/rewards.
curl -X POST "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /marketing/referrals/rewards/{rewardId}/void" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields Field Type Description idstring referralIdstring customerIdstring partyenum One of REFERRER, FRIEND. kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. amountCentsinteger notestring or null statusenum One of ISSUED, APPLIED, VOID. invoiceIdstring or null issuedAtstring (date-time) appliedAtstring (date-time) or null voidedAtstring (date-time) or null descriptionstring
GET /organizations/{organizationId}/customers/{customerId}/referral
The customer's referral code and link (/ref/{code}, made the first time it is asked for), visits, the rewards on offer, the people they referred and their rewards.
Permission marketing.read (Owner, Admin, Dispatcher)Risk read, OAuth scope servflo.read. Read: reads only.MCP tool referrals_customer (toolset marketing)
Name In Type Required Description customerIdpath string Yes
curl "https://app.servflo.ai/api/organizations/ $ORGANIZATION_ID /customers/{customerId}/referral" \
-H "Authorization: Bearer $SERVFLO_API_KEY "
200: the answer's fields Field Type Description enabledboolean codestring linkstring visitsinteger referrerRewardstring friendRewardstring referralsarray of object referrals[].idstring referrals[].statusstring referrals[].namestring or null referrals[].createdAtstring (date-time) referrals[].convertedAtstring (date-time) or null rewardsarray of object rewards[].idstring rewards[].referralIdstring rewards[].customerIdstring rewards[].partyenum One of REFERRER, FRIEND. rewards[].kindenum One of ACCOUNT_CREDIT, DISCOUNT, GIFT_CARD, NONE. rewards[].amountCentsinteger rewards[].notestring or null rewards[].statusenum One of ISSUED, APPLIED, VOID. rewards[].invoiceIdstring or null rewards[].issuedAtstring (date-time) rewards[].appliedAtstring (date-time) or null rewards[].voidedAtstring (date-time) or null rewards[].descriptionstring