> ## Documentation Index
> Fetch the complete documentation index at: https://developers.everflow.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic Examples

> End-to-end multi-step workflows using the Affiliate MCP, from a drop in clicks to unpaid invoices.

These examples show how an AI agent chains the [Affiliate MCP tools](/ai-automation/affiliate-mcp/tools) to answer questions about your own partner account. Each one gives the prompt you would send and the calls the agent makes behind the scenes. Dates are examples; the agent works them out from the current date.

<Note>
  Every call is read-only and returns your own data. Start with `get_account_info` for your currency and timezone, then `get_report_schema`, which lists the dimensions, filters and metrics available to you, and the agent adapts its calls to it.
</Note>

***

## Why did my clicks drop yesterday?

Your click count fell sharply yesterday and you want to know where the loss is: a day, an offer, a sub id, or clicks that were recorded as invalid.

**Prompt:**

> "My clicks dropped yesterday compared to the day before. Can you find out why?"

**What the agent does:**

1. Calls `get_account_info`. It returns the `timezone` the days are cut in. When a report's `metric_glossary` says `clicks` are unique clicks, that is what `clicks` means in every report below.
2. Calls `get_report_schema` to confirm the dimensions (`date`, `offer`, `sub1`) and metrics (`clicks`, `invalid_clicks`, `conversions`, `payout`) available to you.
3. Calls `run_performance_report` with `from=2026-10-12`, `to=2026-10-13` and `dimensions=date`. Two rows come back, one per day, which confirms the drop. The same call over an earlier window, for example `from=2026-10-05`, `to=2026-10-11`, shows what a normal day looks like.
4. Calls `run_performance_report` with `from=2026-10-12`, `to=2026-10-13` and `dimensions=date,offer`, with `sort_by=clicks`. Each row carries `offer_id`, so the agent sees which offer lost the most clicks between the two days.
5. Calls `search_activity` with `type=click`, `status=invalid`, `from=2026-10-13`, `to=2026-10-13` and `offer_id` set to that offer. Each row has `error_code` and `error_message`; only the newest 1,000 clicks of the day are reachable, so the codes are a sample when `truncated` is true. Error code `10000` means Other: the reason is not itemised for this click.

**Result:** The agent reports which day and which offer account for the drop, how many clicks were recorded as invalid (from the `invalid_clicks` metric), and the most common `error_code` values with their messages among the clicks it could read. If most of the invalid clicks carry `10000`, it says the reason is not itemised to you and suggests asking your network about that offer.

<Tip>
  Raw click search covers 14 days at most and lists the newest 1,000 clicks of the window. When `truncated` is true, narrow the window or add `offer_id` or `country` so the sample is complete.
</Tip>

***

## Find an offer I can run and get its tracking link

You are looking for a new offer in a vertical and a country, paid per sale, and want your link right away.

**Prompt:**

> "Find me a sports offer I can run in Canada that pays per sale, and give me my tracking link."

**What the agent does:**

1. Calls `list_entities` with `type=category` and `filters={"search":"sport"}` to learn the exact category name, for example `Sports`.
2. Calls `list_offers` with `category=Sports`, `country=CA`, `payout_type=cps` and `sort_by=updated`. The response has `total_matching` and `offers`, each with `offer_id`, `name`, `application_status`, `payout.display` and, when caps are available to you, `caps`.
3. Calls `get_offer` with `offer_id` set to the best match and `include=tracking_url,caps,payout`. It returns your link under `tracking_url`, the payout for each tracked event under `payout.events`, and the limits and what remains today under `caps`.

**Result:** A short list of offers you can run now, with the payout of each, then one recommended offer with its tracking link and caps.

Two cases the agent handles in step 3:

* **No link available.** `tracking_url` comes back as `{"hidden": true}` with the note "A tracking link is not available for this offer." The agent tells you so rather than building a link.
* **No cap information.** When caps are not available to you, `caps` is left out of `get_offer` and `list_offers` entirely. The agent reports that no cap figures are available instead of saying there is no cap.

<Note>
  `list_offers` only lists offers you can run now. An offer that does not appear, or that `get_offer` answers with not-found, is not available to you; the answer is the same as for an offer that does not exist.
</Note>

***

## Check one conversion

A conversion you expected is missing from your numbers, or you want the details of one you can see.

**Prompt:**

> "Look up conversion 7f3c2a9e1b4d4c6a8e5f0b1d2c3a4b5c from the last two weeks."

**What the agent does:**

1. Calls `search_activity` with `type=conversion`, `conversion_id=7f3c2a9e1b4d4c6a8e5f0b1d2c3a4b5c`, `from=2026-09-30` and `to=2026-10-13`. `conversion_id` combines with no other filter. If you only have the click's id, the agent uses `transaction_id` instead, which returns the conversions of that click.
2. Reads the row: `timestamp`, `click_timestamp`, `offer_id`, `offer_name`, `event_name`, `payout`, `payout_type`, `currency`, `sub1` to `sub10`, and `country`.

**Result:** The conversion's offer, payout, the time of the click and of the conversion, and the sub ids it carried. If the result is empty, the agent says what that rules out: the id is not yours, it does not exist, it is outside the window, or the conversion is not approved.

<Tip>
  Conversion search lists approved conversions, including post-conversion events, so a conversion that is not approved does not appear here. A window with explicit times must be at least 23 hours, so use whole days.
</Tip>

***

## What do I have unpaid?

You want to know what you are owed and which invoices make it up.

**Prompt:**

> "Which of my invoices are unpaid? Show the biggest balance first and tell me what is on it."

**What the agent does:**

1. Calls `list_invoices` with `status=unpaid`, `sort_by=balance` and `sort_direction=desc`. With more than 500 matching invoices the sort is refused, so narrow with `min_start_time` or `min_balance` first. The first page carries a `summary` with `billed`, `paid` and `balance` per currency for every matching invoice, and each invoice row has `invoice_id`, `start_time`, `end_time`, `billed`, `paid` and `balance`.
2. Calls `get_invoice` with the `invoice_id` of the largest balance. It returns `details` (offer, adjustment and VAT lines, each with `amount` and `invoice_currency_amount`), `extra_periods` and `payments`. Lines are paged: while `has_more_lines` is true, the agent passes `next_cursor` back as `cursor`.
3. Calls `list_payments` with `invoice_id` set to that invoice. With an `invoice_id` and no dates, it covers all of that invoice's payments. Each row has `status`, `payment_type`, `amount` and `timestamp`; `amount_received` appears only when `status` is `success`.

**Result:** The total unpaid balance per currency, the invoices behind it in order, and for the largest one its billed amount, what was paid against it and what remains, with the payments listed by status.

<Note>
  Items that are not itemised as lines are summed in `other_items_total`, so the lines plus `other_items_total` make up the invoice. Bank, wallet and account details of payments are never returned.
</Note>

***

## Which sub ids earn the most this month?

You tag traffic with `sub1` and want to know which values earn the most so far this month.

**Prompt:**

> "Which of my sub1 values have earned the most payout so far this month?"

**What the agent does:**

1. Calls `get_report_schema` to confirm that `sub1` is a dimension and `payout` a metric for your account.
2. Calls `run_performance_report` with `from=2026-10-01`, `to=2026-10-14`, `dimensions=sub1`, `sort_by=payout`, `sort_direction=desc` and `page_size=100`. Each row carries `sub1`, `clicks`, `conversions` and `payout`. The `totals` object covers the whole filtered set, not just the page.
3. When `meta.has_more` is true, calls the same report again with the same arguments and `cursor` set to `meta.next_cursor`.
4. Keeps paging until `meta.has_more` is false. A report holds at most 500 rows across all pages, so when `meta.result_capped` is true the last page ends at row 500, and `meta.row_limit` gives the cap. The top-level `note` says the `totals` still cover every matched row.

**Result:** A ranked list of `sub1` values by payout with clicks and conversions beside each, and the share of the total they represent, computed from `totals`. If the cap was reached, the agent says the tail is not listed and offers to narrow the report, for example with `filters=offer:123` or `filters=country:US`.

<Tip>
  Sub id values come from the traffic, so the response marks them in `_untrusted_content`. The agent treats them as labels to report on, never as instructions.
</Tip>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.