Zamówienia, statystyki i rabaty
Endpointy „Zamówienia, statystyki i rabaty” Zanfia Workspace API — ze schematami i przykładami kodu.
Historia zamówień, analityka workspace i zarządzanie rabatami. Endpointy statystyk przyjmują okres (?period=7d) lub jawne from/to, plus filtr currency. Wszystkie endpointy wymagają nagłówka Authorization: Bearer — zobacz Uwierzytelnianie.
Lista zamówień
/ordersAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Query Parameters
Response Body
application/json
application/json
curl -X GET "https://example.com/orders"{ "items": [ { "id": "string", "productId": "string", "clientEmail": "string", "amountCents": 0, "currency": "string", "status": "paid", "createdAt": "string" } ], "nextCursor": "string"}{ "error": "string"}Eksportuj zamówienia do CSV
/orders/exportAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Query Parameters
Window start (ISO date, inclusive). Required.
Window end (ISO date, inclusive). Required.
Only orders of this product.
Public status filter: paid, pending, refunded, failed.
Client email/name substring.
true includes simulated test purchases (excluded by default).
Row cap: default 10000, max 20000.
Response Body
application/json
application/json
curl -X GET "https://example.com/orders/export?from=string&to=string"{ "csv": "string", "rowCount": 0, "truncated": true}{ "error": "string"}Szczegóły zamówienia
/orders/{orderId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Order id
Response Body
application/json
application/json
curl -X GET "https://example.com/orders/string"{ "id": "string", "productId": "string", "clientEmail": "string", "amountCents": 0, "currency": "string", "status": "paid", "createdAt": "string", "productName": "string", "clientName": "string", "internalStatus": "string", "paymentType": "string", "paymentGateway": "string", "quantity": 0, "couponCode": "string", "isTest": true, "invoiceUrl": "string", "refund": { "amountCents": 0, "currency": "string" }, "additionalProducts": [ { "productId": "string", "productName": "string", "priceId": "string", "quantity": 0, "amountCents": 0, "currency": "string" } ]}{ "error": "string"}Approve manual order
/orders/{orderId}/approve-paymentAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Order id
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Optional body of POST /orders/:orderId/approve-payment. issueInvoice additionally issues an invoice via the workspace's connected invoicing account (checkout selection → workspace default → first connected account); manual orders never issue invoices without this explicit request.
Response Body
application/json
application/json
curl -X POST "https://example.com/orders/string/approve-payment" \ -H "Content-Type: application/json" \ -d '{}'{ "status": "ok"}{ "error": "string"}Reject manual order
/orders/{orderId}/reject-paymentAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Order id
Response Body
application/json
application/json
curl -X POST "https://example.com/orders/string/reject-payment"{ "status": "ok"}{ "error": "string"}Kluczowe metryki sprzedaży
/stats/overviewAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Query Parameters
Response Body
application/json
application/json
curl -X GET "https://example.com/stats/overview?period=7d"{ "totalRevenueCents": 0, "currency": "string", "totalOrders": 0, "period": { "from": "string", "to": "string" }}{ "error": "string"}Sprzedaż w czasie
/stats/salesAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/stats/sales"{ "currency": "string", "totalRevenueCents": 0, "transactions": 0, "refunds": 0, "averageOrderValueCents": 0, "newSubscribers": 0, "byDay": [ { "date": "string", "revenueCents": 0, "transactions": 0, "newSubscribers": 0 } ], "perProduct": [ { "id": "string", "name": "string", "transactions": 0, "refunds": 0, "revenueCents": 0 } ], "perCheckout": [ { "id": "string", "name": "string", "transactions": 0, "refunds": 0, "revenueCents": 0 } ], "period": { "from": "string", "to": "string" }}{ "error": "string"}Przychód cykliczny (MRR)
/stats/recurringAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/stats/recurring"{ "currency": "string", "mrrCents": 0, "arrCents": 0, "mrrByCurrencyCents": { "property1": 0, "property2": 0 }, "arrByCurrencyCents": { "property1": 0, "property2": 0 }, "activeSubscriptions": 0, "atRiskMrrCents": 0, "pausedMrrCents": 0, "endingSoonCount": 0, "perProduct": [ { "productId": "string", "productName": "string", "mrrCents": 0, "activeSubscriptions": 0 } ]}{ "error": "string"}Historia MRR
/stats/recurring/historyAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/stats/recurring/history"{ "currency": "string", "points": [ { "date": "string", "mrrCents": 0, "activeSubscriptions": 0, "newMrrCents": 0, "expansionMrrCents": 0, "contractionMrrCents": 0, "churnedMrrCents": 0, "churnRate": 0 } ]}{ "error": "string"}Lejek zakupowy
/stats/funnelAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/stats/funnel"{ "totals": { "sessions": 0, "formStarted": 0, "paymentStarted": 0, "completed": 0, "abandoned": 0, "otoViewed": 0, "otoAccepted": 0, "otoDeclined": 0 }, "byCheckout": [ { "checkoutId": "string", "checkoutName": "string", "isFree": true, "productId": "string", "stats": { "sessions": 0, "formStarted": 0, "paymentStarted": 0, "completed": 0, "abandoned": 0, "otoViewed": 0, "otoAccepted": 0, "otoDeclined": 0 } } ], "byDay": [ { "date": "string", "stats": { "sessions": 0, "formStarted": 0, "paymentStarted": 0, "completed": 0, "abandoned": 0, "otoViewed": 0, "otoAccepted": 0, "otoDeclined": 0 } } ], "period": { "from": "string", "to": "string" }}{ "error": "string"}Ruch
/stats/trafficAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/stats/traffic"{ "totals": { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 } }, "pages": [ { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 }, "surface": "storefront", "pageId": "string" } ], "sources": [ { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 }, "source": "string" } ], "mediums": [ { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 }, "key": "string" } ], "campaigns": [ { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 }, "key": "string" } ], "referrers": [ { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 }, "key": "string" } ], "countries": [ { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 }, "key": "string" } ], "devices": [ { "views": 0, "entries": 0, "purchases": 0, "revenueMinorByCurrency": { "property1": 0, "property2": 0 }, "key": "string" } ], "sourcesTruncated": true, "period": { "from": "string", "to": "string" }}{ "error": "string"}Sesje
/stats/sessionsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/stats/sessions"{ "sessions": [ { "id": "string", "checkoutId": "string", "productId": "string", "priceId": "string", "status": "active", "furthestStage": "viewed", "converted": true, "startedAt": "string", "lastSeenAt": "string", "abandonedAt": "string", "convertedAt": "string", "source": { "referrer": "string", "utmSource": "string", "utmMedium": "string", "utmCampaign": "string" }, "country": "string" } ], "period": { "from": "string", "to": "string" }}{ "error": "string"}Statystyki produktu
/products/{productId}/statsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Product id
Response Body
application/json
application/json
curl -X GET "https://example.com/products/string/stats"{ "productId": "string", "currency": "string", "window": { "startDate": "string", "endDate": "string" }, "revenue": { "totalCents": 0, "previousTotalCents": 0, "byDay": [ { "date": "string", "revenueCents": 0, "newStudents": 0 } ] }, "students": { "newInWindow": 0, "previousNewInWindow": 0, "churnedInWindow": 0 }, "progress": { "tracked": 0, "completedCourse": 0, "activeLast7Days": 0, "lessonEngagement": { "property1": { "started": 0, "completed": 0 }, "property2": { "started": 0, "completed": 0 } } }, "attention": { "failedRenewalsInWindow": 0, "pastDueSubscriptions": 0 }, "quizzes": { "property1": { "attempts": 0, "passed": 0 }, "property2": { "attempts": 0, "passed": 0 } }, "activity": [ { "eventName": "user.UserCreated", "timestamp": 0, "clientEmail": "string", "clientName": "string" } ], "community": { "unansweredPosts": 0, "oldestUnanswered": { "postId": "string", "channelId": "string", "title": "string", "createdAt": 0 }, "openTickets": 0, "unassignedTickets": 0, "unreadRepliesAndMentions": 0, "postsThisWeek": 0, "postsPreviousWeek": 0 }}{ "error": "string"}Lista rabatów
/discountsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/discounts"{ "items": [ { "id": "string", "code": "string", "percentOff": 0, "amountOffCents": 0, "currency": "string", "active": true, "usageCount": 0 } ]}{ "error": "string"}Utwórz rabat
/discountsAuthorization
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.
Response Body
application/json
application/json
curl -X POST "https://example.com/discounts" \ -H "Content-Type: application/json" \ -d '{ "code": "string" }'{ "id": "string", "code": "string", "percentOff": 0, "amountOffCents": 0, "currency": "string", "active": true, "usageCount": 0}{ "error": "string"}Aktualizuj rabat
/discounts/{discountId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Discount id
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/discounts/string" \ -H "Content-Type: application/json" \ -d '{}'{ "id": "string", "code": "string", "percentOff": 0, "amountOffCents": 0, "currency": "string", "active": true, "usageCount": 0}{ "error": "string"}Usuń rabat
/discounts/{discountId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Discount id
Response Body
application/json
application/json
curl -X DELETE "https://example.com/discounts/string"{ "deleted": true}{ "error": "string"}Archiwizuj rabat
/discounts/{discountId}/archiveAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Discount id
Response Body
application/json
application/json
curl -X POST "https://example.com/discounts/string/archive"{ "archived": true}{ "error": "string"}Czy ten artykuł był pomocny?

