Create a program
https://referalli.com /v1/programs Scope programs:writeCreates an affiliate program: its attribution model, cookie window, how long after sign-up a conversion still counts (signupToConversionDays, 1 to 1095, default 365; cookieWindowDays is 1 to 400, default 60), terms, public page and settings (signupPaymentGraceMinutes, 0 to 1440, default 5: how long before the referral's sign-up time a payment still earns). slug is unique per org. Terms are versioned so partners can be asked to accept new ones. publicHandle is unique across every org (check it first with GET /v1/programs/handle-availability). A taken slug or publicHandle is 409 conflict with details.field naming it (slug or publicHandle). Over the plan's program limit this is 402 payment_required. brand overrides the org's branding for this program: name (shown as merchant on the public page, in the join page title and in partner emails), logoUrl, theme (design tokens over the org theme), supportUrl, linkDomain (the host its links use; must be one of the org's verified domains, link or portal), portalDomain (must be the org's verified portal domain) and emailFrom (fromName, replyTo, logoUrl, primaryColor, and fromAddress, which must be on the org's verified sending domain). Anything left out falls back to the org; a domain or sender the org hasn't verified is 400 with details.field. termsUrl, faqUrl and supportUrl (https) are shown on the join page and returned by the public program. trackingConsent is the program's aff.js consent mode (auto, none, pending or an adapter id such as cookiemunch); null inherits PUT /v1/org/tracking-consent. landingParams: {code?, click?} renames the query parameters /go/ links land with (default via and ref_click_id; each a letter then up to 39 letters, digits, _, . or -, and different from each other); /t/{token}/config.json?program= echoes them and aff.js, @referalli/sdk/browser and @referalli/next read them, while null restores the defaults. publicPage.noindex keeps the hosted join page out of search engines. externalRef is the program's id in your own system (unique per org; a taken one is 409 with details.field: 'externalRef'); GET /v1/programs?externalRef= finds it and PUT /v1/programs/by-external-ref/{ref} upserts by it. destinationUrl sets the program's default link destination (stored as widget.destinationUrl).
Auth: an API key with programs:write, or a session with role owner, admin.
Scopes: programs:write, full, admin.
Parameters
Idempotency-Keyidempotent-replayed: true) and nothing runs twice. The same key on a different request is 422 idempotency_key_reused; while the first is still running, 409 idempotency_in_progress.x-org-idreferalli-modetest runs a session request against the org's test data. With an API key it must match the key's mode (400 mode_mismatch otherwise). The header name from before the rename is still accepted.Request body
application/json
nameslugattributionModelcookieWindowDayssignupToConversionDaystermsMdstatuspublicHandlepublicPageShow child parameters
pitchautoApprovenoindexprobabilisticPolicyselfReferralPolicysplitCommissionsutmTemplateallowPaidSearchchallengeLinkssettlementcreditRateShow child parameters
amountMinorcurrencypayPerCallShow child parameters
enabledamountMinorcurrencyminDurationSecdedupeHoursforwardTocapsShow child parameters
conversionsPerDayconversionsPerMonthcommissionPerMonthMinorcurrencycountriesShow child parameters
allowblockcartWindowDaysstorefrontsShow child parameters
enabledsignupPaymentGraceMinutesriskPolicyShow child parameters
holdBotScoreholdRiskScoreholdHighRiskLevelholdDisposableEmailholdVelocityholdUnverifiedEmailholdSelfReferralminCustomerAgeDaysminCustomerAgeActionhold (default): the commission line is earned but held until you approve it. void: earns nothing.requirePriorPaymentwidgetShow child parameters
autoEnrolldestinationUrlmobileAppShow child parameters
iosShow child parameters
teamIdbundleIdandroidShow child parameters
packageNamesha256CertFingerprintshowItWorksMdbrandShow child parameters
namemerchant on the public page, the join page title, partner emails.logoUrltheme--r-accent, …) laid over the org theme.supportUrllinkDomainPUT /v1/programs/{id}/link-domain).portalDomainemailFromShow child parameters
fromNamefromAddressreplyTologoUrlprimaryColortermsUrlfaqUrlsupportUrltrackingConsentlandingParamsShow child parameters
codeclicknotificationEmailsShow child parameters
enableddisabledtrafficSourcesShow child parameters
allowednotesexclusiveWithpriorityallowedRangeShow child parameters
minBpsmaxBpsattributionScopeproductMatchpayoutTaxFormPolicyrecordCountrymerchantCreditBpsclawbackPaidReversalspayoutsexternalRefdestinationUrl{
"name": "string",
"slug": "string",
"attributionModel": "last_click",
"cookieWindowDays": 60,
"signupToConversionDays": 365,
"termsMd": "",
"status": "draft",
"publicHandle": "string",
"publicPage": {
"pitch": "string",
"autoApprove": true,
"noindex": true
},
"probabilisticPolicy": "auto",
"selfReferralPolicy": "review",
"splitCommissions": true,
"utmTemplate": {},
"allowPaidSearch": true,
"challengeLinks": true,
"settlement": "payout",
"creditRate": {
"amountMinor": 0,
"currency": "string"
},
"payPerCall": {
"enabled": true,
"amountMinor": 0,
"currency": "string",
"minDurationSec": 0,
"dedupeHours": 0,
"forwardTo": "string"
},
"caps": {
"conversionsPerDay": 0,
"conversionsPerMonth": 0,
"commissionPerMonthMinor": 0,
"currency": "string"
},
"countries": {
"allow": [
"string"
],
"block": [
"string"
]
},
"cartWindowDays": 0,
"storefronts": {
"enabled": true
},
"signupPaymentGraceMinutes": 0,
"riskPolicy": {
"holdBotScore": 0,
"holdRiskScore": 0,
"holdHighRiskLevel": true,
"holdDisposableEmail": true,
"holdVelocity": 0,
"holdUnverifiedEmail": true,
"holdSelfReferral": true,
"minCustomerAgeDays": 0,
"minCustomerAgeAction": "hold",
"requirePriorPayment": "hold"
},
"widget": {
"autoEnroll": true,
"destinationUrl": "string"
},
"mobileApp": {
"ios": {
"teamId": "string",
"bundleId": "string"
},
"android": {
"packageName": "string",
"sha256CertFingerprints": [
"string"
]
}
},
"howItWorksMd": "string",
"brand": {
"name": "string",
"logoUrl": "string",
"theme": {},
"supportUrl": "string",
"linkDomain": "string",
"portalDomain": "string",
"emailFrom": {
"fromName": "string",
"fromAddress": "string",
"replyTo": "string",
"logoUrl": "string",
"primaryColor": "string"
}
},
"termsUrl": "string",
"faqUrl": "string",
"supportUrl": "string",
"trackingConsent": "auto",
"landingParams": {
"code": "string",
"click": "string"
},
"notificationEmails": {
"enabled": true,
"disabled": [
"*"
]
},
"trafficSources": {
"allowed": [
"content"
],
"notes": "string"
},
"exclusiveWith": [
"string"
],
"priority": 0,
"allowedRange": {
"minBps": 0,
"maxBps": 0
},
"attributionScope": "customer",
"productMatch": "optional",
"payoutTaxFormPolicy": "required",
"recordCountry": true,
"merchantCreditBps": 0,
"clawbackPaidReversals": true,
"payouts": "runs",
"externalRef": "string",
"destinationUrl": "string"
}Code samples
cURL
curl -X POST "https://referalli.com/v1/programs" \
-H "Authorization: Bearer $REFERALLI_API_KEY" \
-H "Idempotency-Key: <value>" \
-H "x-org-id: <value>" \
-H "referalli-mode: <value>" \
-H "Content-Type: application/json" \
-d '{"name":"string","slug":"string","attributionModel":"last_click","cookieWindowDays":60,"signupToConversionDays":365,"termsMd":"","status":"draft","publicHandle":"string","publicPage":{"pitch":"string","autoApprove":true,"noindex":true},"probabilisticPolicy":"auto","selfReferralPolicy":"review","splitCommissions":true,"utmTemplate":{},"allowPaidSearch":true,"challengeLinks":true,"settlement":"payout","creditRate":{"amountMinor":0,"currency":"string"},"payPerCall":{"enabled":true,"amountMinor":0,"currency":"string","minDurationSec":0,"dedupeHours":0,"forwardTo":"string"},"caps":{"conversionsPerDay":0,"conversionsPerMonth":0,"commissionPerMonthMinor":0,"currency":"string"},"countries":{"allow":["string"],"block":["string"]},"cartWindowDays":0,"storefronts":{"enabled":true},"signupPaymentGraceMinutes":0,"riskPolicy":{"holdBotScore":0,"holdRiskScore":0,"holdHighRiskLevel":true,"holdDisposableEmail":true,"holdVelocity":0,"holdUnverifiedEmail":true,"holdSelfReferral":true,"minCustomerAgeDays":0,"minCustomerAgeAction":"hold","requirePriorPayment":"hold"},"widget":{"autoEnroll":true,"destinationUrl":"string"},"mobileApp":{"ios":{"teamId":"string","bundleId":"string"},"android":{"packageName":"string","sha256CertFingerprints":["string"]}},"howItWorksMd":"string","brand":{"name":"string","logoUrl":"string","theme":{},"supportUrl":"string","linkDomain":"string","portalDomain":"string","emailFrom":{"fromName":"string","fromAddress":"string","replyTo":"string","logoUrl":"string","primaryColor":"string"}},"termsUrl":"string","faqUrl":"string","supportUrl":"string","trackingConsent":"auto","landingParams":{"code":"string","click":"string"},"notificationEmails":{"enabled":true,"disabled":["*"]},"trafficSources":{"allowed":["content"],"notes":"string"},"exclusiveWith":["string"],"priority":0,"allowedRange":{"minBps":0,"maxBps":0},"attributionScope":"customer","productMatch":"optional","payoutTaxFormPolicy":"required","recordCountry":true,"merchantCreditBps":0,"clawbackPaidReversals":true,"payouts":"runs","externalRef":"string","destinationUrl":"string"}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
Example
{
"id": "string",
"name": "string",
"slug": "string",
"attributionModel": "last_click",
"cookieWindowDays": 0,
"signupToConversionDays": 0,
"termsMd": "string",
"status": "draft",
"publicHandle": "string",
"settings": {
"probabilisticPolicy": "string",
"selfReferralPolicy": "review",
"splitCommissions": true,
"utmTemplate": {},
"allowPaidSearch": true,
"challengeLinks": true,
"settlement": "payout",
"cartWindowDays": 0,
"caps": {
"conversionsPerDay": 0,
"conversionsPerMonth": 0,
"commissionPerMonthMinor": 0,
"currency": "string"
},
"countries": {
"allow": [
"string"
],
"block": [
"string"
]
},
"creditRate": {
"amountMinor": 0,
"currency": "string"
},
"payPerCall": {
"enabled": true,
"amountMinor": 0,
"currency": "string",
"minDurationSec": 0,
"dedupeHours": 0,
"forwardTo": "string"
},
"allowedRange": {
"minBps": 0,
"maxBps": 0
},
"trafficSources": {
"allowed": [
"string"
],
"notes": "string"
},
"exclusiveWith": [
"string"
],
"priority": 0,
"attributionScope": "customer",
"productMatch": "optional",
"payoutTaxFormPolicy": "required",
"clawbackPaidReversals": true,
"payouts": "runs",
"merchantCreditBps": 0,
"landingParams": {
"code": "string",
"click": "string"
},
"recordCountry": true,
"storefronts": {
"enabled": true
},
"signupPaymentGraceMinutes": 0,
"riskPolicy": {
"holdBotScore": 0,
"holdDisposableEmail": true,
"holdVelocity": 0,
"holdUnverifiedEmail": true,
"holdSelfReferral": true,
"holdRiskScore": 0,
"holdHighRiskLevel": true,
"minCustomerAgeDays": 0,
"minCustomerAgeAction": "hold",
"requirePriorPayment": "hold"
},
"widget": {
"autoEnroll": true,
"destinationUrl": "string"
},
"refereeReward": {},
"mobileApp": {
"ios": {
"teamId": "string",
"bundleId": "string"
},
"android": {
"packageName": "string",
"sha256CertFingerprints": [
"string"
]
}
},
"notificationEmails": {
"enabled": true,
"disabled": [
"string"
]
},
"howItWorksMd": "string"
},
"publicPage": {
"pitch": "string",
"autoApprove": true,
"noindex": true
},
"brand": {
"name": "string",
"logoUrl": "string",
"theme": {},
"supportUrl": "string",
"linkDomain": "string",
"portalDomain": "string",
"emailFrom": {
"fromName": "string",
"fromAddress": "string",
"replyTo": "string",
"logoUrl": "string",
"primaryColor": "string"
}
},
"termsUrl": "string",
"faqUrl": "string",
"supportUrl": "string",
"trackingConsent": "string",
"externalRef": "string",
"createdAt": "2024-01-01T00:00:00Z"
}Schema
idnameslugattributionModelcookieWindowDayssignupToConversionDaystermsMdstatuspublicHandlesettingsShow child parameters
probabilisticPolicyselfReferralPolicysplitCommissionsutmTemplateallowPaidSearchchallengeLinkssettlementcartWindowDayscartAdd, made while the visitor's referral was live) can credit its line when the order arrives with no live referral. 0 turns it off.capswithheld: cap_reached). Empty when unset.Show child parameters
conversionsPerDayconversionsPerMonthcommissionPerMonthMinorcurrencycountrieswithheld: outside_countries). Unknown country is allowed.Show child parameters
allowblockcreditRatecommission.settled then carries credits. Null when unset.Show child parameters
amountMinorcurrencypayPerCallPUT /v1/call-connections/{provider}). A call that is answered, lasts at least minDurationSec and is not from a caller who already had a paid call in this program within dedupeHours pays the partner amountMinor once. forwardTo is the E.164 line Twilio numbers ring. Off by default.Show child parameters
enabledamountMinorcurrencyminDurationSecdedupeHoursforwardToallowedRangeShow child parameters
minBpsmaxBpstrafficSourcestrafficMismatch.Show child parameters
allowednotesexclusiveWithpriority one (earliest referral breaks a tie).priorityexclusiveWith; default 0.attributionScopecustomer (default): one referral per customer. payment: each payment is attributed from the customer's eligible clicks or coupon inside the window before it; no long-lived referral.productMatchrequired (payment scope), an order line is credited only by clicks whose productRef equals the line's product id or sku.payoutTaxFormPolicyrequired or delegated (a partner paid by stripe_connect with a stripeAccountId is paid without a Referalli tax form). Null inherits the org's payoutTaxFormPolicy.clawbackPaidReversalspayout.clawback_recorded), deducted from their next payout in the same currency. Lines settled as merchant or store credit are not clawed back.payoutsruns. external: you pay this program's partners yourself, outside Referalli; payout runs skip its lines (external_payouts), the partner portal and partner emails ask for no payout details for it, and the portal says "Paid directly by <brand name>". Record the payments with POST /v1/commissions/settle (method: "external").merchantCreditBpspayout program settles as merchant credit at once: the line is recorded as two lines, a cash share paid by payout runs and a merchant credit share settled as merchant_credit (commission.settled). Refunds reverse both shares pro rata. Ignored when settlement is merchant_credit and for custom units.landingParams/go/ redirect lands with: code (default via) carries the partner code, click (default ref_click_id) the click id. Echoed in /t/{token}/config.json; aff.js and the kits read them.Show child parameters
codeclickrecordCountryCF-IPCountry header, never from a supplied IP). Default true. False: clicks carry no country, so countries allow/block lists see an unknown country and allow it.storefrontsShow child parameters
enabledsignupPaymentGraceMinutesriskPolicyShow child parameters
holdBotScoreholdDisposableEmailholdVelocityholdUnverifiedEmailholdSelfReferralholdRiskScoreholdHighRiskLevelminCustomerAgeDaysminCustomerAgeActionrequirePriorPaymentwidgetShow child parameters
autoEnrolldestinationUrlrefereeRewardmobileAppShow child parameters
iosandroidnotificationEmailsenabled: false turns those off; disabled lists any partner email ids to switch off (payout_sent, partner_approved, invitation_received, contract_sent, tax_document_ready, ...) or "*" for every partner email. Webhooks still fire.Show child parameters
enableddisabledhowItWorksMdpublicPageShow child parameters
pitchautoApprovenoindexbrandShow child parameters
namelogoUrlthemesupportUrllinkDomainportalDomainemailFromShow child parameters
fromNamefromAddressreplyTologoUrlprimaryColortermsUrlerror.code is one of:Example
{
"error": {
"code": "validation_error",
"message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
"details": [
{
"code": "invalid_format",
"path": [
"destinationUrl"
],
"message": "Invalid URL"
}
],
"docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
}
}{
"error": {
"code": "mode_mismatch",
"message": "the `referalli-mode` header disagrees with the api key's mode",
"docs_url": "https://referalli.com/docs/errors-and-limits#mode_mismatch"
}
}{
"error": {
"code": "bad_request",
"message": "rejected by the http layer before the handler",
"docs_url": "https://referalli.com/docs/errors-and-limits#bad_request"
}
}{
"error": {
"code": "invalid_handoff_token",
"message": "`handofftoken` on `associate` is malformed, expired (24 hours), signed for another org, or its signature does not verify",
"docs_url": "https://referalli.com/docs/errors-and-limits#invalid_handoff_token"
}
}x-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "unauthorized",
"message": "no credentials, an unknown, revoked or expired api key or session, or a signature that did not verify",
"docs_url": "https://referalli.com/docs/errors-and-limits#unauthorized"
}
}{
"error": {
"code": "step_up_required",
"message": "a partner with two-factor on must send `x-totp-code`",
"docs_url": "https://referalli.com/docs/errors-and-limits#step_up_required"
}
}{
"error": {
"code": "reauth_required",
"message": "a session that signed in too long ago changed payout details",
"docs_url": "https://referalli.com/docs/errors-and-limits#reauth_required"
}
}x-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "payment_required",
"message": "a plan limit or feature",
"docs_url": "https://referalli.com/docs/errors-and-limits#payment_required"
}
}x-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "forbidden",
"message": "the wrong role, a key without the needed scope (the message names it",
"docs_url": "https://referalli.com/docs/errors-and-limits#forbidden"
}
}{
"error": {
"code": "sso_required",
"message": "this organization requires single sign-on",
"docs_url": "https://referalli.com/docs/errors-and-limits#sso_required"
}
}{
"error": {
"code": "access_suspended",
"message": "your identity provider suspended your access and you are the last owner",
"docs_url": "https://referalli.com/docs/errors-and-limits#access_suspended"
}
}{
"error": {
"code": "unsupported_media_type",
"message": "the request body's `content-type` isn't one this endpoint reads",
"docs_url": "https://referalli.com/docs/errors-and-limits#unsupported_media_type"
}
}{
"error": {
"code": "program_scoped_key",
"message": "a key limited to some programs (`programids`) called an org-wide endpoint",
"docs_url": "https://referalli.com/docs/errors-and-limits#program_scoped_key"
}
}x-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "not_found",
"message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
"docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
}
}{
"error": {
"code": "not_enrolled",
"message": "the user is not a partner in the program (and the widget's autoenroll is off, or no verified email was given)",
"docs_url": "https://referalli.com/docs/errors-and-limits#not_enrolled"
}
}x-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "conflict",
"message": "a unique value is taken, or the action would break a rule (the message says which)",
"docs_url": "https://referalli.com/docs/errors-and-limits#conflict"
}
}{
"error": {
"code": "billing_connection_no_key",
"message": "the stripe billing connection keeps no key to reuse for payouts (only one connected with `stripekey` and `creditrail` does)",
"docs_url": "https://referalli.com/docs/errors-and-limits#billing_connection_no_key"
}
}{
"error": {
"code": "api_key_expired",
"message": "this key has expired, so it can no longer be rotated",
"docs_url": "https://referalli.com/docs/errors-and-limits#api_key_expired"
}
}{
"error": {
"code": "idempotency_in_progress",
"message": "a request with the same `idempotency-key` is still running",
"docs_url": "https://referalli.com/docs/errors-and-limits#idempotency_in_progress"
}
}{
"error": {
"code": "stripe_key_required",
"message": "stripe balance credits need a stripe key",
"docs_url": "https://referalli.com/docs/errors-and-limits#stripe_key_required"
}
}x-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "idempotency_key_reused",
"message": "the `idempotency-key` was used for a different request",
"docs_url": "https://referalli.com/docs/errors-and-limits#idempotency_key_reused"
}
}{
"error": {
"code": "validation_error",
"message": "on the signed auth-connection endpoints",
"docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
}
}{
"error": {
"code": "stripe_key_invalid",
"message": "stripe rejected the stripe balance credit key (revoked, rolled or mistyped)",
"docs_url": "https://referalli.com/docs/errors-and-limits#stripe_key_invalid"
}
}{
"error": {
"code": "stripe_key_wrong_mode",
"message": "a stripe balance credit key of the other mode",
"docs_url": "https://referalli.com/docs/errors-and-limits#stripe_key_wrong_mode"
}
}{
"error": {
"code": "stripe_key_permission",
"message": "the restricted stripe key lacks a permission the call needs (webhook endpoints write",
"docs_url": "https://referalli.com/docs/errors-and-limits#stripe_key_permission"
}
}x-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "rate_limited",
"message": "an endpoint limit or the per-key quota was exceeded",
"docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
}
}x-request-idreq_…), matching the server logs. On every response.Retry-AfterRateLimit-LimitRateLimit-RemainingRateLimit-Reseterror.code is one of:Example
{
"error": {
"code": "internal_error",
"message": "retry with backoff",
"requestId": "req_8f2c1d4e5a6b7c8d",
"docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
}
}x-request-idreq_…), matching the server logs. On every response.{
"error": {
"code": "string",
"message": "string",
"details": {},
"requestId": "string",
"docs_url": "string"
}
}