Affelios API
  • Getting Started
  • API Reference
    • Transactions
  • API Swagger
    • Swagger Doc
Powered by GitBook
On this page

Getting Started

Get started with the Affelios Platform API

NextAPI Reference

Last updated 1 year ago

Let's get you set up with the Affelios Platform API so you can interact with the Affelios system programmatically.

Get your API key

Your API requests are authenticated using an API key sent in the X-Api-Key HTTP Header:

-H 'X-Api-Key: YOUR_API_KEY'

Any request sent to an endpoint that requires Authorization and doesn't include an X-Api-Key will return a 401 (Unauthorized) error.

You can generate an API key from your Dashboard at any time by navigating to Settings > API Keys

Once created click Copy to Clipboard and store the key somewhere safe ensuring that it is not exposed.

Important note: Do NOT store your API Key in any client-side or accessible code and ensure you only set permissions that are specifically required for the use case needed. Permission modules can be added or removed at any time, however, the API Key itself will only be accessible at the point of creation.

Make your first request

To make your first request, send an authenticated request to the customer endpoint using an External Customer Id and a Click Id.

Field
Description

ExternalId*

Required. The Customer Id from your system.

ExternalBrandId*

Required. The identifier that you configured in Affelios for the Brand or Shop that this customer registered to.

RegistrationDate*

Required. An ISO-8601 Zulu Timestamp of the date and time when the customer registered in your system.

ClickKey

The ClickKey is generated by Affelios and passed to your website or application. If no ClickKey exists, Affelios will either reject this customer or assign it to an internal Organic Tracking campaign which can be configured in System Settings.

Take a look at a few examples of how you might call this method using curl, Node, or C#:

curl -X POST https://platform.affelios.com/api/v1/customer
  -H 'Content-Type: application/json'
  -H 'X-Api-Key: YOUR_API_KEY'
  -d '{
        "externalId": "YOUR_CUSTOMER_ID",
        "externalBrandId": "YOUR_BRAND_ID",
        "clickKey": "CLICK_KEY",
        "registrationDate": "DATETIME"
      }'
const rp = require('request-promise');

const options = {
  method: 'POST',
  url: 'https://platform.affelios.com/api/v1/customer',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': 'YOUR_API_KEY'
  },
  body: {
    externalId: 'YOUR_CUSTOMER_ID',
    externalBrandId: 'YOUR_BRAND_ID',
    clickKey: 'CLICK_KEY',
    registrationDate: 'DATETIME'
  },
  json: true
};

try {
  const response = await rp(options);
  console.log(response);
} catch (error) {
  console.error(error);
}
using var client = new HttpClient();

var uri = new Uri("https://platform.affelios.com/api/v1/customer");
var json = JsonSerializer.Serialize(new
{
    externalId = "YOUR_CUSTOMER_ID",
    externalBrandId = "YOUR_BRAND_ID",
    clickKey = "CLICK_KEY",
    registrationDate = "DATETIME"
});

using var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("X-Api-Key", "YOUR_API_KEY");

var response = await client.PostAsync(uri, content);

if (response.IsSuccessStatusCode)
{
    var responseJson = await response.Content.ReadAsStringAsync();
    var result = JsonSerializer.Deserialize<dynamic>(responseJson);
    Console.WriteLine(result);
}
else
{
    Console.WriteLine("Error: " + response.StatusCode);
}
  • Get your API key
  • Make your first request
  • POSTCreates a new customer item.

Creates a new customer item.

post
Authorizations
Header parameters
X-Api-KeystringOptional
Body
all ofOptional
Responses
200
Success
post
POST /api/v1/customer HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 226

{
  "brandId": "text",
  "externalId": "text",
  "externalBrandId": "text",
  "clickId": "text",
  "username": "text",
  "registrationDate": "2025-05-20T17:40:35.328Z",
  "country": "text",
  "country_code": "text",
  "revShareExcluded": true,
  "cpaExcluded": true
}
200

Success

{
  "id": "text",
  "operatorId": "text",
  "updatedTs": "2025-05-20T17:40:35.328Z",
  "createdTs": "2025-05-20T17:40:35.328Z",
  "isIdEmpty": true,
  "createdBy": "text",
  "importId": "text",
  "externalId": "text",
  "externalBrandId": "text",
  "username": "text",
  "country": "text",
  "country_code": "text",
  "registerIp": "text",
  "referringUrl": "text",
  "registrationDate": "2025-05-20T17:40:35.328Z",
  "hasDeposited": true,
  "ftdDate": "2025-05-20T17:40:35.328Z",
  "cpaQualified": true,
  "cpaQualificationDate": "2025-05-20T17:40:35.328Z",
  "lifetimeRevenue": 1,
  "firstDepositAmount": 1,
  "lifetimeDeposits": 1,
  "lifetimeCommission": 1,
  "tracking": {
    "clickId": "text",
    "affiliateId": "text",
    "affiliateName": "text",
    "campaignId": "text",
    "campaignName": "text",
    "brandId": "text",
    "brandName": "text",
    "productId": "text",
    "productName": "text",
    "mediaId": "text",
    "media": {
      "type": "text",
      "text": "text",
      "imageUrl": "text"
    },
    "customParameter": "text",
    "date": "2025-05-20T17:40:35.328Z",
    "referringUrl": "text"
  },
  "category": "text",
  "label": "text",
  "revShareExcluded": true,
  "cpaExcluded": true,
  "transactions": [
    {
      "id": "text",
      "operatorId": "text",
      "updatedTs": "2025-05-20T17:40:35.328Z",
      "createdTs": "2025-05-20T17:40:35.328Z",
      "isIdEmpty": true,
      "createdBy": "text",
      "importId": "text",
      "integrationType": "text",
      "customerId": "text",
      "type": "text",
      "externalId": "text",
      "externalCustomerId": "text",
      "externalBrandId": "text",
      "externalProductId": "text",
      "country": "text",
      "country_code": "text",
      "depositAmount": 1,
      "firstTransaction": true,
      "grossRevenue": 1,
      "revenueAmount": 1,
      "wageredAmount": 1,
      "taxes": 1,
      "costOfGoodsSold": 1,
      "paymentFees": 1,
      "cpaQualified": true,
      "revShareCommission": 1,
      "cpaCommission": 1,
      "adjustmentAmount": 1,
      "totalCommission": 1,
      "transactionDate": "2025-05-20T17:40:35.328Z",
      "tracking": {
        "clickId": "text",
        "affiliateId": "text",
        "affiliateName": "text",
        "campaignId": "text",
        "campaignName": "text",
        "brandId": "text",
        "brandName": "text",
        "productId": "text",
        "productName": "text",
        "mediaId": "text",
        "media": {
          "type": "text",
          "text": "text",
          "imageUrl": "text"
        },
        "customParameter": "text",
        "date": "2025-05-20T17:40:35.328Z",
        "referringUrl": "text"
      },
      "category": "text",
      "label": "text",
      "note": "text",
      "childAffiliateIds": [
        "text"
      ],
      "payoutInfo": {
        "affiliateId": "text",
        "affiliateName": "text",
        "invoicePeriod": "text",
        "invoiceDate": "2025-05-20T17:40:35.328Z",
        "dueDate": "2025-05-20T17:40:35.328Z",
        "payoutMethod": {
          "id": "text",
          "operatorId": "text",
          "updatedTs": "2025-05-20T17:40:35.328Z",
          "createdTs": "2025-05-20T17:40:35.328Z",
          "isIdEmpty": true,
          "createdBy": "text",
          "companyId": "text",
          "companyName": "text",
          "type": "text",
          "payee": "text",
          "walletAddress": "text",
          "email": "text",
          "iban": "text",
          "swift": "text",
          "accountNumber": "text",
          "sortcode": "text",
          "bankName": "text",
          "bankAddress": {
            "addressLine": "text",
            "addressLine2": "text",
            "city": "text",
            "region": "text",
            "country": "text",
            "postcode": "text"
          }
        },
        "paymentDate": "2025-05-20T17:40:35.328Z",
        "amount": 1,
        "tax": 1,
        "total": 1,
        "notes": "text",
        "email": "text",
        "website": "text",
        "affiliateContact": "text",
        "affiliateCompany": "text",
        "affiliateCompanyNo": "text",
        "affiliateAddress": {
          "addressLine": "text",
          "addressLine2": "text",
          "city": "text",
          "region": "text",
          "country": "text",
          "postcode": "text"
        },
        "affiliateTaxIds": [
          {
            "id": "text",
            "value": "text",
            "type": "text",
            "country": "text",
            "stripeId": "text",
            "stripeStatus": "text"
          }
        ],
        "affiliateVatRegistered": true,
        "affiliateTaxRate": 1,
        "companyName": "text",
        "companyInvoiceAddress": {
          "addressLine": "text",
          "addressLine2": "text",
          "city": "text",
          "region": "text",
          "country": "text",
          "postcode": "text"
        },
        "companyTaxIds": [
          {
            "id": "text",
            "value": "text",
            "type": "text",
            "country": "text",
            "stripeId": "text",
            "stripeStatus": "text"
          }
        ],
        "companyNumber": "text",
        "accountsEmail": "text",
        "currencyCode": "text"
      }
    }
  ]
}