publicKey:privateKey or the Basic Auth Key as the plugin’s API key. Things to know before you call:
- The credential is Basic with both keys. The public key is the username and the private key the password; a single key with an empty password answers 401. The plugin builds the
Authorizationheader from the stored value. - Two different 401 bodies. A request with no credential answers a JSON wrapper,
{ response: { status_code, status_message, body } }. A credential the host rejects answers HTML before the request reaches the API, so the status is all there is. The plugin reads both. - Refused creates throw. A duplicate member email or an unknown referral code answers
400with the reason inmessage, which the plugin raises as aReferralrockAPIError. A refused reward answers200withresultInfo.Status: "Failed"; the plugin raises that too. - Paging is offset and count. A collection answers
offset,totaland the rows;next_offsetis null once the rows reach the total. Omittingcountreturns everything, because that is the documented default. - Member sort values.
sorttakes one ofMember_Views_Desc,Member_Views_Asc,Page_Views_Desc,Page_Views_Asc,Lead_Count_Desc,Lead_Count_Asc,Reward_Issued_Total_Desc,Reward_Issued_Total_Asc,Member_Full_Name_Desc,Member_Full_Name_Asc,Create_Dt_DescorCreate_Dt_Asc, and it defaults toCreate_Dt_Desc. - An unrecognised
sortis silently ignored. Referral Rock says so explicitly and falls back to the default, so a typo would return correctly-shaped data in the wrong order.members.listpins the accepted values. - A member needs a program, a first name and an email. Referral Rock validates all three, so the schema requires them.
- A reward is sent as an array.
POST /api/rewardstakes a list of reward infos, each with ONE ofmemberQueryorreferralQueryand anewReward, and answers a list of results; the plugin wraps your input and unwraps the first result. Givemember_idorreferral_id, not both, and apayout_id: Referral Rock requires one, and a payout only exists once a reward rule in the program uses it. - Retries. Referral Rock documents no throughput window and no
Retry-After, so a 429 is retried three times with exponential backoff. A5xxis retried only for a read.
- 7 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.More: API Key
4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
List advocates in program orderWhat’s next
API reference
Every
referralrock.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.