# Claude Code Add the MCP server to Claude Code, and check that it works. Claude Code connects to the MCP server over Streamable HTTP. The key goes in a header. Claude Code reads the key from an environment variable. ## Install 1. Make a test key in the dashboard. A test key starts with `sk_test_`. 2. Put the key in an environment variable. Add this line to your shell profile: ```bash export AFFFAST_API_KEY="sk_test_..." ``` 3. Add the server. Use single quotes. They keep your shell from reading `${AFFFAST_API_KEY}`. Claude Code reads it when it connects. ```bash claude mcp add --transport http afffast https://api.afffast.com/mcp \ --header 'Authorization: Bearer ${AFFFAST_API_KEY}' ``` By default, the server is local to the current project (`--scope local`). Use `--scope user` for all your projects. Use `--scope project` to write the server to `.mcp.json`, which your team can share. The file stores only the name of the variable, not the key. ```json { "mcpServers": { "afffast": { "type": "http", "url": "https://api.afffast.com/mcp", "headers": { "Authorization": "Bearer ${AFFFAST_API_KEY}" } } } } ``` ## Check that it works Run this command. The server must show `Connected`: ```bash claude mcp list ``` The `add` command does not check the key. A wrong key shows `Failed to connect` here. Inside Claude Code, type `/mcp` to see the server and its tools. ## Example prompts - "Query the revenue by network for this month. Show the result as a table." - "List the 10 newest conversions that have the status pending." - "Make a test link for the program `prog_...` that goes to `https://shop.example/products/boots`." ## Troubleshooting - **`Failed to connect` or a 401 error.** The key is wrong, or the variable is not set in the shell that started Claude Code. If a variable is not set, Claude Code warns in `claude mcp list` and sends the text `${AFFFAST_API_KEY}` as the key. Export the variable. Start Claude Code again. - **The tools are missing.** The key decides the tools. A read-only key has no write tools. Make a key with the scope that you need. - **A key in the URL.** Do not do this. The API refuses a key in the query string. - **A 429 error.** The tool call hit a rate limit. Wait for the time in `Retry-After`. See [Rate limits](https://docs.afffast.com/docs/rate-limits.md). - **You use a project scope.** Claude Code asks you to approve the servers of `.mcp.json` before it uses them. ## Security - Never paste a key into a chat. Use the environment variable. - Start with a test key. A test key reads and writes test data only. - Use a read-only key if the tool must only read. - Do not commit a key. The `.mcp.json` file must have `${AFFFAST_API_KEY}`, not the key. - Each tool call is in the request logs of the dashboard. Look there to see what the tool did. --- # Claude Desktop Connect Claude Desktop to the MCP server with mcp-remote. Claude Desktop has custom connectors for remote servers. A custom connector asks for a URL and then starts an authentication flow, which is often OAuth. Our server does not have OAuth. It uses an API key in a header. So use the package `mcp-remote`. It runs on your computer, and it sends the header to our server. You need Node.js. ## Install 1. Make a test key in the dashboard. A test key starts with `sk_test_`. 2. In Claude Desktop, open **Settings**, then **Developer**, then **Edit Config**. This opens `claude_desktop_config.json`. The file is here: - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` - Windows: `%APPDATA%\Claude\claude_desktop_config.json` - Linux: `~/.config/Claude/claude_desktop_config.json` 3. Add the server: ```json { "mcpServers": { "afffast": { "command": "npx", "args": [ "-y", "mcp-remote", "https://api.afffast.com/mcp", "--header", "Authorization:${AUTH_HEADER}" ], "env": { "AUTH_HEADER": "Bearer sk_test_..." } } } } ``` 4. Quit Claude Desktop completely. Start it again. There is no space after `Authorization:` in the argument. Claude Desktop on Windows does not escape spaces in `args`. The space is in the `env` value, where it is safe. Claude Desktop reads the key from this file. Claude Desktop does not read your shell variables for this server. So the key is in the file. Protect the file: do not share it, and do not put it in a repository. Use a test key. ## Check that it works Open a new chat. Select the **+** button at the bottom left of the message box, then **Connectors**. The server `afffast` must be there with its tools. Claude asks you to approve each tool call. ## Example prompts - "Show the revenue by network for this year as a table." - "Which conversions are pending for more than 60 days?" - "List my networks and tell me which connections have an error." ## Troubleshooting - **The server does not show.** Check that the JSON is valid. Quit Claude Desktop completely and start it again. - **An `npx` error.** Install Node.js. Run `npx -y mcp-remote --help` in a terminal to test it. - **A 401 error.** The key is wrong or revoked. Make a new key. - **More details.** Read the logs. On macOS: `tail -n 20 -f ~/Library/Logs/Claude/mcp*.log`. On Windows, look in `%APPDATA%\Claude\logs`. - **The tools are missing.** The key decides the tools. A read-only key has no write tools. ## Security - Never paste a key into a chat. - Start with a test key. A test key reads and writes test data only. - Use a read-only key if the tool must only read. - The key is in a file on your computer. Restrict who can read the file. Revoke the key if the computer is shared or lost. --- # Codex CLI Add the MCP server to Codex in config.toml, and check that it works. Codex reads its MCP servers from `~/.codex/config.toml`. The file stores the name of the environment variable that holds the key. It does not store the key. ## Install 1. Make a test key in the dashboard. A test key starts with `sk_test_`. 2. Put the key in an environment variable: ```bash export AFFFAST_API_KEY="sk_test_..." ``` 3. Add the server to `~/.codex/config.toml`: ```toml [mcp_servers.afffast] url = "https://api.afffast.com/mcp" bearer_token_env_var = "AFFFAST_API_KEY" ``` Codex sends the value of `AFFFAST_API_KEY` in the header `Authorization: Bearer ...`. You can also add the server with a command: ```bash codex mcp add afffast --url https://api.afffast.com/mcp ``` This command does not set the key. Add the line `bearer_token_env_var = "AFFFAST_API_KEY"` to the new table in `config.toml`. To use the server in one project only, put the same table in `.codex/config.toml` of the project. Codex reads this file only for a trusted project. ## Check that it works - Run `codex mcp list`. The list must show `afffast`. - Start `codex`. Type `/mcp`. The server must show its tools. ## Example prompts - "Use the afffast tools to show the revenue by network for last month." - "Find the conversions with the status declined this week. Group them by program." - "List my sites and the number of clicks that each site got in the last 7 days." ## Troubleshooting - **The server does not connect.** Make sure that `AFFFAST_API_KEY` is set in the shell that started `codex`. A variable that you set in another terminal does not apply. - **A 401 error.** The key is wrong or revoked. Make a new key. - **The tools are missing.** The key decides the tools. A read-only key has no write tools. - **The project config is ignored.** Codex reads `.codex/config.toml` only in a trusted project. - **You see a login prompt.** `codex mcp login` is for OAuth. This server uses an API key and has no OAuth. Use `bearer_token_env_var`. ## Security - Never paste a key into a chat. Use the environment variable. - Start with a test key. A test key reads and writes test data only. - Use a read-only key if the tool must only read. - Never put the key in `config.toml`. Use `bearer_token_env_var`. --- # Cursor Add the MCP server to Cursor with a button or with mcp.json. Cursor reads MCP servers from `mcp.json`. The file can use `${env:NAME}` in the `url` and in the `headers`. So the file does not hold the key. ## Install with the button 1. Put the key in an environment variable, and start Cursor from a shell that has it. On macOS, you can also set the variable for the desktop with `launchctl setenv AFFFAST_API_KEY "sk_test_..."` and restart Cursor. ```bash export AFFFAST_API_KEY="sk_test_..." ``` 2. Open this link: [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=afffast&config=eyJ1cmwiOiJodHRwczovL2FwaS5hZmZmYXN0LmNvbS9tY3AiLCJoZWFkZXJzIjp7IkF1dGhvcml6YXRpb24iOiJCZWFyZXIgJHtlbnY6QUZGRkFTVF9BUElfS0VZfSJ9fQ==). 3. Cursor shows the server. Check the URL and select **Install**. The link has the name of the server and a Base64 copy of this configuration: ```json { "url": "https://api.afffast.com/mcp", "headers": { "Authorization": "Bearer ${env:AFFFAST_API_KEY}" } } ``` ## Install with a file Add the server to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for all projects: ```json { "mcpServers": { "afffast": { "url": "https://api.afffast.com/mcp", "headers": { "Authorization": "Bearer ${env:AFFFAST_API_KEY}" } } } } ``` ## Check that it works 1. Open the Output panel (`Cmd+Shift+U` on macOS). Select **MCP Logs**. 2. Look for the connection of `afffast`. The log shows an error if the connection fails. 3. In a chat, look at the available tools. The tools of the server must be there. Cursor asks you to approve a tool call. ## Example prompts - "Use the afffast tools to list my networks and their connection status." - "Show the revenue by program for the last 30 days." - "Make a test conversion for the newest test click, then show it in the list of conversions." ## Troubleshooting - **The server shows an error or a 401.** The variable `AFFFAST_API_KEY` is not set in the process that started Cursor. Quit Cursor. Start it from a shell where the variable is set. - **The tools are missing.** The key decides the tools. A read-only key has no write tools. - **The link does not open Cursor.** Install Cursor first. Or use the file method. - **A 429 error.** Wait for the time in `Retry-After`. ## Security - Never paste a key into a chat. Use the environment variable. - Start with a test key. A test key reads and writes test data only. - Use a read-only key if the tool must only read. - A key in `.cursor/mcp.json` goes into your repository. Use `${env:AFFFAST_API_KEY}` only. --- # Use the docs and the API with an AI tool Give an AI coding tool our docs, an agent skill and the MCP server. An AI tool can read these docs and use the API. This section shows how. There are 4 parts. You can use each part alone. ## 1. Docs for AI tools - `/llms.txt` is an index of all pages. It has short instructions for an agent: the API base URL, the Bearer key, the `Api-Version` header and the API conventions. The format is described at [llmstxt.org](https://llmstxt.org). - `/llms-full.txt` has the Markdown of all pages in one file. - Each page has a Markdown copy at its URL plus `.md`. Example: `/docs/quickstart.md`. The index pages are `/docs.md` and `/errors.md`. - A request with the header `Accept: text/markdown` on a page URL returns the same Markdown. The response has the header `Vary: Accept`. - Each HTML page has a `link rel="alternate" type="text/markdown"` tag that points to its Markdown copy. ```bash curl https://docs.afffast.com/docs/quickstart.md curl -H "Accept: text/markdown" https://docs.afffast.com/docs/quickstart ``` ## 2. Page actions Each page has a button "Copy page as Markdown" and a menu "Open". The menu has these actions: - **View as Markdown** opens the `.md` copy. - **Open in ChatGPT**, **Open in Claude** and **Open in Cursor** open the tool with a prompt. The prompt asks the tool to read the Markdown copy of the page. - **Copy MCP install command** copies the `claude mcp add` command for Claude Code. The command reads the key from the environment variable `AFFFAST_API_KEY`. ## 3. Agent skill The skill `afffast` is a `SKILL.md` file. It has the API rules and the steps of common tasks. A tool that supports skills loads it when the task fits. Install it in Claude Code for all your projects: ```bash mkdir -p ~/.claude/skills/afffast curl -o ~/.claude/skills/afffast/SKILL.md \ https://docs.afffast.com/skills/afffast/SKILL.md ``` Install it in Codex for all your projects: ```bash mkdir -p ~/.agents/skills/afffast curl -o ~/.agents/skills/afffast/SKILL.md \ https://docs.afffast.com/skills/afffast/SKILL.md ``` For one repository only, use `.claude/skills/afffast/` (Claude Code) or `.agents/skills/afffast/` (Codex) in the repository. The docs site also publishes a skill index for tools that find skills by themselves. The index is at `/.well-known/agent-skills/index.json`. The same list is at `/.well-known/skills/index.json`. Each entry has the URL of the skill file and its SHA-256 digest. ## 4. MCP server The API has a hosted MCP server at `https://api.afffast.com/mcp`. An AI tool can call the API as tools. See [MCP server](https://docs.afffast.com/docs/mcp.md) for the tools. The server also has the tools `search_docs` and `read_doc`. They let the tool search and read these docs. They need no scope. Use one of these guides to install the server: - [Claude Code](https://docs.afffast.com/docs/ai/claude-code.md) - [Codex CLI](https://docs.afffast.com/docs/ai/codex.md) - [Cursor](https://docs.afffast.com/docs/ai/cursor.md) - [VS Code](https://docs.afffast.com/docs/ai/vscode.md) - [Windsurf](https://docs.afffast.com/docs/ai/windsurf.md) - [Claude Desktop](https://docs.afffast.com/docs/ai/claude-desktop.md) - [Other clients](https://docs.afffast.com/docs/ai/other-clients.md) ## Keep your key safe - Put the API key in an environment variable. Never paste a key into a chat or a prompt. - Use a test key (`sk_test_...`) first. A test key reads and writes test data only. - Use a read-only key when the tool must only read. A read-only key has no write tools. - Revoke a key in the dashboard when you think that a tool or a person saw it. --- # Other MCP clients The connection values for any MCP client, and a generic JSON config. Any MCP client that supports the Streamable HTTP transport and custom headers can use the server. ## Connection values | Setting | Value | | --------- | --------------------------------------------- | | URL | `https://api.afffast.com/mcp` | | Transport | Streamable HTTP (called `http` in many tools) | | Header | `Authorization: Bearer ` | | Auth | An API key. There is no OAuth. | Never put the key in the URL. The API refuses a key in the query string. ## Generic JSON config Many clients use a JSON file with a key `mcpServers`. The field names differ between clients. This shape works in Claude Code (`.mcp.json`), and Cursor (`mcp.json`) uses the same shape without `type`: ```json { "mcpServers": { "afffast": { "type": "http", "url": "https://api.afffast.com/mcp", "headers": { "Authorization": "Bearer ${AFFFAST_API_KEY}" } } } } ``` - Claude Code reads `${AFFFAST_API_KEY}`. Cursor reads `${env:AFFFAST_API_KEY}`. Read the docs of your client to see which syntax it uses. - Windsurf uses `serverUrl` in place of `url`. - VS Code uses the key `servers` in place of `mcpServers`. - If your client has no variable syntax, write the key in the config file. Then protect the file. Never commit it. ## A client with no HTTP support If your client can start only a local command (stdio), use `mcp-remote`. It connects a local command to our HTTP server: ```bash AFFFAST_AUTH_HEADER="Bearer $AFFFAST_API_KEY" \ npx -y mcp-remote https://api.afffast.com/mcp --header 'Authorization:${AFFFAST_AUTH_HEADER}' ``` ## Check that it works Call the MCP method `tools/list`. The answer must list the tools. Or look at the tool list in your client. The key decides the tools. A read-only key has no write tools. To test the key without MCP, call the REST API: ```bash curl https://api.afffast.com/v1/networks/sandbox \ -H "Authorization: Bearer $AFFFAST_API_KEY" ``` ## Example prompts - "Query the revenue by network for this year." - "List the 10 newest conversions." - "Which sites earned the most commission last month?" ## Troubleshooting - **A 401 error.** The key is wrong, revoked, or missing in the header. See [`api_key_invalid`](https://docs.afffast.com/errors/api-key-invalid.md). - **A 400 error about the key.** The key is in the URL. Move it to the header. See [`api_key_in_query`](https://docs.afffast.com/errors/api-key-in-query.md). - **The client says that the transport is not supported.** Use `mcp-remote`. - **A 429 error.** Wait for the time in `Retry-After`. ## Security - Never paste a key into a chat. Use an environment variable if your client supports it. - Start with a test key. A test key reads and writes test data only. - Use a read-only key if the tool must only read. - Revoke a key in the dashboard when you think that someone saw it. --- # VS Code Add the MCP server to VS Code with an install link or .vscode/mcp.json. VS Code reads MCP servers from `.vscode/mcp.json`. The key goes in a header. VS Code can ask you for the key one time and store it. The file then does not hold the key. ## Install with a file 1. Make a test key in the dashboard. A test key starts with `sk_test_`. 2. Make the file `.vscode/mcp.json`: ```json { "inputs": [ { "type": "promptString", "id": "ans-api-key", "description": "AffFast API key", "password": true } ], "servers": { "afffast": { "type": "http", "url": "https://api.afffast.com/mcp", "headers": { "Authorization": "Bearer ${input:ans-api-key}" } } } } ``` 3. Start the server. Open the Command Palette and run **MCP: List Servers**. Select `afffast`, then **Start Server**. 4. VS Code asks for the key. Paste the test key into this prompt. VS Code stores it. Do not paste it in a chat. You can also run **MCP: Add Server**, choose **HTTP**, and enter `https://api.afffast.com/mcp`. Then add the `headers` field to the new entry. ## Install with a link This link opens VS Code and shows the server for review: [Install in VS Code](https://vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522afffast%2522%252C%2522type%2522%253A%2522http%2522%252C%2522url%2522%253A%2522https%253A%252F%252Fapi.afffast.com%252Fmcp%2522%257D). The link does not carry a key. After the install, add the `headers` field from the file above. ## Check that it works - Run **MCP: List Servers**. The server must be running. - Open the Chat view in agent mode. Select the tools icon. The tools of the server must be in the list. ## Example prompts - "Use the afffast tools to show the revenue by network this year." - "List the conversions that have the status pending and are older than 30 days." - "Show the clicks by country for the link `link_...`." ## Troubleshooting - **The server does not start.** Run **MCP: List Servers**, select the server and look at the output. A 401 error means that the key is wrong. Make a new key, and start the server again. - **The tools are missing.** The key decides the tools. A read-only key has no write tools. - **The link does not work.** Use the file method. - **A 429 error.** Wait for the time in `Retry-After`. ## Security - Never paste a key into a chat. Use the `promptString` input. - Start with a test key. A test key reads and writes test data only. - Use a read-only key if the tool must only read. - Never write the key in `.vscode/mcp.json`. The file is often committed. --- # Windsurf Add the MCP server to Windsurf Cascade in mcp_config.json. Windsurf Cascade reads its MCP servers from the file `mcp_config.json`. A remote server uses the field `serverUrl`. The file can use `${env:NAME}` in `serverUrl` and in `headers`. So the file does not hold the key. ## Install 1. Make a test key in the dashboard. A test key starts with `sk_test_`. 2. Put the key in an environment variable, and start Windsurf from a shell that has it: ```bash export AFFFAST_API_KEY="sk_test_..." ``` 3. Open the MCP menu of Cascade and select **Open MCP config file**. Add the server: ```json { "mcpServers": { "afffast": { "serverUrl": "https://api.afffast.com/mcp", "headers": { "Authorization": "Bearer ${env:AFFFAST_API_KEY}" } } } } ``` 4. Save the file. Press the refresh button in the MCP menu. The path of the file depends on your version of Windsurf. The docs name `~/.codeium/windsurf/mcp_config.json` for older versions and `~/.config/devin/mcp_config.json` for newer versions. Use **Open MCP config file**: it opens the right file. You can also add a server in **Settings**, then **Tools**, then **Windsurf Settings**, then **Add Server**. ## Check that it works Open the MCP menu of Cascade. The server `afffast` must be on, and it must list its tools. A server that fails shows an error. ## Example prompts - "Use the afffast tools to show the revenue by network for last month." - "Which program had the most declined conversions this quarter?" - "List my active links and their click counts." ## Troubleshooting - **The server does not show.** Press refresh. Check that the JSON is valid. - **A 401 error.** The variable `AFFFAST_API_KEY` is not set in the process that started Windsurf. The documentation does not say where Windsurf reads the variable. Quit Windsurf, and start it from a shell where the variable is set. - **The tools are missing.** The key decides the tools. A read-only key has no write tools. - **A 429 error.** Wait for the time in `Retry-After`. ## Security - Never paste a key into a chat. Use the environment variable. - Start with a test key. A test key reads and writes test data only. - Use a read-only key if the tool must only read. - Do not write the key in `mcp_config.json`. Use `${env:AFFFAST_API_KEY}`. --- # Changelog The dated versions of the API, and the changes in each version. This page lists each dated `Api-Version`, with the newest at the top. See [API versioning](https://docs.afffast.com/docs/versioning.md) for how a version is chosen. ## 2026-11-16 The first dated version of the API. It is the version that each new workspace pins. - The public API with the prefix `/v1`. The [API reference](/reference) lists each operation. - Resources: connections and networks, programs, brands, deals, conversions, payouts, clicks, links, deeplinks, sites, tags, events, webhook endpoints, destinations, postback sources, request logs, usage, workspace data and test helpers. - Authentication with Bearer keys: `sk_live_...` and `sk_test_...`. Test data and live data are separate. See [Test mode](https://docs.afffast.com/docs/test-mode.md). - Cursor pagination, `expand[]`, `metadata`, the error envelope with `doc_url`, `Idempotency-Key`, rate limit headers and `ETag`. See [Pagination](https://docs.afffast.com/docs/pagination.md), [Errors](https://docs.afffast.com/docs/errors.md), [Idempotency](https://docs.afffast.com/docs/idempotency.md) and [Rate limits](https://docs.afffast.com/docs/rate-limits.md). - Webhooks that follow the Standard Webhooks specification. See [Webhooks](https://docs.afffast.com/docs/webhooks.md). - Destinations for Google Sheets, BigQuery, Slack and Google Analytics 4. See [Destinations](https://docs.afffast.com/docs/destinations.md). - The hosted MCP server. See [MCP server](https://docs.afffast.com/docs/mcp.md). - Postbacks for Awin, Impact, Tradedoubler and custom tracking platforms. See [Postbacks](https://docs.afffast.com/docs/postbacks.md). When a new dated version ships, this page gets a new section. --- # Connect Addrevenue Step-by-step guide to connect Addrevenue. Follow these steps to connect Addrevenue. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to your Addrevenue account. [Open this page in Addrevenue](https://addrevenue.io) 2. Open API tokens. 3. Make a token and copy it. The token has no expiry date. 4. In the dashboard, choose Addrevenue. Paste the token in the field API token. 5. Leave the field Account id empty. Fill it only when the token is a personal user token. ## Where to find each value - **API token** (`apiToken`, required, secret). Addrevenue, API tokens. Make a token and copy it. - **Account id** (`accountId`, optional). Only for a personal user token: the number of the Addrevenue account. An account token needs no account id. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - Use an account token. A personal user token needs the account id too. - The connection lists each active channel of the account as an account. A channel is one website. - The account id has digits only. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Addrevenue if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `addrevenue` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect Adtraction Step-by-step guide to connect Adtraction. Follow these steps to connect Adtraction. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to Adtraction. 2. Open Account, then Settings. 3. Copy the API token. 4. Paste the token in the field API token. ## Where to find each value - **API token** (`apiToken`, required, secret). Adtraction, Account, Settings. The field has the name API token. One token belongs to one Adtraction account. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - The token is from a different Adtraction account. One token belongs to one account. Copy the token of the account that you want to connect. - The token has a space at the start or at the end. Copy the token again. - The account has no approved channel. The connection works, but the connector finds no channel. Approve a channel in Adtraction first. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Adtraction if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `adtraction` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect Awin Step-by-step guide to connect Awin. Follow these steps to connect Awin. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to Awin. 2. Open the user menu (top right). Choose API Credentials. [Open this page in Awin](https://ui.awin.com/awin-api) 3. Enter your password. Click Show my API token. 4. Copy the token. 5. Paste the token in the field API token. ## Where to find each value - **API token** (`apiToken`, required, secret). Awin, user menu (top right), API Credentials. Enter your password and click Show my API token. One token belongs to one Awin user. It opens all publisher accounts that the user can reach. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - The user has no access to the publisher account. The user needs at least viewer access to read an account. A change of the access can need up to 10 minutes. - You copied a different key. The product data key of the feeds is not the API token. Copy the API token. - The token has a space at the start or at the end. Copy the token again. - Another platform uses the same user and the same token. Awin allows 20 requests each minute for each user. All platforms share this limit, so a sync can be slow. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Awin if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `awin` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect Daisycon Step-by-step guide to connect Daisycon. Follow these steps to connect Daisycon. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to your Daisycon account and open the developer area. Make a new app for this platform. Ask for read permissions only. [Open this page in Daisycon](https://faq-publisher.daisycon.com) 2. Copy the client ID and the client secret of the app. 3. Add the redirect address that the dashboard shows to the app. 4. In the dashboard, choose Daisycon. Paste the client ID and the client secret. Press Connect Daisycon. 5. Log in to Daisycon and accept the access. Daisycon sends you back to the dashboard. ## Where to find each value - **Client ID** (`clientId`, required). Daisycon, developer area, your app. Copy the client ID of the app. - **Client secret** (`clientSecret`, required, secret). Daisycon, developer area, the same app. Copy the client secret. - **Refresh token** (`refreshToken`, required, secret). You do not copy this value. The dashboard fills it when you press Connect Daisycon and accept the access. - **Redirect URI** (`redirectUri`, optional). Leave this field empty to use the redirect address of the dashboard. The Daisycon app must list the same address. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - Use a second app for this platform. Do not copy the refresh token of another platform. A refresh token works one time only, so a copy would stop the other platform. - The redirect address must be the same in the app and in the connection. Daisycon refuses a different address. - A connection that does not sync for 30 days loses its refresh token. Press Connect Daisycon again. - Daisycon allows 50 requests each minute for each IP address. Another platform on the same IP uses the same limit, so a sync can be slow. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Daisycon if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `daisycon` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect File import (CSV and XLSX) Step-by-step guide to connect File import (CSV and XLSX). Follow these steps to connect File import (CSV and XLSX). The dashboard shows the same steps when you connect the network. ## Steps 1. Open the reports of your network in your browser. Find the report that lists your sales. 2. Download the report as a CSV file or an XLSX file. Do not change the column names. 3. Select the mapping that fits the file. The mapping generic reads a file with our own columns. Other mappings read the report of one network. 4. Upload the file to the connection. The upload reads the whole file first. 5. If the upload shows errors, fix each row in the file. Upload the file again. The upload writes nothing until the file has no error. ## Where to find each value - **Default mapping** (`mappingId`, required). Open the list of mappings (GET /v1/import_mappings). Copy the id of the mapping that fits your file. Example: generic. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - The file has a column name that the mapping does not know. Compare the header of the file with the columns of the mapping. - The date has another format than the mapping expects. Check the date format of the mapping. - A number uses the other decimal separator. The mapping says which separator it expects. - The file is in the old XLS format. Save it as XLSX or CSV. - Two rows have the same id. An id must be unique in a file. - You upload the same sales with the file import and with the connector of the network. The sales are then two times in the data. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks File import (CSV and XLSX) if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `file-import` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect Impact Step-by-step guide to connect Impact. Follow these steps to connect Impact. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to impact.com. 2. Open the API page in the settings of your account. 3. Copy the Account SID. 4. Copy the Auth Token. A read-only token is enough. 5. Paste both values in the connect form. 6. Open the documentation of the Impact Partner API if you need more help. [Open this page in Impact](https://integrations.impact.com/partner-api-reference) ## Where to find each value - **Account SID** (`accountSid`, required, secret). Impact, settings of your account, API page. The field has the name Account SID. The value has letters and digits only. - **Auth token** (`authToken`, required, secret). Impact, settings of your account, API page, next to the Account SID. The field has the name Auth Token. A read-only token is enough. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - The Account SID and the Auth Token are from different API access tokens. One token belongs to one Impact account. Copy both values from the same page. - The Account SID has a character that is not a letter or a digit. Copy the value again. - The sync is slow or it stops for some time. Another platform that uses the same token shares the quota of 500 requests each hour. The sync tries again later. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Impact if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `impact` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect a network One guide for each affiliate network. Each network has its own guide. Each guide shows the steps in the network, a link to the exact page, where to find each value and the mistakes that users make most often. The dashboard shows the same guide when you connect the network. ## Choose your network - [Connect Addrevenue](https://docs.afffast.com/docs/connect/addrevenue.md) - [Connect Adtraction](https://docs.afffast.com/docs/connect/adtraction.md) - [Connect Awin](https://docs.afffast.com/docs/connect/awin.md) - [Connect Daisycon](https://docs.afffast.com/docs/connect/daisycon.md) - [Connect File import (CSV and XLSX)](https://docs.afffast.com/docs/connect/file-import.md) - [Connect Impact](https://docs.afffast.com/docs/connect/impact.md) - [Connect Partner-Ads](https://docs.afffast.com/docs/connect/partner-ads.md) - [Connect Sandbox Network](https://docs.afffast.com/docs/connect/sandbox.md) - [Connect Trackwise](https://docs.afffast.com/docs/connect/trackwise.md) - [Connect Tradedoubler](https://docs.afffast.com/docs/connect/tradedoubler.md) - [Connect TradeTracker](https://docs.afffast.com/docs/connect/tradetracker.md) ## What happens after you connect You do not need to set anything up after you connect a network. The platform does these steps for you: 1. It finds the accounts of the network (for example the channels or the sites). 2. It matches each account to one of your sites, by the domain or by the name. When no site matches, it makes a new site. You can change the site of an account later with `PATCH /v1/network_accounts/{id}` or in the dashboard. 3. It starts the first sync at once, so the newest conversions are there within a minute. 4. It loads 12 months of history in chunks. Read the progress with `GET /v1/connections/{id}/setup`. The dashboard shows the same progress on the page of the connection. --- # Connect Partner-Ads Step-by-step guide to connect Partner-Ads. Follow these steps to connect Partner-Ads. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to your Partner-Ads publisher account. [Open this page in Partner-Ads](https://www.partner-ads.com/dk/) 2. Open the page "Dataudtræk / API". 3. Find the "unique key" of your account. Copy it. Do not create a new key. 4. Paste the key in the field "Unique key". 5. Open one of your tracking links. Find the number after `partnerid=` in the link. Copy it. 6. Paste the number in the field "Partner ID". ## Where to find each value - **Unique key** (`apiKey`, required, secret). In Partner-Ads, open "Dataudtræk / API". The page shows the unique key of your account. - **Partner ID** (`partnerId`, required). The number after `partnerid=` in each Partner-Ads tracking link of your account. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - Never create a new key in Partner-Ads. A new key deletes the old key. Each other tool that uses the old key stops. - The Partner ID is not the program number. Use the number after `partnerid=` in a tracking link. - The key has a space or a line break at the end. Copy the key again and paste only the key. - Partner-Ads answers "Key findes ikke" when the key is wrong. Copy the key again from the page "Dataudtræk / API". ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Partner-Ads if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `partner-ads` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect Sandbox Network Step-by-step guide to connect Sandbox Network. Follow these steps to connect Sandbox Network. The dashboard shows the same steps when you connect the network. Sandbox Network works in test mode only. ## Steps 1. Use a test key. The Sandbox Network works in test mode only. 2. Open the page to add a connection. Select Sandbox Network in the list of networks. 3. In the field Seed, type any text. The same seed always gives the same data. 4. Leave the field Scenario empty for normal data. To test an error, type failing_auth or rate_limited. To test a large volume, type high_volume. 5. Select Connect. The connection shows two sites. ## Where to find each value - **Seed** (`seed`, required). You make the seed yourself. Type any text, for example my-test-seed. The Sandbox Network has no account and no key. - **Scenario** (`scenario`, optional). Leave it empty, or type one of these words: default, high_volume, failing_auth, rate_limited. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - A live key is in use. The Sandbox Network works with a test key only. Use a key that starts with sk_test_. - The seed is empty. Type any text in the field Seed. - The scenario has a spelling mistake. Use default, high_volume, failing_auth or rate_limited. - The seed was changed after the first sync. The data changes with the seed. Use one seed for each connection. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Sandbox Network if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `sandbox` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect Trackwise Step-by-step guide to connect Trackwise. Follow these steps to connect Trackwise. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to the affiliate portal of Trackwise. 2. Open your account settings. Find the API page. 3. Copy the API key. 4. Paste the key in the field API key. ## Where to find each value - **API key** (`apiKey`, required, secret). Trackwise affiliate portal, account settings, API page. One key belongs to one affiliate account. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - You copied the key of another network. The key opens one Trackwise affiliate account only. - The key has a space at the start or at the end. Copy the key again. - You made a new key. Another platform can use the same account and the same key. A new key stops that platform. Use the key that you have. - Another platform uses the same key. TUNE allows 50 requests in 10 seconds for each key. All platforms share this limit, so a sync can be slow. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Trackwise if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `trackwise` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect Tradedoubler Step-by-step guide to connect Tradedoubler. Follow these steps to connect Tradedoubler. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to the Tradedoubler Publisher UI. 2. Open Tools, then API Info. 3. Copy the client ID. Create or copy the client secret. 4. Paste the client ID and the client secret in the fields Client ID and Client secret. 5. Enter the user name and the password of your Tradedoubler login in the fields User name and Password. ## Where to find each value - **Client ID** (`clientId`, required). Tradedoubler Publisher UI, Tools, API Info. The page shows the client ID. - **Client secret** (`clientSecret`, required, secret). Tradedoubler Publisher UI, Tools, API Info. Create the client secret there, or copy the secret that you have. - **User name** (`username`, required). The user name of your Tradedoubler login. The API uses the same user name as the Publisher UI. - **Password** (`password`, required, secret). The password of your Tradedoubler login. The API uses the same password as the Publisher UI. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - A client ID and a client secret alone do not work. The API needs the user name and the password of your login too. - The user name or the password is not the one of the Publisher UI. Use the same login that you use in the Publisher UI. - The client secret has a space or a line break at the end. Copy the secret again and paste only the secret. - You changed your Tradedoubler password. Enter the new password in the connection. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks Tradedoubler if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `tradedoubler` and the credentials. Then send `POST /v1/connections` to save them. --- # Connect TradeTracker Step-by-step guide to connect TradeTracker. Follow these steps to connect TradeTracker. The dashboard shows the same steps when you connect the network. ## Steps 1. Log in to TradeTracker. Use the account of the country that you want to connect. 2. Open the web service page of the account (the settings of the API). The page shows the customer ID and the passphrase. 3. Copy the customer ID and the passphrase. Paste them in the fields "Customer ID" and "Passphrase". 4. Enter the country of the account in the field "Country". Use 2 capital letters, for example DK. 5. To connect a second country, add a second connection. The customer ID is the same. The passphrase is different. ## Where to find each value - **Customer ID** (`customerId`, required, secret). In TradeTracker, open the web service (API) settings of your account. The page shows the customer ID. It has digits only. It is the same for all countries. - **Passphrase** (`passphrase`, required, secret). In TradeTracker, open the web service (API) settings of the account of this country. The page shows the passphrase. Each country has its own passphrase. - **Country** (`country`, required). The country of the TradeTracker account that the passphrase belongs to. Use 2 capital letters, for example DK or SE. - **Sandbox** (`sandbox`, optional). Use the TradeTracker sandbox. Keep this off for real data. - **Demo data** (`demo`, optional). Use the demo data of TradeTracker. The data is not real. Use it for tests only. Keep this off for real data. We encrypt each secret value. We never show it again after you save it. ## Common mistakes - Each country has its own passphrase. The passphrase of one country does not open the sites of another country. Add one connection for each country. - The customer ID has digits only. Do not add spaces or letters. - The passphrase has a space or a line break at the end. Copy the passphrase again and paste only the passphrase. - Keep "Sandbox" and "Demo data" off for real data. The demo data is not real. ## Check the connection Enter the values in the dashboard and press Check credentials. The check asks TradeTracker if it accepts the values. Nothing is saved until you press Save. With the API, send `POST /v1/connections/test` with the network `tradetracker` and the credentials. Then send `POST /v1/connections` to save them. --- # Destinations Send your conversions and events to Google Sheets, BigQuery, Slack or Google Analytics 4. A destination sends the conversion changes and the events of your workspace to another system. A webhook sends a request to your own server. A destination sends data to a tool that you already use. You set it up one time, and the API does the rest. ## Types Read the types and their fields with `GET /v1/destination_types`. Each type has `config_fields` (settings) and `credential_fields` (secrets). | Type | What it does | Fields | | ------------------ | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | | Google Sheets | Writes one row for each conversion. A change updates the row. | `spreadsheet_id`, `sheet_name`, `events_sheet_name`. Credential: `service_account_json`. | | BigQuery | Appends one row for each change of a conversion. | `project_id`, `dataset`, `table`, `location`, `create_if_missing`. Credential: `service_account_json`. | | Slack | Posts a message for each change and event. It can also post a daily digest. | `channel`. Credential: `bot_token` (starts with `xoxb-`; the app needs the scope `chat:write`). | | Google Analytics 4 | Sends conversions as events with the Measurement Protocol. | `measurement_id`, `event_name`, `client_id_subid`, `region`. Credential: `api_secret`. | The `GET /v1/destination_types` response is the source of truth. It has the description and the options of each field. ## Make a destination You need an API key with the scope `destinations:write`. ```bash curl -X POST https://api.afffast.com/v1/destinations \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "slack", "label": "Conversions channel", "config": { "channel": "C0123456789" }, "credentials": { "bot_token": "xoxb-..." } }' ``` The API checks `config` and `credentials` with the fields of the type. It encrypts the credentials. It never returns them. The response shows `credentials_fields_set`: the names of the credential fields that have a value. A destination has the mode of your key. A test key makes a destination that gets test data only. ## What a destination gets - By default: `conversion.created`, `conversion.status_changed` and `conversion.updated`. Use `event_types` to choose other event types. See [Webhooks](https://docs.afffast.com/docs/webhooks.md) for the list. - A conversion with a click gets one more `conversion.updated` item when the click context is joined (usually within minutes, up to 48 hours). This item has the page and the site of the click. - Only the changes that come **after** you make the destination. Use a backfill to send old conversions. - `filters` limit the data. You can filter by networks and by sites. ## Test a destination `POST /v1/destinations/{id}/test` sends one test item. The response is always 200. `ok` says if the destination accepted the item. When `ok` is `false`, `reason` says why. The test does not change the status of the destination. ## Delivery - Delivery is **at least once**. A destination can get an item two times. Use the ID of the change (`cev_...`) or the ID of the event (`evt_...`) to remove duplicates. Google Sheets updates the row of the conversion. BigQuery appends a row for each version. - The API sends the items in the order of their commit. A new item reaches the destination in seconds. - When the destination fails, the API tries again with a growing wait (15 seconds at first, doubled for each attempt, 8 attempts). After the last attempt the status is `failed`. The API then sends nothing more. - A failed destination writes the event `destination.failed`. The owners and admins get an email. - To start again, fix the problem. Send new credentials, or send `PATCH /v1/destinations/{id}` with `"status": "active"`. - `"status": "paused"` stops the delivery. A paused destination keeps its place and gets the items that came in the time of the pause. ## Backfill A backfill sends the current state of each conversion of a date range, one time. Use it for a new Google Sheet or BigQuery table. ```bash curl -X POST https://api.afffast.com/v1/destinations/dest_.../backfill \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "2026-01-01", "to": "2026-11-21" }' ``` - The range is 366 days at most. - The destination must select a conversion event type. - While the backfill runs, the live delivery waits. The changes that come in this time go out after the last page, so no change is lost. - Only one backfill runs for a destination. A second request returns 409. - Slack does not take a backfill. It would post one message for each old conversion. Google Analytics 4 takes only the last 72 hours. - Read the progress in the field `backfill` of the destination. You can also send `backfill` when you make the destination. ## Daily digest A type that supports it can send a daily digest. Only Slack supports it now. Use the field `digest` when you make or change a destination. Read `digest` of the destination type to see if the type supports it. --- # Email and setup guide The emails that the platform sends, the setup guide in the dashboard, and the DNS records that a sender domain needs. ## The setup guide A new workspace shows a setup guide on the Overview page. Each step ticks by itself when the workspace has the real object: | Step | Done when | | ----------------------------------- | -------------------------------------------------------------- | | Verify your email, create workspace | You signed in. A new user must verify the email address. | | Connect a network | The workspace has a connection. | | See your first conversions | The workspace has a conversion. | | Create an API key | The workspace has an API key. | | Make your first API request | An API key made a request (see `GET /v1/logs?source=api_key`). | | Create a link | The workspace has a link. | | Add a webhook or a destination | The workspace has a webhook endpoint or a destination. | | Invite a teammate | The workspace has a second member or an open invitation. | The state follows the mode of the page (live or test). Select **Hide** to close the guide. Select **Show the setup guide** to open it again. Each workspace keeps its own choice in this browser. ## The emails | Email | When | Sent by | | ------------------- | ---------------------------------------------------------------------------------------- | ---------------- | | Verify your email | After sign-up, and when you ask for a new link. | Dashboard server | | Welcome | One time, after you verify the email address for the first time. | Dashboard server | | Reset your password | When you ask to reset the password. | Dashboard server | | Invitation | When an owner or an admin invites a person. The link expires. | Dashboard server | | Program changes | When a program changes (see the alert settings). | Worker | | Limit warning | When a metric reaches 80 % and 100 % of the plan (see [Plans and billing](https://docs.afffast.com/docs/plans.md)). | Worker | Each email has a text part and an HTML part. The welcome email goes out one time for each user. A repeated verification does not send it again. ## Send email in development Locally, all email goes to Mailpit (`http://localhost:8025`). Set `SMTP_URL` and `SMTP_FROM`. No email leaves your computer. ## Send email in production Set `RESEND_API_KEY` and `EMAIL_FROM` for the dashboard server and for the worker. The sender domain of `EMAIL_FROM` must be verified in Resend. Resend shows the DNS records of the domain. Add them at your DNS provider: - **SPF.** A `TXT` record that lets Resend send for your domain. - **DKIM.** The `TXT` or `CNAME` record that Resend gives you. It signs each email. - **DMARC.** A `TXT` record at `_dmarc.`. Start with `v=DMARC1; p=none; rua=mailto:`. Change `p` to `quarantine` when the reports show no problem. Do not put the key in git. Keep it in the secrets of your host. To test Resend without real email, use `onboarding@resend.dev` as the sender and `delivered@resend.dev` as the recipient. --- # Errors The form of an error response, the error types and how to handle them. When a request fails, the API returns an HTTP status code of 400 or more and a JSON body with the same form each time: ```json { "error": { "type": "invalid_request_error", "code": "parameter_invalid", "message": "The limit must be between 1 and 100.", "param": "limit", "doc_url": "https://docs.afffast.com/errors/parameter-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` | Field | Meaning | | ----------------- | ------------------------------------------------------------------------------------------ | | `type` | The class of the error. See the table below. | | `code` | A stable code in snake_case. Use it in your code. It never changes for the same problem. | | `message` | A text for a developer. It can change. Do not parse it. | | `param` | The name of the parameter or the field that caused the error. It can be missing. | | `doc_url` | A link to the [page of the code](https://docs.afffast.com/errors.md) with the causes and the fix. | | `request_id` | The ID of the request. It is also in the response header `Request-Id`. Send it to support. | | `details` | A list of places that caused the error. A file import lists the rows (100 at most). | | `request_log_url` | A link to the request in the logs of the dashboard. It can be missing. | ## Error types | Type | Status codes | Meaning | | ----------------------- | ------------------ | --------------------------------------------------------------------------- | | `invalid_request_error` | 400, 404, 409, 422 | The request is not valid, or the object does not exist. | | `authentication_error` | 400, 401 | The key is missing, not valid, or in the URL. | | `permission_error` | 403 | The key cannot do this: a scope, a role, a mode or a plan limit. | | `rate_limit_error` | 429 | Too many requests. See [Rate limits](https://docs.afffast.com/docs/rate-limits.md). | | `idempotency_error` | 400, 409 | A problem with the `Idempotency-Key`. See [Idempotency](https://docs.afffast.com/docs/idempotency.md). | | `api_error` | 500 | An error on our side. | The status codes mean: - **400**: the API cannot read the request (not JSON, a key in the URL, an unknown `Api-Version`, a bad `Idempotency-Key`). - **404**: the object or the URL does not exist. - **409**: the request conflicts with the state of the data or with an earlier request. - **422**: a value is not valid. `param` names it. ## Handle errors 1. Switch on `error.code`, not on the message or on the status code alone. 2. Do not retry a `4xx` error. Fix the request. The only exception is `429`: wait for `Retry-After` seconds. 3. Retry a `5xx` error with a growing wait. Use an `Idempotency-Key` on a `POST`, and send a new key for a new try (see [Idempotency](https://docs.afffast.com/docs/idempotency.md)). 4. Keep `request_id` in your logs. Send it to support when you ask for help. The API validates a request before it runs. A request that is not valid never changes data. All error codes are in [Error codes](https://docs.afffast.com/errors.md). --- # Idempotency Repeat a POST request safely with an Idempotency-Key. A network error can leave you not knowing if a `POST` request worked. If you send it again, you can make a duplicate. Send an `Idempotency-Key` header to avoid this. ```bash curl -X POST https://api.afffast.com/v1/sites \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 5f0c2a0e-6b1d-4a3e-9c1f-0d2b7e8a9c11" \ -d '{ "name": "Blog" }' ``` ## Rules - The header is optional. It is for `POST` requests. A `GET`, `PATCH` or `DELETE` request is safe to repeat without it. - The key has 1 to 256 printable characters. Use a random value, for example a UUID. A key that is not valid gets [`idempotency_key_invalid`](https://docs.afffast.com/errors/idempotency-key-invalid.md). - The API runs the first request with a key. It stores the response, also an error response (a `5xx` too). It keeps the response for **24 hours**. - The same key with the same method, path and body returns the stored response. The response has the header `Idempotent-Replayed: true`. It has the original body and a new `Request-Id`. - The same key with a different method, path or body returns `409` [`idempotency_key_reused`](https://docs.afffast.com/errors/idempotency-key-reused.md). - The same key while the first request still runs returns `409` [`idempotent_request_in_progress`](https://docs.afffast.com/errors/idempotent-request-in-progress.md). Wait, and send the request again. - A key is valid for one API key. Two API keys can use the same value without a conflict. ## Responses that have a secret A few responses have a secret that the API shows one time: a new webhook endpoint (`secret`), a rotated secret and a new API key. The API does **not** store these responses. A repeat request runs again and makes a new object or a new secret. ## Good practice 1. Make a new key for each new action. 2. Save the key before you send the request. 3. When a request fails or times out, send it again with the **same** key and the same body. 4. After an error response that you got, use a **new** key if you want the API to try again. The API replays the stored error for the old key. --- # Documentation Guides for the AffFast API. AffFast gives you one API for the data of all your affiliate networks. Start with the quickstart. It takes less than 5 minutes. - [Quickstart](https://docs.afffast.com/docs/quickstart.md) - [Connect a network](https://docs.afffast.com/docs/connect.md) - [API reference](/reference) - [Error codes](https://docs.afffast.com/errors.md) ## Guides - [Quickstart](https://docs.afffast.com/docs/quickstart.md): a test key, the Sandbox Network and your first conversions. - [Links and click tracking](https://docs.afffast.com/docs/links.md): see which page earned each commission. - [Webhooks](https://docs.afffast.com/docs/webhooks.md): get events and verify the signature. - [Destinations](https://docs.afffast.com/docs/destinations.md): send data to Google Sheets, BigQuery, Slack or Google Analytics 4. - [Postbacks](https://docs.afffast.com/docs/postbacks.md): get conversions in near real time. - [MCP server](https://docs.afffast.com/docs/mcp.md): use the API from Claude and other AI clients. - [AI tools](https://docs.afffast.com/docs/ai.md): read the docs with an AI tool, install the agent skill and the MCP server in Claude Code, Codex, Cursor, VS Code, Windsurf and Claude Desktop. - [Test mode](https://docs.afffast.com/docs/test-mode.md): build without real data. - [Migrate from Strackr](https://docs.afffast.com/docs/migrate-from-strackr.md). ## API basics - [Errors](https://docs.afffast.com/docs/errors.md) - [Rate limits](https://docs.afffast.com/docs/rate-limits.md) - [Idempotency](https://docs.afffast.com/docs/idempotency.md) - [Pagination and expand](https://docs.afffast.com/docs/pagination.md) - [API versioning](https://docs.afffast.com/docs/versioning.md) - [Changelog](https://docs.afffast.com/docs/changelog.md) ## Account - [Plans and billing](https://docs.afffast.com/docs/plans.md) - [Email and setup guide](https://docs.afffast.com/docs/email.md) - [Legal](https://docs.afffast.com/docs/legal.md) ## For AI clients Each page has a button "Copy page as Markdown". The file [llms.txt](/llms.txt) lists all pages. The file [llms-full.txt](/llms-full.txt) has all pages in one file. --- # Data processing agreement, summary (draft) A summary of the data processing agreement between the operator and the customer. Draft text. A lawyer must review it before launch. > **Draft. Needs legal review.** This page is a summary, not the agreement. A lawyer must write the final agreement. Text in [square brackets] is open. This page summarizes the terms that Article 28 of the GDPR requires. The customer is the controller of the workspace data. The operator of the platform is the processor. ## 1. Parties and scope - **Controller:** the customer that owns the workspace. - **Processor:** [open: legal entity, address, contact]. - **Subject:** the processing of the workspace data in the platform. The [privacy policy](https://docs.afffast.com/docs/legal/privacy.md) lists the data. - **Length:** as long as the workspace exists, and until the delete is finished (see section 8). ## 2. What the processor does - The processor processes the workspace data only on the instructions of the controller. The settings and the API calls of the controller are the instructions. - The processor tells the controller at once if it thinks that an instruction breaks the law. ## 3. Kinds of data and data subjects | Data subjects | Kinds of data | | ------------------------------------------- | --------------------------------------------------------------------------------------------------- | | Visitors of the websites of the controller | Click data: the salted hash of the IP address, the country, the device, the referrer, the subids | | Buyers (as far as a network gives the data) | Order data of a conversion: the order ID, the coupon, the amounts, the status, the subids | | Members and invitees of the workspace | Name, email address, role | | Callers of the API of the controller | The network of the IP address (IPv4 /24, IPv6 /48) and the user agent in the request logs (30 days) | The platform does not ask the networks for the name or the address of a buyer. ## 4. Confidentiality Each person who works for the processor and can see workspace data must keep it confidential. [Open: the internal process.] ## 5. Security measures - Envelope encryption of network credentials and webhook secrets. The master key is not in the database. - The platform separates workspaces and modes (live and test) in the application and in the database (row-level security). - A credential is write-only after the save. - API keys are stored as a hash. A key can have a narrow scope. - Salted IP hashes for visitors. The platform does not store the IP address of a visitor. - HTTPS for all traffic. [Open: confirm in M6.] - Backups and their encryption. [Open: M6.] - Access to production data by staff is limited and logged. [Open: the process and the audit log of the internal operations view.] ## 6. Sub-processors - The controller gives a general permission for the sub-processors in the [sub-processor list](https://docs.afffast.com/docs/legal/sub-processors.md). - The processor tells the controller about a new sub-processor [open: for example 30 days] before it starts. The controller can object. If the parties cannot agree, the controller can end the contract. - The processor signs an agreement with each sub-processor with the same duties. ## 7. Help for the controller - **Data subject rights.** The platform gives the controller tools: a data export of the whole workspace (settings or `POST /v1/workspace/exports`) and the API to change or delete data. If a data subject asks the processor, the processor sends the request to the controller. - **Breach.** The processor tells the controller about a personal data breach without undue delay [open: and in 48 hours at the latest]. The message says what happened, which data it touched and what the processor does. - **Impact assessments and authorities.** The processor gives the information that it has, on request. ## 8. Delete and return - The controller can export all data at any time and can delete the workspace at any time. After the request, a grace period of 7 days starts. Then the platform deletes all data of the workspace (see the privacy policy, section 9). - The processor deletes the click data after 13 months, the request logs after 30 days and the raw postback events after 90 days, also without a delete request. - Backups: [open: the period in which deleted data leaves the backups.] - The law can require the processor or a sub-processor to keep some data (for example invoices). Then the processor keeps only this data, and only for the period that the law gives. ## 9. Audits The processor gives the controller the information that it needs to show that the processor follows this agreement. The processor allows audits and inspections [open: how often, who pays, how much notice]. ## 10. Transfers outside the EU and the EEA [Open: the hosting region and the sub-processors outside the EU. If data goes outside the EU, the agreement must name the legal basis, for example the standard contractual clauses.] ## 11. Liability and law [Open: the lawyer decides the liability, the governing law and the court.] ## Open items for the lawyer 1. The legal entity, the address and the contact. 2. The final text of the agreement, with the signature process (a click-through or a signed copy). 3. The notice periods: new sub-processor, breach. 4. The audit rules. 5. The transfer basis and the hosting region. 6. Liability and law. --- # Legal (draft) The privacy policy, the terms, the data processing agreement and the sub-processor list. All pages are drafts. > **Draft. Needs legal review.** These pages are not final legal text. A lawyer must review them before the platform goes live. The platform is not live yet. - [Privacy policy](https://docs.afffast.com/docs/legal/privacy.md): which data the platform stores, for how long, and how to export or delete it. - [Terms of service](https://docs.afffast.com/docs/legal/terms.md): the terms for the use of the platform. - [Data processing agreement, summary](https://docs.afffast.com/docs/legal/dpa.md): the terms between the operator (processor) and you (controller). - [Sub-processors](https://docs.afffast.com/docs/legal/sub-processors.md): the companies that process data for the platform. --- # Privacy policy (draft) Which personal data the platform stores, for how long, and how you can export or delete it. Draft text. A lawyer must review it before launch. > **Draft. Needs legal review.** This page is not final legal text. A lawyer must review it before the platform goes live. Text in [square brackets] is open: someone must decide it first. The list of open items is at the end of this page. This policy says which personal data the platform stores and why. It also says how long the platform keeps the data and how you can export or delete it. ## 1. Who is responsible - The operator of the platform is [open: legal entity, address, company number, contact email]. - For the data of your account (see section 3), the operator is the **controller**. - For the data of your workspace (conversions, clicks, links, connections), you are the controller. The operator is the **processor**. The [data processing agreement](https://docs.afffast.com/docs/legal/dpa.md) applies. ## 2. What the platform is The platform reads the sales data of your affiliate networks through their APIs. It also runs short links (redirects) for your affiliate links. It gives you the data through a dashboard and through an API. ## 3. Which data the platform stores | Data | Examples | Why | | ---------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------- | | Account data | Name, email address, a password hash, the settings of two-step login | To sign you in and to contact you | | Session data | Session token, the network of the IP address (see section 5) and the browser text (user agent) of the sign-in | To keep you signed in and to secure it | | Workspace members | Name, email address and role of each member. Invitations (email address). | To control who can use a workspace | | Billing data | The plan, the status of the subscription, the Stripe customer ID. Stripe keeps the card. | To bill the subscription | | Network credentials | API keys and tokens of your affiliate network accounts. Stored encrypted. Never shown. | To read your sales data | | Sales data | Conversions, payouts, programs, brands, deals. The amounts and the status. | To show your reports | | Click data of visitors | See section 4 | To count clicks and to attribute sales | | API request logs | See section 5 | To help you find errors | | Postback events | The raw requests that your networks send to your postback URL | To make provisional conversions | ## 4. Click data of your visitors A visitor who uses one of your short links reaches the redirector. The platform stores this data for each click: - the time, the link code and the program, - the host of the destination (not the path, not the query), - the referrer and the page where the link was, without the query (the `utm_` values stay), - the country (from the IP address, with a local GeoIP database), - the device type, the operating system and the browser, - the values (`subid`) that you put in your link, - **a salted hash of the IP address** and a hash of the user agent. The platform does **not** store the IP address of the visitor. The salt of the hash changes each day. So the platform cannot find the same visitor on two days. The platform does not set a cookie on the visitor and does not read one. The platform keeps each click for **13 months**. Then it deletes the click. The daily rollups (the number of clicks for each day, program, link, country and device) stay. They have no visitor identifier. A rollup has a count of unique hashes for one day only. ## 5. API requests The platform logs each request to the API for **30 days**. The log has the time, the method, the path, the query, the status, the time used, the user agent, the headers and the bodies (secrets removed, 64 KB at most), and **the network of the IP address of the caller**. This is the network of your server or of your browser, not of a visitor. **The platform does not store the full IP address of a caller.** It keeps the first 24 bits of an IPv4 address and the first 48 bits of an IPv6 address. Example: `203.0.113.77` becomes `203.0.113.0`, and `2001:db8:1234:5678::1` becomes `2001:db8:1234::`. This also applies to each address in the `X-Forwarded-For` header of the log. A value that is not an IP address is not stored. Why the platform makes the choice this way: the log is for two purposes. One is to help you find errors in your own requests. The other is to find abuse. Both need to know which network a request came from, for example to see that a faulty server of yours calls the API, or that one range of addresses sends a flood of requests. Neither needs the address of one device. The platform could keep the full address for 30 days for security, but the shorter form is enough for these purposes, so the platform does not keep more than it needs. The platform also stores the network of the IP address of the last request of each API key (the same form), until you delete the key. A new session of the dashboard has the network of the IP address too, in the same form. The browser text (user agent) of a session stays as it is. ## 6. How long the platform keeps data | Data | Period | | ----------------------------------------------- | -------------------------------------------------------------- | | Clicks (raw) | 13 months | | Daily click rollups | Until you delete the workspace | | Click counts of the networks (`network_clicks`) | 13 months. Also removed when you delete the connection. | | API request logs | 30 days | | Events (the change log) | 30 days | | Webhook delivery log | 30 days | | Raw postback events | 90 days | | Files of a data export | 7 days | | Sessions of the dashboard | Until they expire, and one day more. A daily job deletes them. | | Verification rows (email link, password reset) | Until they expire. A daily job deletes them. | | Sales data, links, sites, tags | Until you delete the data or the workspace | | Network credentials | Until you change them, delete the connection or the workspace | | Account data | Until you delete your account (see section 9) | The platform enforces these periods with scheduled jobs and with time limits in the database. The periods are in the code and in the tests. ## 7. Cookies and tracking - The **dashboard** sets one cookie: the session cookie. It is strictly necessary to keep you signed in. It needs no consent. The dashboard also keeps your choices (the mode live or test, the theme, the state of the checklist) in the local storage of your browser. This data does not leave your browser. - The dashboard has **no** advertising cookie and **no** analytics cookie. It does not use a third-party tracker. - The **redirector** sets no cookie and reads no cookie. - The **public website and the documentation**: [open: check before launch. If an analytics tool is added, this section must list it, and a cookie notice may be needed.] - The **API** uses no cookie. A dashboard session uses a token in the `Authorization` header. ## 8. Your rights You can use these rights for the data of your account and workspace: - **Access and portability.** The owner of a workspace can export all data of the workspace. Use the button "Request a data export" in the settings, or the API (`POST /v1/workspace/exports`). The file is a ZIP file of JSON lines files. It has the data of live mode and test mode. It has no credentials and no key hashes. The download link works for 15 minutes. The file is deleted after 7 days. - **Delete.** The owner of a workspace can delete the workspace in the settings. Each user can delete the own account in the settings. See section 9. - **Correction.** You can change the name and the email address of your account, and the data of your workspace, in the dashboard and in the API. - **Other rights** (restriction, objection, complaint to a supervisory authority): write to [open: contact email]. If you are a visitor of one of our customers, ask that customer first. The customer is the controller of your click data. ## 9. How the delete of a workspace and of an account works 1. The owner types the name of the workspace to confirm. Only the owner can start a delete. 2. The **grace period** starts. It is **7 days**. At once, the platform revokes all API keys, stops all syncs, webhook endpoints, destinations and postback sources, and cancels the subscription. Your short links keep working during the grace period. 3. During the grace period, the owner can cancel the delete. The data stays. The keys, the syncs and the subscription do not come back. The owner makes them again. 4. At the end of the grace period, a job deletes **all data of the workspace**: all rows in the databases (live and test), all clicks and logs in the click database, all files in the object storage (imports, raw pages, exports), the records of the redirector, the members and invitations, and the workspace. 5. The same job deletes the **customer object of the workspace at Stripe** (name, email address and billing details). If Stripe does not answer, the job does not wait: the data is deleted, and a second job tries again until Stripe deletes the customer. If the customer does not exist at Stripe any more, this is not an error. 6. The user accounts stay. A user can own other workspaces. See the next part for the delete of an account. What stays after the delete: - The invoices and payment records at the payment provider (see the [sub-processor list](https://docs.afffast.com/docs/legal/sub-processors.md)). The law requires the provider to keep them. The provider is responsible for this data. The customer object at the provider is deleted (step 5). - Backups. [Open: the backup period is decided in M6. The text must say when a deleted workspace leaves the backups.] - The platform logs of the servers (the IP address of a request to the API) for [open: period]. ### Delete your account Each user can delete the own account in the settings of the dashboard ("Delete my account"). 1. You type the email address of your account to confirm. 2. A user that **owns a workspace** cannot delete the account. Delete the workspace first (see above), or make another member the owner. The platform checks this when you ask and again at the end of the grace period. 3. The **grace period** is **7 days**, the same as for a workspace. You stay signed in, and you can cancel in the settings. 4. At the end of the grace period, a job deletes your sign-in data: your user record (name and email address), your password hash, your settings of two-step login, all your sessions, your memberships in workspaces, the invitations that you sent or got, the open verification rows, and your customer object at Stripe if one exists. 5. The data of the workspaces that you were a member of stays with the workspace. It has your user ID (for example as the creator of a link), but no name and no email address. ## 10. Security - The platform stores network credentials with envelope encryption. The master key is not in the database. - Workspaces share no data. Each query has the workspace and the mode. The database also refuses the rows of other workspaces (row-level security). - A credential is write-only. After you save it, no screen and no API response shows it. - All traffic uses HTTPS. [Open: confirm in M6.] ## 11. Sub-processors, transfers and changes - The [sub-processor list](https://docs.afffast.com/docs/legal/sub-processors.md) names the companies that process data for the platform. - [Open: the hosting provider and the region. The goal is hosting in the EU. If data goes outside the EU, this section must name the legal basis, for example the standard contractual clauses.] - If this policy changes, the platform shows the change in the dashboard and sends an email to the owners [open: how long before]. ## Open items for the lawyer and the operator 1. The legal entity, the address and the contact email. 2. The hosting provider, the region and the transfer basis (decided in M6). 3. The backup period and its effect on deleted data (M6). 4. The analytics and cookie rules of the public website. 5. The period to keep the server logs. 6. The legal basis for each use (contract, legitimate interest). The lawyer must check the table in section 3. 7. The notice period for changes. --- # Sub-processors (draft) The companies that process data for the platform. Draft list. The hosting provider is not decided yet. > **Draft. Needs legal review.** The list below comes from the software of the platform. The hosting decisions are open: the platform is not deployed yet (milestone M6). A lawyer and the operator must complete and check this page before launch. A sub-processor is a company that processes personal data for the platform. The [data processing agreement](https://docs.afffast.com/docs/legal/dpa.md) says how the platform adds or changes a sub-processor. ## Sub-processors that the software uses | Company | What it does | Data | Location | | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------- | | Stripe Payments Europe, Ltd. | Payments and subscriptions (billing). Metered usage: the platform sends usage counts for the overage of a paid plan. | The email address of the owner, the billing details, the card (Stripe only), usage counts | [open: confirm the EU or US entity and region] | | Resend, Inc. (or an SMTP provider) | Sends the emails of the platform: verification, invitations, alerts, welcome. The operator chooses one of the two. | The email address and the text of the email | [open: confirm. Resend or another provider.] | ## Open: hosting | Item | Status | | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | Server hosting (the VPS provider) | **Open.** Decided in M6. The platform runs on its own servers with Dokploy. The goal is a provider in the EU. | | Object storage (S3-compatible) | **Open.** Decided in M6. It keeps import files, raw network pages and the files of data exports. | | Backups | **Open.** Decided in M6. | | DNS, CDN and DDoS protection | **Open.** Decided in M6. If a CDN is in front of the redirector, it sees the IP address of each visitor. This must then be on this list. | | Monitoring, error tracking, status page | **Open.** The platform plans self-hosted tools. If a hosted tool is used, it must be on this list. | ## Not sub-processors - **The affiliate networks** (Awin, Adtraction, Daisycon and others). The customer connects its own account. The platform reads data with the credentials of the customer. The network is a source, not a processor of the platform. - **The destinations of the customer**: Google Sheets, BigQuery, GA4, Slack and webhook URLs. The customer chooses them and gives the credentials. The platform sends data there on the instruction of the customer. These companies are recipients of the customer. - **The GeoIP database.** The platform finds the country of an IP address with a database file on its own server. It sends no IP address to a third party. - **Software libraries** that run on the servers of the platform (for example the sign-in library). They get no data from the operator. ## Changes The platform tells the owners about a new sub-processor before it starts [open: notice period, see the data processing agreement]. --- # Terms of service (draft) The terms for the use of the platform. Draft text. A lawyer must review it before launch. > **Draft. Needs legal review.** This page is not final legal text. It lists the points that the final terms must cover, with the facts of the product. A lawyer must write the final terms. Text in [square brackets] is open. ## 1. The service The platform reads the sales data of your affiliate networks and gives it to you through a dashboard, an API, webhooks and MCP. It also runs short links for your affiliate links. The [plans page](https://docs.afffast.com/docs/plans.md) lists the plans and the limits. ## 2. Accounts and workspaces - You need an account. You must give true data and keep your password secret. - A workspace belongs to its owner. The owner can invite members, and can change the roles. - The owner is responsible for the use of the workspace, also by members and by API keys. ## 3. Your data and your networks - You own your data. You are the controller of the data of your workspace. The [data processing agreement](https://docs.afffast.com/docs/legal/dpa.md) applies. - You must have the right to connect each network account. The terms of the network apply. Some networks restrict third-party access to their APIs. You are responsible for this. - The platform only reads data from your networks. It does not change your network accounts, callbacks or keys. ## 4. Acceptable use You must not: - break the law or the terms of a network, - try to get the data of another workspace, - send more requests than the rate limit allows, - use the short links for spam, fraud or illegal content, - send a destination URL that is not allowed (the platform checks the destination of a link). The platform can suspend a workspace for a serious breach. [Open: the process and the notice.] ## 5. Plans, payment and limits - The plans, prices and limits are on the [plans page](https://docs.afffast.com/docs/plans.md). [Open: the prices are drafts until the operator confirms them.] - A paid plan renews each month. Stripe takes the payment. A trial can be free for 14 days. - A limit of a plan never stops a redirect or the logging of a click. A Free workspace can reach the limit of connections and conversions. Then the sync stops until the next period or until you upgrade. - [Open: refunds, taxes (VAT), invoices, changes of price and notice.] ## 6. Availability [Open: the promise of availability (SLA), the support hours and the maintenance windows. The platform is built to keep the redirector working on a second server. The final terms must say what is promised.] ## 7. End of the contract - You can cancel the subscription at any time in the dashboard. - The owner can delete the workspace at any time. A grace period of 7 days applies (see the [privacy policy](https://docs.afffast.com/docs/legal/privacy.md), section 9). - [Open: what happens to a workspace that does not pay, and how long the data stays.] ## 8. Liability, warranty and law [Open: the lawyer decides the warranty, the limit of liability, the governing law and the court. The platform shows data from third parties. The platform does not promise that this data is correct or complete. Check the numbers with your network.] ## 9. Changes [Open: how the platform changes the terms and how it tells you.] ## Open items for the lawyer 1. The operator and the contract parties. 2. Acceptable use and suspension. 3. Prices, taxes, refunds and the trial. 4. Availability and support. 5. Liability, warranty, law and court. 6. Changes of the terms. --- # Links and click tracking Make tracked links, count clicks, and see which page earned each commission. The API has its own redirector. A visitor clicks a link of yours. The redirector saves the click and sends the visitor to the network. When the visitor buys, the conversion comes back with the same click ID. So you know which link, which page and which SubID earned the commission. ## How it works 1. You make a link for a program. The API gives you a short URL, for example `https://afffast.link/k3Xa9Qz`. 2. A visitor opens the short URL. The redirector saves the click and sends a `302` redirect to the page of the advertiser, through the tracking of the network. 3. The redirector puts our click ID in a SubID slot of the network. The click ID has 12 characters. 4. The network reports the conversion with that SubID. The sync joins the conversion to the click. The conversion gets `click_id`, `user_subids` and `click_context` (site, page, referrer, country and device). A bot, a prefetch request and a `HEAD` request get the redirect and no click. Redirects never stop when you reach a limit of your plan. A network with no SubID slot cannot join a conversion to a click. Read `capabilities.subid_slots` of the network with `GET /v1/networks/{id}`. ## Make a saved link A program needs a deeplink template (`deeplink_support: true`). The host of the destination must be on a domain that the program allows. You need the scope `links:write`. ```bash curl -X POST https://api.afffast.com/v1/links \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "program": "prog_...", "destination": "https://shop.example/products/boots", "site": "site_...", "subids": { "s1": "blog-post-12" } }' ``` The response has `url`, the short URL that you share. The code of the link has 7 or 8 characters. - `subids` are your own labels `s1` to `s5`. A value has 255 characters at most. The redirector stores them with the click. It sends them to the network when the network has a slot for them. - `active: false` pauses the link. A paused link does not redirect. - `POST /v1/links/batch` makes up to 100 links. It returns the results in the order of the items. - Read the clicks of a link with `GET /v1/links/{id}?include_clicks=true`. Errors that you can get: [`program_deeplinks_unsupported`](https://docs.afffast.com/errors/program-deeplinks-unsupported.md) and [`link_destination_not_allowed`](https://docs.afffast.com/errors/link-destination-not-allowed.md). ## Make a deeplink without saving it `POST /v1/deeplinks` makes up to 100 deeplinks in one request. By default the API saves nothing. Each item gives a signed URL: `/r?p=...&u=...&sig=...`. Use `"save": true` to save the link and get a short URL (this needs the scope `links:write` too). You need the scope `deeplinks:write`. The API checks each item alone. An item that is not valid has an error in its result. The other items still succeed. ## Track the page The page of a click is the value of the query parameter `page` of the link, or the `Referer` header when the link has no `page`. Add the parameter to the link when you know the page and the referrer is not sent: ```text https://afffast.link/k3Xa9Qz?page=https://blog.example/boots-review ``` The redirector normalizes the page. It removes the fragment, the slash at the end of the path and all query parameters except `utm_*`. So all clicks from one article have one page value. ## Read the clicks and the revenue - `GET /v1/clicks` lists the clicks, newest first. Filter by `link`, `program`, `site`, `country`, `device` and time. It needs the scope `clicks:read`. The API keeps raw clicks for 13 months. - `GET /v1/stats/clicks` counts the clicks. Use `group_by` with `day`, `week`, `month`, `country`, `device` or `link`. - `GET /v1/stats?group_by=page` shows the revenue of each page. `group_by=subid` shows the revenue of each SubID. Choose the slot with `subid_slot`. A conversion with no click is in the group `unattributed`. - Bot clicks are not counted. Use `include_bots=true` on `GET /v1/clicks` to see them. Listen to the event `click.attributed` with a [webhook](https://docs.afffast.com/docs/webhooks.md) to know when a conversion is joined to a click. ## Test the attribution Use a test key. Make a test link and open it. Then send `POST /v1/test/conversions` with the `click_id` of the click. The conversion goes through the same join as a conversion of a sync. See [Test mode](https://docs.afffast.com/docs/test-mode.md). --- # MCP server Use the API as tools in Claude Code and Claude Desktop. The API has a hosted MCP server. An AI client uses it to read and write your data. For example, you can ask "revenue by network" and the client calls the stats tool. The URL is `https://api.afffast.com/mcp`. It uses the Streamable HTTP transport. Use an API key in the `Authorization` header. A key in the query string is not accepted. ## Connect Claude Code Run this command. Use a test key (`sk_test_...`) first. ```bash claude mcp add --transport http afffast https://api.afffast.com/mcp \ --header "Authorization: Bearer sk_test_..." ``` Then ask: "Query the revenue by network for this year." The [AI tools guide](https://docs.afffast.com/docs/ai.md) has one page for each tool. It has the steps for Claude Code, Codex, Cursor, VS Code, Windsurf and Claude Desktop. Each page keeps the key in an environment variable. ## Connect Claude Desktop Add the server to the file `claude_desktop_config.json`. The `mcp-remote` package gives the HTTP server to Claude Desktop. ```json { "mcpServers": { "afffast": { "command": "npx", "args": [ "mcp-remote", "https://api.afffast.com/mcp", "--header", "Authorization: Bearer ${AFFFAST_API_KEY}" ], "env": { "AFFFAST_API_KEY": "sk_test_..." } } } } ``` ## What the tools do - Each tool is one API operation. For example, `list_sites` is `GET /v1/sites`, and `get_stats` is `GET /v1/stats`. - A tool call has the same scopes, rate limits, request logs and errors as the REST request. The call appears in the request logs. - The key decides what the client sees. A read-only key has no write tools. A test key reads test data only. - Two more tools read these docs. They need no scope and read no workspace data. The call still needs a valid API key. See [Docs tools](#docs-tools). - Operations that only the dashboard can do (API keys, members, billing) are not tools. A file upload is not a tool. - A new API operation becomes a tool with no other work. ## Docs tools The server has two tools for these docs. An agent can read the docs without a web browser. - `search_docs` takes `query` (words to search for) and an optional `limit` (1 to 10, default 5). It returns a list. Each item has the `title`, the `url` of the Markdown copy of the page, and a short `snippet`. Pages with a matching title come first. - `read_doc` takes `path`, the path of a docs page, for example `/docs/quickstart`. It returns the Markdown of the page. An unknown path gives a tool error that tells the client to use `search_docs`. Both tools are read-only. They need no scope, and every valid key sees them. A call without a valid key fails, as for all MCP calls. The docs come from the docs build, so they are the same as the pages of this site. --- # Migrate from Strackr Move your affiliate reporting from Strackr to AffFast. This guide maps the concepts and lists the steps. This guide helps you move your affiliate reporting from Strackr to AffFast. It uses only facts that Strackr shows on its public website and in its public documentation. The list of sources is at the end of the page, in a comment in the source file. Strackr and AffFast are different products. This guide does not compare quality or price. Check the current details of Strackr on its own website. ## Who this guide is for Use this guide if you: - read affiliate data from several networks in Strackr, and - want the same data in AffFast, through an API, webhooks or exports. ## Map the concepts Strackr names its concepts on its public pages. This table shows the nearest object in AffFast. Check each row against your own use. The two products do not match one for one. | Strackr (public term) | AffFast | Notes | | --------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | Network integrations | Connections. See [Connect a network](https://docs.afffast.com/docs/connect.md). | Use one connection for each network account. | | Advertisers, programs | Programs and brands. `GET /v1/programs`, `GET /v1/brands`. | | | Transactions | Conversions. `GET /v1/conversions`. | Strackr shows the statuses pending, confirmed (or accepted) and declined (or refused). | | Clicks | Clicks. `GET /v1/clicks`. See [Links](https://docs.afffast.com/docs/links.md). | | | Link Builder | Links and deeplinks. `POST /v1/links`, `POST /v1/deeplinks`. See [Links](https://docs.afffast.com/docs/links.md). | | | SubID | `subids` on a link. Group with `GET /v1/stats?group_by=subid`. | Read `capabilities.subid_slots` of a network to see its SubID slots. | | Views (group statistics by website) | Sites. `GET /v1/sites`. | A site groups statistics by website in the same way. | | Categories (groups of advertisers) | Tags. `GET /v1/tags`. | | | Deals, promo codes | Deals. `GET /v1/deals`. | | | Reports, performance statistics | Statistics. `GET /v1/stats` with `group_by`. | | | Email reports, Slack | Destinations and webhooks. See [Destinations](https://docs.afffast.com/docs/destinations.md) and [Webhooks](https://docs.afffast.com/docs/webhooks.md). | Your own code or a destination sends the message. | | Affiliate API | The public API. See the [API reference](/reference). | | | MCP server for AI assistants | The MCP server. See [MCP](https://docs.afffast.com/docs/mcp.md). | | | CSV file or Google Sheet import (custom connection) | The network `file-import`. See [Connect File import](https://docs.afffast.com/docs/connect/file-import.md). | | ## Migrate in 7 steps 1. **Make an account and a test key.** Follow the [quickstart](https://docs.afffast.com/docs/quickstart.md). Use a test key and the Sandbox Network first. You need no network credentials for this. 2. **Connect each network.** Connect each network that you use in Strackr. Use the guide for that network in [Connect a network](https://docs.afffast.com/docs/connect.md). The API loads 12 months of history for each new connection. 3. **Run a backfill.** Wait for the first sync to finish. To load older data, import a file with the network `file-import`. 4. **Compare the totals of one month.** Read the totals of one closed month with `GET /v1/stats`. Compare them with the same month in Strackr. A small difference can come from the time zone, the currency conversion or the status of a conversion. 5. **Switch your webhooks and exports.** Make an endpoint for each event that you need. See [Webhooks](https://docs.afffast.com/docs/webhooks.md). To read the data in bulk, use [pagination](https://docs.afffast.com/docs/pagination.md) or the workspace exports (`/v1/workspace/exports`). 6. **Run both tools in parallel.** Keep both tools active for a period that you choose, for example 1 or 2 months. Compare the numbers each week. 7. **Turn the old tool off.** Do this only when the numbers match and your own systems read the new data. Follow the instructions of Strackr to end your subscription. ## What is different - **API-first.** Each action for data and integrations has a matching API call. See the [API reference](/reference). - **Test mode.** A test key (`sk_test_...`) works on separate data. You can test your code without real conversions. See [Test mode](https://docs.afffast.com/docs/test-mode.md). - **Standard Webhooks signatures.** Each webhook request has the headers `webhook-id`, `webhook-timestamp` and `webhook-signature`. See [Webhooks](https://docs.afffast.com/docs/webhooks.md). - **Cursor pagination.** A list returns a page and a cursor for the next page. See [Pagination](https://docs.afffast.com/docs/pagination.md). - **Dated API versions.** The `Api-Version` header pins the behavior of the API to a date. See [API versioning](https://docs.afffast.com/docs/versioning.md). ## FAQ **Can I keep my data in Strackr while I try this?** Yes. You can run both tools at the same time. **Do I lose my history?** No. The API loads 12 months of history for each new connection. You can import older conversions from a file. **Where are my Strackr views and categories?** Make them again as sites and tags. See the table above. **Do the totals match exactly?** Not always. Check the time zone, the currency and the status of the conversions first. **Which networks can I connect?** See [Connect a network](https://docs.afffast.com/docs/connect.md) for the list. If a network is not on the list, import its conversions with `file-import`. **Where do I get help?** Read the [errors](https://docs.afffast.com/docs/errors.md) pages and the [API reference](/reference). --- # Pagination and expand Read long lists with cursors, and get related objects with expand[]. ## The list envelope Each list operation returns the same envelope: ```json { "object": "list", "url": "/v1/conversions", "has_more": true, "data": [{ "id": "conv_...", "object": "conversion" }] } ``` `data` has the objects, newest first. `has_more` is `true` when more objects follow this page. ## Cursors The API uses cursors, not page numbers. A cursor is the ID of an object. | Parameter | Meaning | | ---------------- | -------------------------------------------------------------------- | | `limit` | The size of the page. From 1 to 100. The default is 20. | | `starting_after` | The ID of an object. You get the objects that are **older** than it. | | `ending_before` | The ID of an object. You get the objects that are **newer** than it. | Use only one of `starting_after` and `ending_before`. If you send both, or a `limit` outside the range, the API returns [`parameter_invalid`](https://docs.afffast.com/errors/parameter-invalid.md). The response also has a `Link` header for the next page. To read all objects, use the ID of the last object of a page as `starting_after`. Stop when `has_more` is `false`. ```js async function* listAll(path) { let startingAfter; while (true) { const url = new URL(`https://api.afffast.com${path}`); url.searchParams.set("limit", "100"); if (startingAfter) url.searchParams.set("starting_after", startingAfter); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.AFFFAST_API_KEY}` }, }); const page = await response.json(); yield* page.data; if (!page.has_more) return; startingAfter = page.data.at(-1).id; } } ``` A new object that comes while you read does not move the pages. A page does not repeat an object and does not miss one. Some lists have a `sort` parameter. `GET /v1/conversions` sorts by `-sold_at` by default. Conversions with the same time keep a stable order. ## Statistics are not lists `GET /v1/stats` and `GET /v1/stats/clicks` are not paginated. They return one object with a `rows` array. Use `group_by` and the date range to control the size. ## Expand Many objects have a field with the ID of a related object, for example `program` on a conversion. Add `expand[]` to get the whole object in place of the ID. ```bash curl -g "https://api.afffast.com/v1/conversions?expand[]=program&expand[]=click" \ -H "Authorization: Bearer $AFFFAST_API_KEY" ``` - Use `expand[]` more than one time to expand more than one field. - On a list, a path can start with `data.`, for example `data.program`. - A path can have 3 levels at most. - A field that you cannot expand returns [`expand_invalid`](https://docs.afffast.com/errors/expand-invalid.md). The message lists the fields that you can expand. - An event has no field that you can expand. --- # Plans and billing The plans, the limits and the overage prices. Prices are drafts until the launch. Each workspace has one plan. A workspace without a subscription uses the Free plan. > The prices on this page are draft values. The product owner confirms them before launch. ## Plans | Plan | Price | Trial | Connections | Conversions each month | Clicks each month | | -------- | -------------- | ------- | ----------- | ---------------------- | ----------------- | | Free | €0 | None | 1 | 500 | 10,000 | | Starter | €9 each month | 14 days | 3 | 2,000 | 50,000 | | Pro | €29 each month | 14 days | 10 | 10,000 | 250,000 | | Business | €79 each month | 14 days | 30 | 50,000 | 1,000,000 | All plans include the API, webhooks and MCP. Prices are in euro, without tax. ## Overage A paid plan bills the use above its limits at the end of the billing period. | Plan | Extra connection | 1,000 extra conversions | 1,000 extra clicks | | -------- | ---------------- | ----------------------- | ------------------ | | Starter | €3.00 | €10.00 | €0.20 | | Pro | €2.00 | €6.00 | €0.15 | | Business | €1.50 | €4.00 | €0.10 | The Free plan has no overage. It stops at its limits (see below). A limit never stops redirects or click logging on any plan. Test mode has no limits on any plan. Test data is never counted and never billed. ## Usage and limits The API counts the use of each workspace in a usage period of one month. A paid workspace uses the months of its billing period. A Free workspace uses the calendar month (UTC). - **Connections.** The number of connections now. - **Conversions.** The conversions that the sync wrote for the first time in the period. - **Clicks.** The human clicks of the period. Bots are not counted. Read the usage with `GET /v1/usage`. It needs no scope. It shows the plan, the period and, for each metric, the use, the included amount, the overage and the state: `ok` (below 80 % of the included amount), `soft` (80 % or more) and `hard` (the limit). | Plan | `soft` starts at | `hard` starts at | What happens above the included amount | | --------- | ---------------- | ------------------ | -------------------------------------------------- | | Free | 80 % | 100 % of the limit | Stops new connections and the sync of conversions. | | Paid plan | 80 % | Never | Nothing stops. Stripe bills the overage. | A paid plan has no hard limit: we bill all use above the included amount as overage. At the `hard` limit of a metric on the Free plan: - **Connections.** `POST /v1/connections` returns 403 `plan_limit_reached`. The connections that exist keep their sync. - **Conversions.** New sync jobs of conversions wait, and `POST /v1/connections/{id}/sync` returns 403 `plan_limit_reached`. A job that runs is not stopped. Programs, payouts and deals syncs go on. The paused jobs run again when the plan changes or the next period starts. - **Clicks.** Nothing stops. The dashboard asks you to upgrade. The owners and the admins get an email when a metric reaches 80 % and 100 % of the included amount. Each email is sent once for each metric and period. The counters of conversions and clicks come from a job that runs every 5 minutes, so `GET /v1/usage` can be a few minutes old. The number of connections is always current. ## Trial A new paid workspace gets a trial of 14 days. The Billing page shows the end date of the trial. A workspace has one trial only. ## Who can change the plan Only an owner can start a subscription, change the plan, open the Stripe customer portal or cancel. An admin can read the plan. A member cannot see the subscription. Billing (plans, payment and the subscription) is only in the dashboard. The usage is in the API: `GET /v1/usage`. --- # Postbacks Get conversions in near real time from Awin, Impact, Tradedoubler and tracking platforms. A postback is a request that a network sends when a conversion happens. You get the conversion in seconds. You do not wait for the next sync. A postback is a hint. The sync of the connection is the source of truth. A postback makes a provisional conversion. The next sync of the same conversion overwrites it. You never get a duplicate. ## How it works 1. You make a postback source for a connection. The API gives you a secret URL. 2. You paste the URL into the network. The network calls it for each conversion. 3. The endpoint stores the request and answers `200` at once. 4. A worker makes the provisional conversion. The API sends the `conversion.created` event to your webhooks. 5. The next sync overwrites the provisional conversion with the data of the network. The same transaction ID must be in the postback and in the sync. The API deduplicates on it. A postback never changes a conversion that a sync wrote already. A postback for a known provisional conversion can change its status (for example Impact `REVERSED`). ## Make a source You need an API key with the scope `connections:write`. Only owners and admins have it. ```bash curl -X POST https://api.afffast.com/v1/postback_sources \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "connection": "conn_...", "label": "Awin main" }' ``` The response has two URLs: - `url` is the secret URL. The token in it is a credential. Anyone who has it can send conversions. Do not share it. - `template_url` is `url` with the parameters and the macros of the network. Paste this URL into the network. Use `POST /v1/postback_sources/{id}/reveal` to see the URL again. Use `POST /v1/postback_sources/{id}/rotate` to make a new token. The old URL stops at once. A connection can have 5 sources. ## Awin 1. Make a source for an Awin connection. The template is `awin`. 2. In Awin, open **Toolbox**, then **Transaction Notifications**. Awin support must turn the option on in some accounts. 3. Choose the method `GET`. Paste `template_url`. Turn on **Click Source Data**. The macros are `!!!transactionId!!!`, `!!!transactionDate!!!`, `!!!transactionAmount!!!`, `!!!transactionCurrency!!!`, `!!!commission!!!`, `!!!merchantId!!!`, `!!!affiliateId!!!` and `!!!clickRef!!!` to `!!!clickRef6!!!`. Awin sends the amounts in the currency of the program. The sync brings the amounts in the currency of your account. The sync overwrites the provisional amounts. A `POST` callback also works: the endpoint reads the field `AwinTransactionPush`. ## Impact 1. Make a source for an Impact connection. The template is `impact`. 2. In Impact, open **Technical**, then **Event Notifications**. Make a notification for the event "Action Tracked". Choose the method `GET`. Paste `template_url`. The macros are `{ActionId}`, `{CampaignId}`, `{Oid}`, `{Amount}`, `{Payout}`, `{Currency}`, `{EventDate}`, `{State}` and `{SubId1}` to `{SubId3}` and `{SharedId}`. ## Tradedoubler 1. Make a source for a Tradedoubler connection. The template is `tradedoubler`. 2. Make a Conversions push subscription in the Tradedoubler account. Use the method `GET` and paste `template_url`. The placeholders are `${transactionId}`, `${orderNumber}`, `${orderValue}`, `${publisherCommission}`, `${currencyId}`, `${programId}`, `${siteId}`, `${timeOfEvent}`, `${messageTypeId}`, `${epi}` and `${epi2}`. The message type gives the status: 1 Tracked, 4 Pending and 3 Paused are `pending`. 5 and 6 are `approved`. 2, 7 and 8 are `rejected`. 9 is `paid`. ## Tracking platforms (custom) Use the template `custom` for any other platform, for example Everflow or Tune. You tell the API which parameter holds which field. ```json { "connection": "conn_...", "mapping": { "external_id": "txn_id", "order_amount": "amount", "commission": "payout", "currency": "currency", "click_id": "sub1", "status": "status", "status_map": { "approved": "approved", "rejected": "rejected" }, "sold_at": "ts" } } ``` Only `external_id` is required. `click_id` is the parameter that holds our click ID. `subids` maps a SubID slot of the network to a parameter. `time_format` is `auto`, `unix` or `unix_ms`. Change the mapping with `PATCH /v1/postback_sources/{id}`. ## Attribution Our click ID goes in the first SubID slot of the network. A postback with a valid click ID gets the click context (site, page, referrer, country) like a synced conversion. A value that is not a click ID of ours is ignored. ## Limits and errors - The endpoint accepts `GET` and `POST`. A query can have 8 KB. A body can have 64 KB. - The endpoint limits the requests for each IP address and for each token. It answers `429` with `Retry-After`. - An unknown, disabled or rotated token gets the same `200` answer as a good one. The endpoint stores nothing for it. This way nobody can find out which tokens exist. - A postback that has no usable transaction ID, or an amount that is not a number, makes no conversion. The raw request stays in the log for 90 days. --- # Quickstart Make your first API call with a test key and the Sandbox Network. It takes less than 5 minutes. In this guide you make a test key, connect the Sandbox Network, and read the first conversions. The Sandbox Network makes fake data. You need no network account and no credentials. All requests use this base URL: `https://api.afffast.com`. Replace it with the URL of your API. ## 1. Make a test key 1. Sign up in the dashboard and make a workspace. 2. Switch the dashboard to **test mode**. 3. Open **API keys** and select **Make a key**. Choose the scope `full`, or a narrower scope. 4. Copy the key. The dashboard shows it one time. A test key starts with `sk_test_`. Only the owner of the workspace can make a key with the scope `full`. An admin can make keys with narrower scopes, for example `read_only` or `sites:read`. When an admin asks for the scope `full`, the API returns 403 with the code `permission_denied`. An admin also cannot rotate a key that has the scope `full`. A key with the scope `full` can export all data of the workspace. Put the key in an environment variable: ```bash export AFFFAST_API_KEY="sk_test_..." ``` Send the key in the `Authorization` header of each request. Never put it in the URL. The API refuses a key in the query string (see [`api_key_in_query`](https://docs.afffast.com/errors/api-key-in-query.md)). ## 2. Check the key ```bash curl https://api.afffast.com/v1/networks/sandbox \ -H "Authorization: Bearer $AFFFAST_API_KEY" ``` The response is the object of the Sandbox Network. It shows `availability`: the network works in test mode only. If you get a 401 error, the key is not correct. See [`api_key_invalid`](https://docs.afffast.com/errors/api-key-invalid.md). ## 3. Connect the Sandbox Network The field `seed` is any text. The same seed always gives the same data. ```bash curl -X POST https://api.afffast.com/v1/connections \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "network": "sandbox", "label": "My sandbox", "credentials": { "seed": "my-test-seed" } }' ``` The response has the `id` of the connection (`conn_...`). The API starts the first sync and the load of the history at once. Read the progress: ```bash curl https://api.afffast.com/v1/connections/conn_.../setup \ -H "Authorization: Bearer $AFFFAST_API_KEY" ``` The Sandbox Network has two sites and about 30 conversions each day for the first site. The first conversions are there in about a minute. ## 4. Read the conversions ```bash curl "https://api.afffast.com/v1/conversions?limit=3" \ -H "Authorization: Bearer $AFFFAST_API_KEY" ``` The response is a list. This is a short example: ```json { "object": "list", "url": "/v1/conversions", "has_more": true, "data": [ { "id": "conv_...", "object": "conversion", "livemode": false, "status": "pending", "sold_at": "2026-11-21T14:03:10Z", "amounts": { "source": { "currency": "DKK", "order_amount": "499.0000", "commission": "49.9000" }, "workspace": { "currency": "EUR", "order_amount": "66.9000", "commission": "6.6900" } } } ] } ``` `livemode` is `false`: this is test data. Use `starting_after` to get the next page. See [Pagination](https://docs.afffast.com/docs/pagination.md). ## 5. Read the totals `GET /v1/stats` needs a date range. Use `group_by` to get rows. ```bash curl -g "https://api.afffast.com/v1/stats?date[gte]=2026-11-01&date[lte]=2026-11-30&group_by=network" \ -H "Authorization: Bearer $AFFFAST_API_KEY" ``` ## Next steps - [Receive webhooks](https://docs.afffast.com/docs/webhooks.md). Get an event for each new conversion. - [Track clicks](https://docs.afffast.com/docs/links.md). Make a link and see which page earned a commission. - [Test mode](https://docs.afffast.com/docs/test-mode.md). Make test conversions and change their status. - [Connect a real network](https://docs.afffast.com/docs/connect.md). - The [API reference](/reference) has code samples in curl, Node.js, Python and PHP for each operation. --- # Rate limits How many requests a key can send, and how to read the limit headers. The API limits the requests of each API key. The default limit is **100 requests in 60 seconds**. A request that is over the limit gets `429` and the error code [`rate_limit_exceeded`](https://docs.afffast.com/errors/rate-limit-exceeded.md). The MCP server uses the same limit. A tool call counts as one request. ## The headers Each response has these headers: | Header | Meaning | | --------------------- | --------------------------------------------------------- | | `RateLimit-Limit` | The number of requests that the key can send in a window. | | `RateLimit-Remaining` | The number of requests that the key can still send. | | `RateLimit-Reset` | The number of seconds until the window resets. | A `429` response also has `Retry-After`. It is the number of seconds to wait. ## What to do when you get a 429 1. Stop sending requests. 2. Wait for `Retry-After` seconds. 3. Send the request again. ```js async function request(url, options, attempt = 0) { const response = await fetch(url, options); if (response.status !== 429 || attempt >= 5) return response; const seconds = Number(response.headers.get("retry-after") ?? 1); await new Promise((resolve) => setTimeout(resolve, seconds * 1000)); return request(url, options, attempt + 1); } ``` ## Use fewer requests - **Use conditional requests.** Each `GET` response has a weak `ETag`. Send it back in `If-None-Match`. When the data did not change, the API answers `304` with no body. A `304` does not count against the limit. This helps a lot when you poll. - **Use webhooks** instead of polling. See [Webhooks](https://docs.afffast.com/docs/webhooks.md). - **Use batch operations.** `POST /v1/links/batch` and `POST /v1/deeplinks` take up to 100 items in one request. - **Use big pages.** Set `limit=100` on a list. See [Pagination](https://docs.afffast.com/docs/pagination.md). ## Other limits - The postback endpoint has its own limit for each IP address and each token. See [Postbacks](https://docs.afffast.com/docs/postbacks.md). - The plan limits of your workspace (connections, conversions and clicks) are separate. See [Plans and billing](https://docs.afffast.com/docs/plans.md). They never stop redirects or click logging. --- # Test mode Build and test your integration with test keys, the Sandbox Network and test conversions. Each workspace has live data and test data. The two are fully separate. A test key (`sk_test_...`) reads and writes test data only. A live key (`sk_live_...`) reads and writes live data only. Each object has the field `livemode`. It is `false` for test data. ## What is different in test mode - **The Sandbox Network.** This network makes fake programs, conversions, clicks, payouts and deals. It needs no credentials. It works with a test key only. A live key gets [`network_unavailable`](https://docs.afffast.com/errors/network-unavailable.md). See [Connect Sandbox Network](https://docs.afffast.com/docs/connect/sandbox.md). - **Test helpers.** `POST /v1/test/conversions` and `POST /v1/test/conversions/{id}/status` work with a test key only. A live key gets [`test_mode_only`](https://docs.afffast.com/errors/test-mode-only.md). - **Webhooks.** A test endpoint can use `http`. A live endpoint must use `https`. - **Limits and billing.** Test mode has no plan limits. The API never counts or bills test data. - **Redirects.** Links work in test mode. The clicks are test data. - **Real networks.** You can also connect a real network with a test key. The data stays in test mode. A live ID does not work with a test key, and a test ID does not work with a live key. The API answers [`resource_not_found`](https://docs.afffast.com/errors/resource-not-found.md). ## Make a test conversion You need a test connection. Use the Sandbox Network (see the [quickstart](https://docs.afffast.com/docs/quickstart.md)). You need the scope `conversions:write`. ```bash curl -X POST https://api.afffast.com/v1/test/conversions \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "connection": "conn_...", "amount": "100.00", "click_id": "..." }' ``` - `amount` and `commission` are decimal text. The default amount is `100.00`. The default commission is 10 % of the amount. - `click_id` is the click ID of a click on a test link. The API puts it in the SubID slot of the network, like the redirector does. The conversion then gets `click_id`, `user_subids` and `click_context`. A click ID that no click has gives a conversion with no click context. ## Change the status ```bash curl -X POST https://api.afffast.com/v1/test/conversions/conv_.../status \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "status": "rejected" }' ``` The status is `pending`, `approved`, `rejected`, `paid` or `unknown`. The change goes through the same write as a sync. A new status writes the event `conversion.status_changed`, and your [webhook endpoints](https://docs.afffast.com/docs/webhooks.md) get it. Use this to test how your code handles a late rejection. ## Test the Sandbox scenarios Set the field `scenario` of the Sandbox connection to test errors and large volumes: - `default`: normal data. - `high_volume`: 12 times more conversions and clicks. - `failing_auth`: the credentials check fails. - `rate_limited`: the first fetch in each window of 60 seconds fails with a rate limit error. ## Go live 1. Make a live key in the dashboard. 2. Connect your real networks with the live key. 3. Make new webhook endpoints, destinations and links with the live key. Test objects do not move to live mode. 4. Replace the test key in your code with the live key. --- # API versioning How the dated Api-Version header works, and how we change the API. The API has two parts in its version. The URL has a major version: `/v1`. A dated version selects the details: `Api-Version: 2026-11-16`. The [changelog](https://docs.afffast.com/docs/changelog.md) lists each dated version. ## How a request gets its version - The `Api-Version` request header is optional. Its value is a date in the format `YYYY-MM-DD`. - The **first request** of a workspace pins a version. It is the version of the header, or the newest version when there is no header. - A later request without the header uses the version that the workspace pinned. - A header on a later request changes that one request. It does not change the pinned version. - Each response has an `Api-Version` header with the version that the request used. - An unknown or malformed value returns `400` [`api_version_unsupported`](https://docs.afffast.com/errors/api-version-unsupported.md). The message lists the known versions. - The events of a webhook have the field `api_version`: the version of the workspace when the event was made. ```bash curl https://api.afffast.com/v1/workspace \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Api-Version: 2026-11-16" ``` ## What can change inside a version Inside one dated version, we make **additive** changes only. You must write your code so that it accepts them: - A new operation, a new optional parameter or a new field in a response. - A new value in an enum, for example a new event type or a new network. - A new error code for a new feature. A change that breaks a client gets a **new dated version**. Examples: remove or rename a field, change the type of a field, make an optional parameter required. We keep an old dated version for at least 24 months. The changelog says when we plan to remove a version. Do not depend on the order of the fields, the text of a `message` or the length of an ID. ## The present versions The newest version is `2026-11-16`. Each version has an entry in the [changelog](https://docs.afffast.com/docs/changelog.md). --- # Webhooks Get the events of your workspace as signed HTTPS requests, and verify the signature. A webhook endpoint is an HTTPS URL on your server. The API sends a request to it for each event that you choose, for example `conversion.created`. The requests follow the [Standard Webhooks](https://www.standardwebhooks.com) specification. You can use a Standard Webhooks library, or the code on this page. ## Make an endpoint You need an API key with the scope `webhooks:write`. ```bash curl -X POST https://api.afffast.com/v1/webhook_endpoints \ -H "Authorization: Bearer $AFFFAST_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://hooks.example.com/ans", "events": ["conversion.created", "conversion.status_changed"] }' ``` The response has the signing secret in `secret`. It starts with `whsec_`. The API shows the secret **one time**. Save it now. A live endpoint must use `https`. A test endpoint can use `http`. The URL must not point to a private or internal address. Each workspace can have 20 endpoints in each mode. ## Event types Use `*` to get all event types. | Event type | When | | --------------------------- | --------------------------------------------------------------------------------------- | | `conversion.created` | The API saves a new conversion. | | `conversion.updated` | A conversion changes (for example its amount), or the click context is joined to it. | | `conversion.status_changed` | The status of a conversion changes. | | `click.attributed` | The API stores the `click_id` of a conversion. `click_context` is `null` in this event. | | `program.status_changed` | Your status in a program changes. | | `commission.changed` | The commission of a program changes. | | `payout.created` | A payout is new. | | `payout.updated` | A payout changes. | | `connection.synced` | A sync of a connection ends. | | `connection.failed` | A connection fails and needs your action. | | `destination.failed` | A destination stops after repeated failures. | The body of a request is the event object. It is the same object as `GET /v1/events` returns. `data.object` is the object at the time of the change. Use `id` of the event to remove duplicates. The API keeps events for 30 days. ## The click context A conversion has `click_id` when the network sends our click ID back. The API joins the click context (the page, the site, the link code, the country and the device) later. The join runs after the sync, so the context is not in `conversion.created` or in `click.attributed`. In both events `click_context` is `null`. When the join stores the context, the API sends one `conversion.updated` event. In this event, `data.object.click_context` has the context and `data.previous_attributes.click_context` is `null`. This usually happens within minutes. A click can reach the API after its conversion, so the join can take up to 48 hours. If the click is unknown, the conversion never gets a context and you get no such event. If you need the context and you did not get the event, call `GET /v1/conversions/{id}`. It always shows the current `click_context`. ## The headers Each request has these headers: | Header | Value | | ------------------- | ------------------------------------------------------------------------------------------------------------------- | | `webhook-id` | The event ID. It is the same for each retry. | | `webhook-timestamp` | The time of this attempt, in seconds since 1970. | | `webhook-signature` | `v1,`. The signature is the base64 text of the HMAC-SHA256 of `..`. | The key of the HMAC is the secret without the prefix `whsec_`, decoded from base64. Use the raw body of the request. Do not parse the body and write it again. After you rotate the secret, the header has two signatures, separated by a space. Accept the request when one of them is correct. ## Verify the signature Do these steps in your receiver: 1. Read the raw body. 2. Check that `webhook-timestamp` is not older than 5 minutes. This stops a replay of an old request. 3. Calculate the signature with your secret. 4. Compare it with each signature of the header. Use a constant-time comparison. 5. If no signature is correct, answer `400`. ### Node.js ```js export function verify(secret, headers, rawBody) { const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const header = headers["webhook-signature"]; if (!id || !timestamp || !header) return false; if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64"); const expected = createHmac("sha256", key).update(`${id}.${timestamp}.${rawBody}`).digest(); return header.split(" ").some((part) => { const [version, signature] = part.split(","); if (version !== "v1" || !signature) return false; const received = Buffer.from(signature, "base64"); return received.length === expected.length && timingSafeEqual(received, expected); }); } ``` ### Python ```python def verify(secret: str, headers: dict, raw_body: bytes) -> bool: msg_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") header = headers.get("webhook-signature") if not (msg_id and timestamp and header): return False if abs(time.time() - int(timestamp)) > 300: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{msg_id}.{timestamp}.".encode() + raw_body expected = hmac.new(key, signed, hashlib.sha256).digest() for part in header.split(" "): version, _, signature = part.partition(",") if version == "v1" and hmac.compare_digest(base64.b64decode(signature), expected): return True return False ``` ### PHP ```php function verify(string $secret, array $headers, string $rawBody): bool { $id = $headers['webhook-id'] ?? ''; $timestamp = $headers['webhook-timestamp'] ?? ''; $header = $headers['webhook-signature'] ?? ''; if ($id === '' || $timestamp === '' || $header === '') { return false; } if (abs(time() - (int) $timestamp) > 300) { return false; } $key = base64_decode(preg_replace('/^whsec_/', '', $secret)); $expected = hash_hmac('sha256', "$id.$timestamp.$rawBody", $key, true); foreach (explode(' ', $header) as $part) { [$version, $signature] = array_pad(explode(',', $part, 2), 2, ''); if ($version === 'v1' && hash_equals($expected, base64_decode($signature))) { return true; } } return false; } ``` ### Go ```go "crypto/hmac" "crypto/sha256" "encoding/base64" "math" "net/http" "strconv" "strings" "time" ) func Verify(secret string, h http.Header, rawBody []byte) bool { id := h.Get("webhook-id") timestamp := h.Get("webhook-timestamp") header := h.Get("webhook-signature") seconds, err := strconv.ParseInt(timestamp, 10, 64) if id == "" || header == "" || err != nil { return false } if math.Abs(float64(time.Now().Unix()-seconds)) > 300 { return false } key, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(secret, "whsec_")) if err != nil { return false } mac := hmac.New(sha256.New, key) mac.Write([]byte(id + "." + timestamp + ".")) mac.Write(rawBody) expected := mac.Sum(nil) for _, part := range strings.Split(header, " ") { version, signature, _ := strings.Cut(part, ",") received, err := base64.StdEncoding.DecodeString(signature) if version == "v1" && err == nil && hmac.Equal(received, expected) { return true } } return false } ``` ## Answer the request Answer with a `2xx` status code in 10 seconds. Do the slow work after you answer. The API does not follow redirects. A `3xx` answer is a failed attempt. The API reads 1024 bytes of your response at most. ## Retries A failed attempt is a status code other than `2xx`, a timeout or a refused connection. The API tries again after 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, and then 14 hours (four times). The API makes 11 attempts in about 73 hours. The API disables an endpoint when the series of failures since the last success has at least 10 failed attempts and starts at least 72 hours ago. The status of the endpoint is then `disabled` and `disabled_reason` is `failures`. The owners and admins get an email. Enable the endpoint again with `PATCH /v1/webhook_endpoints/{id}` and `"status": "enabled"`. ## Test and replay - `POST /v1/webhook_endpoints/{id}/test` sends a test event (`webhook_endpoint.test`) now. The response shows the answer of your server. A test send does not retry. - `GET /v1/webhook_endpoints/{id}/deliveries` lists the deliveries with each attempt. The API keeps them for 30 days. - `POST /v1/webhook_endpoints/{id}/deliveries/{delivery_id}/retry` sends the same event again. The new request has a new timestamp and a new signature. - In test mode, `POST /v1/test/conversions` makes a conversion, and `POST /v1/test/conversions/{id}/status` changes its status. Use them to get real events. See [Test mode](https://docs.afffast.com/docs/test-mode.md). ## Rotate the secret `POST /v1/webhook_endpoints/{id}/rotate` makes a new secret. The new secret signs all new requests. The old secret also signs for 24 hours. Update your receiver in this time. Your receiver then accepts the requests with the old and with the new secret. --- # api_key_in_query The request has an API key in the query string. Send the key in the Authorization header. HTTP status: **400**. Error type: `authentication_error`. The request has an API key in the query string. Send the key in the Authorization header. ## Example ```json { "error": { "type": "authentication_error", "code": "api_key_in_query", "message": "The request has an API key in the query string. Send the key in the Authorization header.", "param": "api_key", "doc_url": "https://docs.afffast.com/errors/api-key-in-query", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The URL has a query parameter with an API key, for example `?api_key=sk_live_...`. The API refuses it, because URLs are kept in logs. ## How to fix - Remove the key from the URL. Send it in the header: `Authorization: Bearer sk_...`. - If the key was in a real URL, treat the key as leaked. Make a new key in the dashboard and revoke the old key. --- # api_key_invalid The API key is not valid. HTTP status: **401**. Error type: `authentication_error`. The API key is not valid. ## Example ```json { "error": { "type": "authentication_error", "code": "api_key_invalid", "message": "The API key is not valid.", "doc_url": "https://docs.afffast.com/errors/api-key-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The key has a wrong format, or the API does not know it. - The key is revoked or it expired. ## How to fix - Copy the key again from the dashboard. A key is shown one time, when you make it. - Make a new key in the dashboard if you lost it. Only the dashboard manages API keys. --- # api_version_unsupported The API version is not known. HTTP status: **400**. Error type: `invalid_request_error`. The API version is not known. ## Example ```json { "error": { "type": "invalid_request_error", "code": "api_version_unsupported", "message": "The API version is not known.", "param": "Api-Version", "doc_url": "https://docs.afffast.com/errors/api-version-unsupported", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The `Api-Version` header is not a date in the format `YYYY-MM-DD`. - The date is not a version that the API knows. ## How to fix - Send a known version. The message of the error lists the known versions. See [API versioning](https://docs.afffast.com/docs/versioning.md). - Remove the header to use the version that your workspace pinned. --- # authentication_required The request has no valid credentials. HTTP status: **401**. Error type: `authentication_error`. The request has no valid credentials. ## Example ```json { "error": { "type": "authentication_error", "code": "authentication_required", "message": "The request has no valid credentials.", "doc_url": "https://docs.afffast.com/errors/authentication-required", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The request has no `Authorization` header. - The header is not in the form `Bearer `. - The header has a token that is not an API key (`sk_...`). ## How to fix - Send the header `Authorization: Bearer sk_test_...` with each request. --- # connection_credentials_invalid The credentials do not match the network. HTTP status: **422**. Error type: `invalid_request_error`. The credentials do not match the network. ## Example ```json { "error": { "type": "invalid_request_error", "code": "connection_credentials_invalid", "message": "The credentials do not match the network.", "param": "credentials.apiToken", "doc_url": "https://docs.afffast.com/errors/connection-credentials-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - A credential field is missing, or it has a value that the network does not accept in this form. - The credentials have a field that the network does not have. - The check with the network failed (`POST /v1/connections/test`). ## How to fix - Read `error.param`. It names the field, for example `credentials.apiToken`. - Get the fields of the network with `GET /v1/networks/{id}` (`credential_fields`). Read the guide [Connect a network](https://docs.afffast.com/docs/connect.md) for where to find each value. - Send `POST /v1/connections/test` to check the values before you save them. --- # connection_disabled The connection is disabled. Only an operator can enable it. HTTP status: **409**. Error type: `invalid_request_error`. The connection is disabled. Only an operator can enable it. ## Example ```json { "error": { "type": "invalid_request_error", "code": "connection_disabled", "message": "The connection is disabled. Only an operator can enable it.", "param": "status", "doc_url": "https://docs.afffast.com/errors/connection-disabled", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The connection has the status `disabled`. An operator disabled it. You cannot enable it with the API. - A file import was sent to a disabled connection. ## How to fix - Contact support to enable the connection. Or delete it and make a new connection. --- # connection_not_importable The connection does not take file imports. HTTP status: **409**. Error type: `invalid_request_error`. The connection does not take file imports. ## Example ```json { "error": { "type": "invalid_request_error", "code": "connection_not_importable", "message": "The connection does not take file imports.", "doc_url": "https://docs.afffast.com/errors/connection-not-importable", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The connection is for a network other than `file-import`. Only that network takes file uploads. ## How to fix - Make a connection of the network `file-import`. See [Connect File import](https://docs.afffast.com/docs/connect/file-import.md). - Send the file to `POST /v1/connections/{id}/imports` of that connection. --- # connection_not_syncable The connection cannot run this sync now. HTTP status: **409**. Error type: `invalid_request_error`. The connection cannot run this sync now. ## Example ```json { "error": { "type": "invalid_request_error", "code": "connection_not_syncable", "message": "The connection cannot run this sync now.", "doc_url": "https://docs.afffast.com/errors/connection-not-syncable", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The connection status is not `active`, for example `needs_attention`. - The network does not support the kind of sync that you asked for. For example, a network with no payouts cannot run the kind `payouts`. ## How to fix - Read the message of the error. It tells which reason applies. - Read the network with `GET /v1/networks/{id}` (`capabilities`) to see the kinds that it supports. - Fix the credentials of a connection that needs attention (`PATCH /v1/connections/{id}`), and then start the sync again. --- # expand_invalid The expand parameter is not valid. HTTP status: **422**. Error type: `invalid_request_error`. The expand parameter is not valid. ## Example ```json { "error": { "type": "invalid_request_error", "code": "expand_invalid", "message": "The expand parameter is not valid.", "param": "expand[]", "doc_url": "https://docs.afffast.com/errors/expand-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - A value of `expand[]` names a field that the object does not have, or a field that you cannot expand. - The path of the value is too deep. ## How to fix - Read the message. It lists the fields that you can expand on that object. - Use a shorter path. - An event has no field that you can expand. --- # idempotency_key_invalid The Idempotency-Key header is not valid. Use 1 to 256 printable characters. HTTP status: **400**. Error type: `idempotency_error`. The Idempotency-Key header is not valid. Use 1 to 256 printable characters. ## Example ```json { "error": { "type": "idempotency_error", "code": "idempotency_key_invalid", "message": "The Idempotency-Key header is not valid. Use 1 to 256 printable characters.", "param": "Idempotency-Key", "doc_url": "https://docs.afffast.com/errors/idempotency-key-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The `Idempotency-Key` header is empty, longer than 256 characters, or it has characters that cannot be printed. ## How to fix - Send a key of 1 to 256 printable characters. A UUID is a good key. See [Idempotency](https://docs.afffast.com/docs/idempotency.md). --- # idempotency_key_reused This Idempotency-Key was used with a different request. HTTP status: **409**. Error type: `idempotency_error`. This Idempotency-Key was used with a different request. ## Example ```json { "error": { "type": "idempotency_error", "code": "idempotency_key_reused", "message": "This Idempotency-Key was used with a different request.", "doc_url": "https://docs.afffast.com/errors/idempotency-key-reused", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - You sent a key that you used before with a different method, path or body. ## How to fix - Use a new key for a new request. - To repeat the same request, send the same method, the same path and the same body. See [Idempotency](https://docs.afffast.com/docs/idempotency.md). --- # idempotent_request_in_progress A request with this Idempotency-Key is still in progress. HTTP status: **409**. Error type: `idempotency_error`. A request with this Idempotency-Key is still in progress. ## Example ```json { "error": { "type": "idempotency_error", "code": "idempotent_request_in_progress", "message": "A request with this Idempotency-Key is still in progress.", "doc_url": "https://docs.afffast.com/errors/idempotent-request-in-progress", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - A request with the same key is still running. ## How to fix - Wait a short time and send the same request again with the same key. You get the stored response when the first request is done. --- # import_file_too_large The file is too large. HTTP status: **422**. Error type: `invalid_request_error`. The file is too large. ## Example ```json { "error": { "type": "invalid_request_error", "code": "import_file_too_large", "message": "The file is too large.", "param": "file", "doc_url": "https://docs.afffast.com/errors/import-file-too-large", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The file is larger than 20 MB. ## How to fix - Split the file into parts of less than 20 MB. Upload each part as a separate import. --- # import_invalid The file has errors. The API imported no row. Fix the rows in `details`. HTTP status: **422**. Error type: `invalid_request_error`. The file has errors. The API imported no row. Fix the rows in `details`. ## Example ```json { "error": { "type": "invalid_request_error", "code": "import_invalid", "message": "The file has errors. The API imported no row. Fix the rows in `details`.", "param": "file", "doc_url": "https://docs.afffast.com/errors/import-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A", "details": [ { "row": 3, "column": "amount", "message": "The amount is not a number." } ] } } ``` ## Causes - A row of the file has an error. The API is all-or-nothing: it imports no row. - The file has a column that the mapping cannot read. ## How to fix - Read `error.details`. Each item has the row number, the column and what is wrong. The list has 100 items at most. - Fix the rows in the file, and upload the file again. The API keeps no file from a failed import. - Read the mappings with `GET /v1/import_mappings`. --- # Error codes Each error of the API has a code. Find the code here to see its cause and its fix. Each error response has the same form. The field `error.code` is stable. Use it in your code. The field `error.doc_url` links to the page of the code. The field `error.request_id` identifies the request. Send it to support. See [Errors](https://docs.afffast.com/docs/errors.md) for the form of the envelope. | Code | Status | Type | Meaning | | -------------------------------------------------------------------------- | ------ | ----------------------- | ----------------------------------------------------------------------------------------- | | [`api_version_unsupported`](https://docs.afffast.com/errors/api-version-unsupported.md) | 400 | `invalid_request_error` | The API version is not known. | | [`connection_credentials_invalid`](https://docs.afffast.com/errors/connection-credentials-invalid.md) | 422 | `invalid_request_error` | The credentials do not match the network. | | [`connection_disabled`](https://docs.afffast.com/errors/connection-disabled.md) | 409 | `invalid_request_error` | The connection is disabled. Only an operator can enable it. | | [`connection_not_importable`](https://docs.afffast.com/errors/connection-not-importable.md) | 409 | `invalid_request_error` | The connection does not take file imports. | | [`connection_not_syncable`](https://docs.afffast.com/errors/connection-not-syncable.md) | 409 | `invalid_request_error` | The connection cannot run this sync now. | | [`expand_invalid`](https://docs.afffast.com/errors/expand-invalid.md) | 422 | `invalid_request_error` | The expand parameter is not valid. | | [`import_file_too_large`](https://docs.afffast.com/errors/import-file-too-large.md) | 422 | `invalid_request_error` | The file is too large. | | [`import_invalid`](https://docs.afffast.com/errors/import-invalid.md) | 422 | `invalid_request_error` | The file has errors. The API imported no row. Fix the rows in `details`. | | [`link_destination_not_allowed`](https://docs.afffast.com/errors/link-destination-not-allowed.md) | 422 | `invalid_request_error` | The destination is not on a domain that the program allows. | | [`network_unavailable`](https://docs.afffast.com/errors/network-unavailable.md) | 422 | `invalid_request_error` | The network is not available in this mode. | | [`parameter_invalid`](https://docs.afffast.com/errors/parameter-invalid.md) | 422 | `invalid_request_error` | A parameter is not valid. | | [`program_deeplinks_unsupported`](https://docs.afffast.com/errors/program-deeplinks-unsupported.md) | 422 | `invalid_request_error` | The program has no deeplink template, so it cannot make links. | | [`request_body_invalid`](https://docs.afffast.com/errors/request-body-invalid.md) | 400 | `invalid_request_error` | The request body is not valid JSON. | | [`request_invalid`](https://docs.afffast.com/errors/request-invalid.md) | 400 | `invalid_request_error` | The request is not valid. | | [`resource_already_exists`](https://docs.afffast.com/errors/resource-already-exists.md) | 409 | `invalid_request_error` | A resource with this name already exists. | | [`resource_not_found`](https://docs.afffast.com/errors/resource-not-found.md) | 404 | `invalid_request_error` | The resource does not exist. | | [`route_not_found`](https://docs.afffast.com/errors/route-not-found.md) | 404 | `invalid_request_error` | The URL does not exist. | | [`api_key_in_query`](https://docs.afffast.com/errors/api-key-in-query.md) | 400 | `authentication_error` | The request has an API key in the query string. Send the key in the Authorization header. | | [`api_key_invalid`](https://docs.afffast.com/errors/api-key-invalid.md) | 401 | `authentication_error` | The API key is not valid. | | [`authentication_required`](https://docs.afffast.com/errors/authentication-required.md) | 401 | `authentication_error` | The request has no valid credentials. | | [`permission_denied`](https://docs.afffast.com/errors/permission-denied.md) | 403 | `permission_error` | The API key cannot use this resource. | | [`scope_insufficient`](https://docs.afffast.com/errors/scope-insufficient.md) | 403 | `permission_error` | The API key does not have the scope for this request. | | [`test_mode_only`](https://docs.afffast.com/errors/test-mode-only.md) | 403 | `permission_error` | This resource works only in test mode. Use a test key (sk*test*...). | | [`rate_limit_exceeded`](https://docs.afffast.com/errors/rate-limit-exceeded.md) | 429 | `rate_limit_error` | Too many requests. Wait and try again. | | [`idempotency_key_invalid`](https://docs.afffast.com/errors/idempotency-key-invalid.md) | 400 | `idempotency_error` | The Idempotency-Key header is not valid. Use 1 to 256 printable characters. | | [`idempotency_key_reused`](https://docs.afffast.com/errors/idempotency-key-reused.md) | 409 | `idempotency_error` | This Idempotency-Key was used with a different request. | | [`idempotent_request_in_progress`](https://docs.afffast.com/errors/idempotent-request-in-progress.md) | 409 | `idempotency_error` | A request with this Idempotency-Key is still in progress. | | [`internal_error`](https://docs.afffast.com/errors/internal-error.md) | 500 | `api_error` | An error occurred on our side. Try again later. | | [`plan_limit_reached`](https://docs.afffast.com/errors/plan-limit-reached.md) | 403 | `permission_error` | The plan of the workspace has reached its limit. Upgrade the plan to go on. | --- # internal_error An error occurred on our side. Try again later. HTTP status: **500**. Error type: `api_error`. An error occurred on our side. Try again later. ## Example ```json { "error": { "type": "api_error", "code": "internal_error", "message": "An error occurred on our side. Try again later.", "doc_url": "https://docs.afffast.com/errors/internal-error", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - An error occurred on our side. ## How to fix - Try again later. The API stores the response of a request with an `Idempotency-Key`, also an error. To try again, send a new key. - If the error stays, contact support. Send the `request_id` of the response. --- # link_destination_not_allowed The destination is not on a domain that the program allows. HTTP status: **422**. Error type: `invalid_request_error`. The destination is not on a domain that the program allows. ## Example ```json { "error": { "type": "invalid_request_error", "code": "link_destination_not_allowed", "message": "The destination is not on a domain that the program allows.", "param": "destination", "doc_url": "https://docs.afffast.com/errors/link-destination-not-allowed", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The host of the destination is not on a domain that the program allows. - The program has no allowed domain. ## How to fix - Use a page on the domain of the advertiser. The message lists the allowed domains. - Read the program with `GET /v1/programs/{id}` to see its domains. --- # network_unavailable The network is not available in this mode. HTTP status: **422**. Error type: `invalid_request_error`. The network is not available in this mode. ## Example ```json { "error": { "type": "invalid_request_error", "code": "network_unavailable", "message": "The network is not available in this mode.", "param": "network", "doc_url": "https://docs.afffast.com/errors/network-unavailable", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The network cannot be used in the mode of your API key. For example, the Sandbox Network works with a test key (`sk_test_...`) only. ## How to fix - Use a test key for the Sandbox Network. See [Test mode](https://docs.afffast.com/docs/test-mode.md). - Read `availability` of the network with `GET /v1/networks/{id}`. --- # parameter_invalid A parameter is not valid. HTTP status: **422**. Error type: `invalid_request_error`. A parameter is not valid. ## Example ```json { "error": { "type": "invalid_request_error", "code": "parameter_invalid", "message": "A parameter is not valid.", "param": "limit", "doc_url": "https://docs.afffast.com/errors/parameter-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - A query parameter, a path parameter or a field of the body has a wrong value, a wrong type or a wrong format. - A required parameter is missing. - The `limit` is outside the range 1 to 100, or the request has both `starting_after` and `ending_before`. - A network ID does not exist. Use an ID from `GET /v1/networks`. ## How to fix - Read `error.param`. It names the parameter or the field (for example `subids.s1`). - Read the message. It tells what is wrong. - Check the parameter in the [API reference](/reference). --- # permission_denied The API key cannot use this resource. HTTP status: **403**. Error type: `permission_error`. The API key cannot use this resource. ## Example ```json { "error": { "type": "permission_error", "code": "permission_denied", "message": "The API key cannot use this resource.", "doc_url": "https://docs.afffast.com/errors/permission-denied", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The key or the role cannot use this resource. Some operations are only for an owner or an admin. - The operation has no permission rule. ## How to fix - Use a key of an owner or an admin, or ask one of them to do it. --- # plan_limit_reached The plan of the workspace has reached its limit. Upgrade the plan to go on. HTTP status: **403**. Error type: `permission_error`. The plan of the workspace has reached its limit. Upgrade the plan to go on. ## Example ```json { "error": { "type": "permission_error", "code": "plan_limit_reached", "message": "The plan of the workspace has reached its limit. Upgrade the plan to go on.", "doc_url": "https://docs.afffast.com/errors/plan-limit-reached", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The workspace has the Free plan or a paid plan at its hard limit. - `POST /v1/connections` returns this code when the workspace has the maximum number of connections. - `POST /v1/connections/{id}/sync` returns it when the conversions limit is reached. ## How to fix - Read the usage with `GET /v1/usage`. It shows the state of each metric. - Upgrade the plan in the dashboard. See [Plans and billing](https://docs.afffast.com/docs/plans.md). Redirects and click logging never stop. --- # program_deeplinks_unsupported The program has no deeplink template, so it cannot make links. HTTP status: **422**. Error type: `invalid_request_error`. The program has no deeplink template, so it cannot make links. ## Example ```json { "error": { "type": "invalid_request_error", "code": "program_deeplinks_unsupported", "message": "The program has no deeplink template, so it cannot make links.", "param": "program", "doc_url": "https://docs.afffast.com/errors/program-deeplinks-unsupported", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The program has no deeplink template. The API cannot make a link for it. ## How to fix - Read `deeplink_support` of the program with `GET /v1/programs/{id}`. Use a program where it is `true`. - Make the link in the interface of the network. --- # rate_limit_exceeded Too many requests. Wait and try again. HTTP status: **429**. Error type: `rate_limit_error`. Too many requests. Wait and try again. ## Example ```json { "error": { "type": "rate_limit_error", "code": "rate_limit_exceeded", "message": "Too many requests. Wait and try again.", "doc_url": "https://docs.afffast.com/errors/rate-limit-exceeded", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The key sent more requests than its limit in the time window. ## How to fix - Wait for the number of seconds in the header `Retry-After`, and then try again. - Read the headers `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` to stay below the limit. See [Rate limits](https://docs.afffast.com/docs/rate-limits.md). --- # request_body_invalid The request body is not valid JSON. HTTP status: **400**. Error type: `invalid_request_error`. The request body is not valid JSON. ## Example ```json { "error": { "type": "invalid_request_error", "code": "request_body_invalid", "message": "The request body is not valid JSON.", "doc_url": "https://docs.afffast.com/errors/request-body-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The body is not valid JSON. - The body of a file upload is not valid `multipart/form-data`, or the file cannot be read. ## How to fix - Send valid JSON with the header `Content-Type: application/json`. - For an import, send `multipart/form-data` with the file in the field `file`. --- # request_invalid The request is not valid. HTTP status: **400**. Error type: `invalid_request_error`. The request is not valid. ## Example ```json { "error": { "type": "invalid_request_error", "code": "request_invalid", "message": "The request is not valid.", "doc_url": "https://docs.afffast.com/errors/request-invalid", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The request is well formed, but the API cannot do it in the present state. Examples: the body is too large, the workspace has the maximum number of webhook endpoints (20), a connection has the maximum number of postback sources (5), you retry a delivery of a disabled endpoint, or you rotate a revoked API key. ## How to fix - Read the message. It tells what to change. - Delete an object that you do not use, or enable the disabled object, and try again. --- # resource_already_exists A resource with this name already exists. HTTP status: **409**. Error type: `invalid_request_error`. A resource with this name already exists. ## Example ```json { "error": { "type": "invalid_request_error", "code": "resource_already_exists", "message": "A resource with this name already exists.", "param": "name", "doc_url": "https://docs.afffast.com/errors/resource-already-exists", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - An object with this name exists already. Names of sites, tags and some other objects are unique in a workspace. ## How to fix - Use another name, or use the object that exists. Find it with the list operation of the resource. --- # resource_not_found The resource does not exist. HTTP status: **404**. Error type: `invalid_request_error`. The resource does not exist. ## Example ```json { "error": { "type": "invalid_request_error", "code": "resource_not_found", "message": "The resource does not exist.", "param": "id", "doc_url": "https://docs.afffast.com/errors/resource-not-found", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The ID does not belong to an object of your workspace in the mode of your key. - The object was deleted. - You use a live ID with a test key, or the other way round. Test data and live data are separate. ## How to fix - Check the ID. Use the list operation of the resource to find the right ID. - Use a key of the same mode as the object (`sk_live_...` or `sk_test_...`). --- # route_not_found The URL does not exist. HTTP status: **404**. Error type: `invalid_request_error`. The URL does not exist. ## Example ```json { "error": { "type": "invalid_request_error", "code": "route_not_found", "message": "The URL does not exist.", "doc_url": "https://docs.afffast.com/errors/route-not-found", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The URL or the method does not match an operation of the API. ## How to fix - Check the path and the HTTP method in the [API reference](/reference). - Operations have the prefix `/v1`. --- # scope_insufficient The API key does not have the scope for this request. HTTP status: **403**. Error type: `permission_error`. The API key does not have the scope for this request. ## Example ```json { "error": { "type": "permission_error", "code": "scope_insufficient", "message": "The API key does not have the scope for this request.", "doc_url": "https://docs.afffast.com/errors/scope-insufficient", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The key does not have the scope that the operation needs, for example `connections:write`. ## How to fix - Read the message. It names the scope. - Make a new key with that scope in the dashboard. You cannot change the scopes of a key. --- # test_mode_only This resource works only in test mode. Use a test key (sk_test_...). HTTP status: **403**. Error type: `permission_error`. This resource works only in test mode. Use a test key (sk*test*...). ## Example ```json { "error": { "type": "permission_error", "code": "test_mode_only", "message": "This resource works only in test mode. Use a test key (sk_test_...).", "doc_url": "https://docs.afffast.com/errors/test-mode-only", "request_id": "req_3kQ9x7WmZpL2vNd8TfYb4A" } } ``` ## Causes - The operation works only in test mode, and you used a live key. The test helpers (`/v1/test/...`) are an example. ## How to fix - Use a test key (`sk_test_...`). See [Test mode](https://docs.afffast.com/docs/test-mode.md).