Affelios API
Ask or search…
K

Getting Started

Get started with the Affelios Platform API
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.
post
https://platform.affelios.com
/api/v1/customer
Creates a new customer item.
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
Node
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);
}
Last modified 1mo ago