WinFwins API Documentation

Affiliate SDK Integration Guide

Overview

Welcome to the WinFwins Affiliate SDK API documentation. This API allows you to integrate lead generation and management capabilities into your applications.

Base URL: https://api.winfx.live/api/external/integration

Key Features

Getting Started

To use the API, you'll need:

  1. API Key - Contact your manager to obtain your API key
  2. Affiliate Code (affc) - Your unique affiliate identifier
  3. Hub Code (bxc) - Your assigned hub identifier
  4. Vertical Code (vtc) - The vertical/category identifier

Authentication

All API requests must include an API key in the request headers.

Header Format

x-api-key: your-api-key-here
Important: Keep your API key secure and never share it publicly. Contact your manager if you need a new API key.

Example Request with Authentication

GET /api/external/integration/lead HTTP/1.1
Host: api.winfx.live
x-api-key: 6aca18d1-10eb-4e2f-8f1a-da0a74e52199
Content-Type: application/json

Create Lead

Submit a new lead to the WinFwins platform. This endpoint validates the lead information and returns a redirect URL for the lead.

POST /lead
POST https://api.winfx.live/api/external/integration/lead

Request Headers

Header Value Required
x-api-key Your API key REQUIRED
Content-Type application/json REQUIRED

Request Body Parameters

Parameter Type Required Description
affc string REQUIRED Your Affiliate Code (e.g., "AFF-00000000")
bxc string REQUIRED Your Hub Code (e.g., "BX-00000000")
vtc string REQUIRED Vertical Code (e.g., "VT-HP8XSRMKVS6E7")
profile object REQUIRED Lead profile information (see below)
ip string REQUIRED Lead's IP address (IPv4 or IPv6)
funnel string REQUIRED Name of your funnel
landingURL string REQUIRED URL of your landing page
geo string REQUIRED Country code (uppercase, e.g., "CA", "GB")
lang string REQUIRED Language code (lowercase, e.g., "en", "es")
landingLang string REQUIRED Landing page language (lowercase)
userAgent string OPTIONAL Lead's browser User-Agent
comment string OPTIONAL Additional information about the lead
utmSource string OPTIONAL Traffic source (e.g., "FB", "Google")
utmMedium string OPTIONAL Offer type (e.g., "CPA", "CPL")
utmCampaign string OPTIONAL Campaign name
utmId string OPTIONAL Source pixel ID (e.g., Facebook pixel ID)
subId string OPTIONAL Click ID for tracking synchronization
subId_a to subId_f string OPTIONAL Additional tracking parameters

Profile Object

Parameter Type Required Description
firstName string REQUIRED Lead's first name
lastName string REQUIRED Lead's last name
email string REQUIRED Valid email address
password string REQUIRED Account password
phone string REQUIRED Phone number without "+" prefix

Example Request

{
    "affc": "AFF-00000000",
    "bxc": "BX-00000000",
    "vtc": "VT-HP8XSRMKVS6E7",
    "profile": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "john.doe@example.com",
        "password": "SecurePass123",
        "phone": "13439105691"
    },
    "ip": "209.151.4.139",
    "funnel": "premium-funnel",
    "landingURL": "https://example.com/landing",
    "geo": "CA",
    "lang": "en",
    "landingLang": "en",
    "utmSource": "FB",
    "utmMedium": "CPL",
    "utmCampaign": "summer-2024",
    "utmId": "304304903940",
    "subId": "click-id-12345"
}

Response Examples

Success Response

201 Created
{
    "success": true,
    "redirectUrl": "https://google.com",
    "leadId": "aa99ee7b-c52b-43d0-98ba-601e5d864681"
}
Success! The lead has been created successfully. Use the redirectUrl to redirect the user.

401 - Unauthorized

401 Unauthorized
{
    "message": "Account not authorized.",
    "code": "acNA",
    "statusCode": 401
}
Error: Invalid or missing API key. Verify your authentication credentials.

404 - Not Found (Hub)

404 Not Found
{
    "success": false,
    "redirectUrl": null,
    "leadId": null,
    "error": "Hub not found."
}
Error: The specified hub was not found. Check your hub ID (bxc) parameter.

404 - Not Found (Vertical Template)

404 Not Found
{
    "success": false,
    "redirectUrl": null,
    "leadId": null,
    "error": "Vertical template not found."
}
Error: The specified vertical template was not found. Check your vertical ID (vtc) parameter.

400 - Bad Request

400 Bad Request
{
    "success": false,
    "redirectUrl": null,
    "leadId": null,
    "error": "Hub is not sendable."
}
Error: The hub is not accepting leads at this time. Contact your manager to check hub status.

404 - Not Found (No Hubs Available)

404 Not Found
{
    "success": false,
    "redirectUrl": null,
    "leadId": null,
    "error": "No hubs available for this lead."
}
Error: No hubs are available to process this lead. Contact your manager for hub configuration.

403 - Forbidden (Duplicate Profile)

403 Forbidden
{
    "success": false,
    "redirectUrl": null,
    "leadId": null,
    "error": "Lead with same profile data recently registered."
}
Error: A lead with the same profile information was recently registered. Duplicate lead prevention.

403 - Forbidden (Anti-Spam)

403 Forbidden
{
    "success": false,
    "redirectUrl": null,
    "leadId": null,
    "error": "Lead with same IP recently registered."
}
Error: A lead from the same IP address was recently registered. Anti-spam protection triggered.

Error Handling

The API uses standard HTTP status codes and returns detailed error messages in the response body.

Common Status Codes

Status Code Meaning Description
200 OK Request successful (for GET requests)
201 Created Lead created (check success field for actual status)
400 Bad Request Invalid request parameters or missing required fields
401 Unauthorized Invalid or missing API key
403 Forbidden API key doesn't have permission for this resource
500 Internal Server Error Server-side error occurred

Error Response Examples

401 - Unauthorized

401 Unauthorized
{
    "message": "Account not authorized.",
    "code": "acNA",
    "statusCode": 401
}
Error: Invalid or missing API key. Verify your authentication credentials.

Handling Errors in Your Code

Example error handling in JavaScript:

async function createLead(leadData) {
    try {
        const response = await fetch('https://api.winfx.live/api/external/integration/lead', {
            method: 'POST',
            headers: {
                'x-api-key': 'your-api-key',
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(leadData)
        });

        const result = await response.json();

        if (result.success) {
            // Lead created successfully
            window.location.href = result.redirectUrl;
        } else {
            // Handle error
            console.error('Lead creation failed:', result.error);
            alert('Failed to create lead: ' + result.error);
        }
    } catch (error) {
        console.error('Network error:', error);
        alert('Network error occurred. Please try again.');
    }
}

Best Practices

Security

Performance

Data Quality

Monitoring

Support

If you need assistance with the API or have questions about integration:

Contact Your Manager
For API keys, configuration details, and technical support, please reach out to your assigned account manager.

Common Support Requests