SDKs
Official client libraries for the Affilync API. Every SDK shares the same design — typed responses, auto-pagination, automatic retries, and webhook verification — so the concepts below apply no matter which language you pick.
Install
| Language | Package | Install |
|---|---|---|
| Node.js / TypeScript | @affilync/sdk | npm install @affilync/sdk |
| Python | affilync | pip install affilync |
| Ruby | affilync | gem install affilync |
| PHP | affilync/sdk | composer require affilync/sdk |
| Go | github.com/affilync/go-sdk | go get github.com/affilync/go-sdk |
| .NET / C# | Affilync.SDK | dotnet add package Affilync.SDK |
Quick start
Grab an API key from your API settings, then create a client and make your first call.
Node.js / TypeScript
import Affilync from '@affilync/sdk';
const client = new Affilync('af_live_...');
const campaign = await client.campaigns.create({
name: 'My Campaign',
type: 'affiliate',
commission_type: 'percentage',
commission_rate: 0.15,
});
Python
import affilync
client = affilync.Affilync(api_key="af_live_...")
campaign = client.campaigns.create(
name="My Campaign",
type="affiliate",
commission_type="percentage",
commission_rate=0.15,
)
Ruby
require 'affilync'
client = Affilync::Client.new(api_key: 'af_live_...')
campaign = client.campaigns.create(
name: 'My Campaign',
type: 'affiliate',
commission_type: 'percentage',
commission_rate: 0.15
)
PHP
$client = new \Affilync\AffilyncClient('af_live_...');
$campaign = $client->campaigns->create([
'name' => 'My Campaign',
'type' => 'affiliate',
'commission_type' => 'percentage',
'commission_rate' => 0.15,
]);
Go
client := affilync.New("af_live_...")
campaign, err := client.Campaigns.Create(ctx, &affilync.CampaignCreateParams{
Name: "My Campaign",
Type: affilync.CampaignTypeAffiliate,
CommissionType: affilync.CommissionTypePercentage,
CommissionRate: affilync.Float64(0.15),
})
C# / .NET
var client = new AffilyncClient("af_live_...");
var campaign = await client.Campaigns.CreateAsync(new CampaignCreateOptions {
Name = "My Campaign",
Type = CampaignType.Affiliate,
CommissionType = CommissionType.Percentage,
CommissionRate = 0.15m,
});
What every SDK gives you
- Typed responses — full type definitions for every API resource.
- Auto-pagination — iterate through all pages without managing cursors.
- Automatic retries — exponential backoff on
429and5xxresponses. - Webhook verification — built-in HMAC-SHA256 signature validation.
- Typed errors — a distinct exception per HTTP status code.
- Idempotency — auto-generated idempotency keys for
POST/DELETErequests. - Rate-limit info — surfaced on every response.
API resources
Each SDK exposes the same resources and methods:
| Resource | Methods |
|---|---|
campaigns | create, retrieve, update, list, delete, pause, resume |
links | create, retrieve, update, list, delete, batch_create |
clicks | list, retrieve |
conversions | create, retrieve, list, verify |
analytics | dashboard, metrics, reports, export, realtime |
payments | create, retrieve, list, refund |
payouts | request, retrieve, list |
subscriptions | create, retrieve, update, cancel, upgrade |
marketplace | search, campaigns, brands, apply |
ai | chat, generate_script, generate_image, voiceover |
call_tracking | numbers.list, numbers.purchase, calls.list, analytics |
media | upload, list, retrieve, delete, create_folder |
webhooks | construct_event |
Authentication
All SDKs use API key authentication:
- Production keys start with
af_live_ - Test / sandbox keys start with
af_test_
Create and manage keys at app.affilync.com/settings/api. For the full auth flow (including JWT sessions and token refresh) see Authentication.
Webhook events
Verify the signature on every incoming webhook with your SDK's webhooks.construct_event helper, then handle the events you care about:
| Event | Description |
|---|---|
campaign.created | New campaign created |
campaign.updated | Campaign updated |
campaign.completed | Campaign ended |
link.created | New link created |
link.clicked | Link received a click |
conversion.created | New conversion tracked |
conversion.approved | Conversion approved |
conversion.rejected | Conversion rejected |
payout.requested | Payout requested |
payout.completed | Payout sent |
payout.failed | Payout failed |
subscription.created | New subscription |
subscription.cancelled | Subscription cancelled |
call.completed | Call finished |
call.qualified | Call qualified for payout |
See the full Webhooks reference for payload shapes and signature verification details.
Next steps
- Authentication — keys, JWT, and token refresh
- API Reference — every endpoint, parameter, and response
- Webhooks — events, payloads, and signature verification
- Errors & Rate Limits — status codes, retries, and limits