Referencja API
Wszystkie endpointy public API. Base URL: https://api.affily.pl
Authentication
Authorization: Bearer aff_pk_live_xxxRate limit
1000 req/min/keyContent type
application/jsonEndpointy
POST
/v1/conversionsRejestruje konwersję
Request body
{
"click_id": "click_xxx",
"offer_id": "off_xxx",
"order_id": "ORDER-001",
"amount": 250.00,
"currency": "PLN",
"metadata": {...}
}Response
{
"id": "conv_xxx",
"status": "pending",
"commission": 25.00,
"hold_until": "2026-..."
}GET
/v1/conversionsLista konwersji (cursor pagination, limit 500)
Query params
?status=approved&from=2026-01-01&cursor=conv_xxxResponse
{
"data": [...],
"next_cursor": "conv_yyy",
"has_more": true
}PATCH
/v1/conversions/:idApprove / reject / dispute konwersji
Request body
{
"status": "approved" | "rejected",
"rejection_reason": "returned" | "chargeback" | "duplicate" | "offer_terms_violation" | "fraud" | "other",
"rejection_note": "string"
}GET
/v1/accountInfo o koncie + statystyki MTD
Response
{
"advertiser": { "id": "...", "company_name": "..." },
"deposit_balance": 4250.00,
"stats_mtd": {
"clicks": 1234,
"conversions": 56,
"commission_paid": 1234.50
}
}GET
/v1/offersLista własnych ofert
POST
/v1/depositsTworzy depozyt (Stripe / Sunrise Pay / proforma)
Request body
{
"amount": 1000,
"currency": "PLN",
"method": "stripe" | "sunrise_pay" | "transfer" | "proforma",
"return_url": "https://your-app.com/success"
}Response
{
"id": "dep_xxx",
"status": "pending_payment",
"payment_url": "https://checkout.stripe.com/...",
"expires_at": "..."
}Kody błędów
| Status | Kod | Opis |
|---|---|---|
| 400 | validation_error | Nieprawidłowe dane wejściowe |
| 401 | invalid_api_key | Brak lub niepoprawny klucz API |
| 402 | insufficient_deposit | Niewystarczający depozyt reklamodawcy |
| 403 | forbidden | Brak uprawnień do zasobu |
| 404 | not_found | Zasób nie istnieje |
| 409 | duplicate_order_id | order_id już użyty |
| 410 | click_expired | Cookie window minęło |
| 422 | validation_error | Body schema validation failed |
| 429 | rate_limit | Przekroczony rate limit |
| 500 | internal_error | Błąd serwera |
Format błędu
{
"error": {
"code": "validation_error",
"message": "Invalid body",
"details": { ... }
}
}