Skip to main content

Brand API

Written by Apurva Tiwari

Overview

The Affnook Brand API (v2) provides a complete programmatic interface for operators to interact with their brand data on the Affnook performance marketing platform. Using this API, brands can register customers, push activity data, retrieve campaign and conversion reports, inspect click data, and access API logs — all authenticated and scoped to the specific brand.

This knowledge base article documents every available endpoint, its parameters, request/response formats, and practical guidance for implementation.

Property

Value

API Version

v2

Base URL

Authentication

x-api-key header

Data Format

JSON (application/json)

Protocol

HTTPS only

API Documentation

Accessing your Brand API Key

Each Affnook brand has its own API key. All requests must be authenticated using this key in the request header. Follow the steps below to locate your key.

Navigation Path

Brand Panel → Automation → API

Step-by-Step

● Step 1 — Log in to your Affnook account and open your Brand Panel.

● Step 2 — From the left-hand navigation, click Automation.

● Step 3 — Select the API tab from the top navigation bar within the Automation section.

● Step 4 — Copy your API Key using the copy icon. Store it securely.

● Step 5 — Add your server IP(s) to the Allowed IPs field for IP whitelisting.

Note: After adding a new IP to the whitelist, allow up to 10 minutes for the change to propagate before making API calls.

Tip: Never expose your API key in client-side code, mobile apps, or public repositories. Use environment variables or a secrets manager.

API key Reference table

Setting

Location

API Key

Brand Panel → Automation → API Tab

IP Whitelisting

Brand Panel → Automation → API Tab → Allowed IPs

API Logs

Brand Panel → Automation → API Logs

MQTT Credentials

Contact your Customer Success Manager (CSM)

Authentication

Every request to the Brand API must include the API key as a custom header. There is no session-based or OAuth authentication.

Required Request Header:

x-api-key: YOUR_BRAND_API_KEY

Example cURL:

curl -X GET "https://api.affnook.io/api/brand/v2/campaigns" \ -H "x-api-key: YOUR_BRAND_API_KEY" \ -H "Content-Type: application/json"

Note: All API requests must be made over HTTPS. Plain HTTP requests will be refused. Ensure your server IP is whitelisted before testing in production.

All Endpoints - Quick Reference

The Brand API exposes 8 endpoints across 5 resource groups. All paths are prefixed with /api/brand/v2.

Method

Endpoint

Description

GET

/api/brand/v2/campaigns

List all campaigns for the authenticated brand

GET

/api/brand/v2/campaigns/report

Get campaign performance report with full filtering

GET

/api/brand/v2/conversions/report

Get conversion report for the brand

GET

/api/brand/v2/generate-postback-link

Generate a postback/tracking URL for a campaign goal

POST

/api/brand/v2/customers

Register a new customer and attribute them to an affiliate

POST

/api/brand/v2/activities

Push activity data (bets, deposits, wins, etc.) for a customer

GET

/api/brand/v2/clicks

Retrieve click records with filtering options

GET

/api/brand/v2/api-logs

Retrieve API request logs for debugging and audit

Security and Best Practices

IP Whitelisting

Only requests from whitelisted IP addresses are accepted by the Brand API. Add your server IPs here:

Brand Panel → Automation → API → Allowed IPs

● Add every server IP that will send API requests to Affnook.

● Changes take up to 10 minutes to propagate — plan accordingly.

● Use static IPs wherever possible to avoid frequent whitelist updates.

● Unwhitelisted IPs receive a 401 Unauthorized response immediately.

API Key Security

● Never embed your API key in front-end code, mobile apps, or browser-side JavaScript.

● Do not commit API keys to Git or any version control system.

● Store keys in environment variables or a dedicated secrets manager (e.g. AWS Secrets Manager, HashiCorp Vault).

● Rotate your API key periodically and immediately upon suspected exposure.

Anti-Fraud

The Anti-Fraud module automatically blocks suspicious or low-quality traffic before it enters your reporting pipeline. Enable it here:

Brand Panel → Automation → Anti-Fraud Rule

● Toggle the Anti-Fraud rule to Enabled.

● Configure the validation policy to match your traffic quality standards.

● Anti-Fraud runs before data is recorded — only clean conversions appear in affiliate reports.

Note: Keeping Anti-Fraud active protects affiliate payouts from inflated data and ensures only legitimate conversions are tracked and reported.

Here is the API documentation for the Brand API.

Troubleshooting

Issue

Likely Cause

Resolution

401 Unauthorized

Invalid API key or IP not whitelisted

Verify API key is correct. Check the Allowed IPs list. Allow 10 min for new IPs to propagate.

400 Bad Request on /customers

Missing required fields: customerId, customerName, currency, or country

Ensure all 4 required fields are present. Check that trackingToken or promocode is also included.

400 Bad Request on /activities

Missing customerId or currency

Verify these fields are present and that the customerId was previously registered via /customers.

400 Bad Request on /api-logs

Missing start or end date

Both start and end are required for the API Logs endpoint.

Customer not attributed

trackingToken not captured or expired

Capture and store the token at the moment of affiliate click. Do not reuse tokens.

Activity data missing from reports

Activity pushed before customer registered

Always call /customers first. Verify the customerId in both calls is identical.

Duplicate customer error

customerId already exists for this brand

Use unique IDs per customer. If re-registering, check your de-duplication logic.

Data showing in wrong currency

currency field mismatch between calls

Use the same currency code consistently across /customers and /activities for the same customer.


We are delighted to have assembled a world-class team of experienced professionals who are ready to take care of your queries and answer any questions you may have. Feel free to reach out to us at anytime by emailing us at [email protected] or by using the in-platform chat feature. We'd love to hear from you!

Did this answer your question?