The easiest way to work with AFF1 through the API is a ready-made archive. You download the landing (and the pre-landing, if you need one) of the offer with your API key already inside, upload it to your hosting, and the orders from your domain go to AFF1 through the API. You can edit the pages for your audience.
If you want to send orders from a landing of your own, see API integration: manual mode.
Before you start
- The offer target must have API integration: in the offer list it has a green API icon (API integration available). You need access to the target.
- You need hosting with PHP and a domain for it.
- If you are going to put the pages into Keitaro, follow How to use AFF1 landings and pre-landings in Keitaro instead.
Step 1. Set up the archive
- Open the offer page and click API in the bar at the bottom.
- In the API integration window, open the Archive tab.
- Type: choose PHP. (Keitaro gives an archive prepared for the Keitaro tracker.)
- Tick Bind to flow and choose the Flow if you want the orders in the statistics and postbacks of this flow. Only flows whose target has API integration are listed. Without binding, choose the Target.
- Choose the Pre-landing (or W/o pre-landing) and the Landing.
- Tick the options you need (see below) and click Download archive.

Archive options
| Option | What it does |
|---|---|
| Log orders into file | Saves every order to the file orders-XXXXXXXX.txt on your hosting. The file must have read and write permissions. |
| Throw clickid | Passes your tracker’s click ID with the order. In Title of clickid parameter, enter the name of the URL parameter that carries the click ID in your links (for example, clickid). AFF1 returns this value in postbacks as {clickid}. |
| Throw fbclid, Throw fbpx | Pass fbclid and fbpx from the page URL with the order. Turn them on if you use the Facebook Conversions API. |
| Landing back button redirect | Sends visitors who press “Back” on the landing to the URL from Back button redirect url. |
| Throw Data settings | Takes your own URL parameters and passes them to AFF1 as data1…data4 (see below). |
| Add custom HTML code | Adds your code (a pixel, a counter) to <body> or <head> of the pre-landing, the landing and the successful order page. |
| Encrypt network sign | Converts the integration JavaScript code to base64. |
Data parameters and macros
In Titles of data1..data4 parameters, give each data parameter the name of a URL parameter (Latin letters, digits and _). Then:
- the value of this URL parameter is passed to AFF1 as the data parameter, and you can filter statistics by it;
- the macro with the same name in braces is replaced with this value in your custom HTML code.
Example: name data1 as pixel and open the landing as https://yourdomain.com/?pixel=123456789012345. AFF1 receives data1=123456789012345, and in the custom HTML code {pixel} turns into 123456789012345. This way one archive can work with different Meta pixels: write fbq('init', '{pixel}'); in the pixel code and pass the pixel ID in the link.
Step 2. Upload the files to your hosting
- Unpack the downloaded archive on your computer.
- Upload the files to the root folder of your domain on the hosting, with the hosting file manager or an FTP client (for example, FileZilla).
- If you turned on Log orders into file, give the
orders-XXXXXXXX.txtfile read and write permissions. - Open your domain in the browser: the pre-landing or the landing should load.
The archive contains your API key. Don’t publish the archive files or send them to other people. If you click Receive new in the Manual (expert mode) tab, the old key stops working, and you need to download and upload the archive again.
Check that it works
- The page opens on your domain, and the order form works.
- The orders appear in Statistics → Leads (and in the order log file, if it is on).
- If you pass
clickid, the postback with the right{clickid}reaches your tracker.
Test orders go to trash. If you need to check the whole funnel up to the call centre, agree on the test with your personal manager first.
Common problems
- The flow is not in the list — only flows whose target has API integration are shown. Check the flow target.
- The browser shows PHP code or downloads a file — the hosting does not run PHP for this domain. Turn PHP on in the hosting panel or ask the hosting support.
- Orders do not go to AFF1 after you changed the API key — download the archive again: the old key is inside the files.
- The order log is empty — check the permissions of
orders-XXXXXXXX.txt.