Programy poleceń
Endpointy „Programy poleceń” Zanfia Workspace API — ze schematami i przykładami kodu.
Programy poleceń (Marketing → Polecenia): program obejmuje jeden lub więcej Twoich produktów i nagradza uczestników za polecone zakupy według drabinki progów (kind: referral; warunki prowizyjne affiliate są zamodelowane, ale jeszcze nie działają). Programy startują jako inactive — aktywuj je przez PATCH. Uczestnicy to Twoi klienci: zapisz jednego po id klienta albo od razu wszystkich klientów produktów programu; każdy dostaje kod polecający, który wędruje jako ?ref= przez koszyk. Nagrody z approval: manual czekają w pendingRewards na Twoją decyzję; nieudane dostarczenia trafiają do failedDeliveries do ponowienia. Wszystkie endpointy wymagają nagłówka Authorization: Bearer — zobacz Uwierzytelnianie.
Lista programów poleceń
/referral-programsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/referral-programs"{ "programs": [ { "id": "string", "kind": "referral", "name": "string", "status": "active", "productIds": [ "string" ], "attribution": { "windowDays": 0, "allowCouponAttribution": true, "twoSidedDiscountId": "string" }, "enrollment": "open", "milestones": [ { "id": "string", "threshold": 0, "recurring": true, "approval": "automatic", "reward": { "type": "productAccess", "productId": "string", "priceId": "string", "accessDays": 0 }, "emailTemplate": { "subject": "string", "html": "string" } } ], "commission": { "type": "percent", "value": 0, "appliesTo": "firstOrder", "holdDays": 0 }, "stats": { "participants": 0, "validReferrals": 0, "invalidReferrals": 0, "rewardsEarned": 0, "rewardsPendingApproval": 0, "rewardsDelivered": 0 }, "createdAt": "string", "updatedAt": "string" } ]}{ "error": "string", "message": "string"}Utwórz program poleceń
/referral-programsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Referrals 2.0 creator-side HTTP contract (products-service products.v1).
Response Body
application/json
application/json
curl -X POST "https://example.com/referral-programs" \ -H "Content-Type: application/json" \ -d '{ "kind": "referral", "name": "string", "productIds": [ "string" ] }'{ "program": { "id": "string", "kind": "referral", "name": "string", "status": "active", "productIds": [ "string" ], "attribution": { "windowDays": 0, "allowCouponAttribution": true, "twoSidedDiscountId": "string" }, "enrollment": "open", "milestones": [ { "id": "string", "threshold": 0, "recurring": true, "approval": "automatic", "reward": { "type": "productAccess", "productId": "string", "priceId": "string", "accessDays": 0 }, "emailTemplate": { "subject": "string", "html": "string" } } ], "commission": { "type": "percent", "value": 0, "appliesTo": "firstOrder", "holdDays": 0 }, "stats": { "participants": 0, "validReferrals": 0, "invalidReferrals": 0, "rewardsEarned": 0, "rewardsPendingApproval": 0, "rewardsDelivered": 0 }, "createdAt": "string", "updatedAt": "string" }}{ "error": "string", "message": "string"}Szczegóły programu (panel)
/referral-programs/{programId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X GET "https://example.com/referral-programs/string"{ "program": { "id": "string", "kind": "referral", "name": "string", "status": "active", "productIds": [ "string" ], "attribution": { "windowDays": 0, "allowCouponAttribution": true, "twoSidedDiscountId": "string" }, "enrollment": "open", "milestones": [ { "id": "string", "threshold": 0, "recurring": true, "approval": "automatic", "reward": { "type": "productAccess", "productId": "string", "priceId": "string", "accessDays": 0 }, "emailTemplate": { "subject": "string", "html": "string" } } ], "commission": { "type": "percent", "value": 0, "appliesTo": "firstOrder", "holdDays": 0 }, "stats": { "participants": 0, "validReferrals": 0, "invalidReferrals": 0, "rewardsEarned": 0, "rewardsPendingApproval": 0, "rewardsDelivered": 0 }, "createdAt": "string", "updatedAt": "string" }, "participants": [ { "id": "string", "clientId": "string", "refCode": "string", "email": "string", "firstName": "string", "lastName": "string", "status": "active", "enrolledVia": "self", "stats": { "validReferrals": 0, "invalidReferrals": 0, "pendingReferrals": 0, "rewardsEarned": 0, "rewardsDelivered": 0, "accruedCommission": 0, "reversedCommission": 0 }, "createdAt": "string", "updatedAt": "string" } ], "pendingRewards": [ { "id": "string", "participantId": "string", "refCode": "string", "type": "referral", "milestoneId": "string", "milestoneOccurrence": 0, "rewardType": "productAccess", "approval": "automatic", "rewardStatus": "pendingApproval", "deliveredAt": "string", "createdAt": "string", "updatedAt": "string" } ], "failedDeliveries": [ { "id": "string", "participantId": "string", "refCode": "string", "type": "referral", "milestoneId": "string", "milestoneOccurrence": 0, "rewardType": "productAccess", "approval": "automatic", "rewardStatus": "pendingApproval", "deliveredAt": "string", "createdAt": "string", "updatedAt": "string" } ]}{ "error": "string", "message": "string"}Aktualizuj program poleceń
/referral-programs/{programId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X PATCH "https://example.com/referral-programs/string" \ -H "Content-Type: application/json" \ -d '{}'{ "program": { "id": "string", "kind": "referral", "name": "string", "status": "active", "productIds": [ "string" ], "attribution": { "windowDays": 0, "allowCouponAttribution": true, "twoSidedDiscountId": "string" }, "enrollment": "open", "milestones": [ { "id": "string", "threshold": 0, "recurring": true, "approval": "automatic", "reward": { "type": "productAccess", "productId": "string", "priceId": "string", "accessDays": 0 }, "emailTemplate": { "subject": "string", "html": "string" } } ], "commission": { "type": "percent", "value": 0, "appliesTo": "firstOrder", "holdDays": 0 }, "stats": { "participants": 0, "validReferrals": 0, "invalidReferrals": 0, "rewardsEarned": 0, "rewardsPendingApproval": 0, "rewardsDelivered": 0 }, "createdAt": "string", "updatedAt": "string" }}{ "error": "string", "message": "string"}Archiwizuj program poleceń
/referral-programs/{programId}/archiveAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X POST "https://example.com/referral-programs/string/archive"{ "archived": true}{ "error": "string", "message": "string"}Zapisz klienta do programu
/referral-programs/{programId}/participantsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/referral-programs/string/participants" \ -H "Content-Type: application/json" \ -d '{ "clientId": "string", "email": "string" }'{ "participant": { "id": "string", "clientId": "string", "refCode": "string", "email": "string", "firstName": "string", "lastName": "string", "status": "active", "enrolledVia": "self", "stats": { "validReferrals": 0, "invalidReferrals": 0, "pendingReferrals": 0, "rewardsEarned": 0, "rewardsDelivered": 0, "accruedCommission": 0, "reversedCommission": 0 }, "createdAt": "string", "updatedAt": "string" }, "alreadyEnrolled": true}{ "error": "string", "message": "string"}Zapisz wszystkich klientów produktów programu
/referral-programs/{programId}/participants/enroll-allAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X POST "https://example.com/referral-programs/string/participants/enroll-all"{ "enrolled": 0, "alreadyEnrolled": 0, "skippedWithoutAccount": 0}{ "error": "string", "message": "string"}Zatwierdź lub odrzuć oczekującą nagrodę
/referral-programs/{programId}/rewards/{entryId}/resolveAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/referral-programs/string/rewards/string/resolve" \ -H "Content-Type: application/json" \ -d '{ "decision": "approve" }'{ "decision": "approve", "delivered": true}{ "error": "string", "message": "string"}Ponów nieudane dostarczenie nagrody
/referral-programs/{programId}/rewards/{entryId}/retry-deliveryAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X POST "https://example.com/referral-programs/string/rewards/string/retry-delivery"{ "delivered": true}{ "error": "string", "message": "string"}Czy ten artykuł był pomocny?

