---
title: "Connect Refersion to ChatGPT: Manage Affiliates & Track Performance"
slug: connect-refersion-to-chatgpt-manage-affiliates-track-performance
date: 2026-09-16
author: Sidharth Verma
categories: ["AI & Agents"]
excerpt: "Learn how to connect Refersion to ChatGPT using a managed MCP server. Automate affiliate onboarding, approve conversions, and track partner performance."
tldr: "Connect Refersion to ChatGPT by generating a secure MCP server. This guide covers the specific architectural quirks of the Refersion API, how to expose curated tools to AI agents, and how to execute automated affiliate marketing workflows."
canonical: https://truto.one/blog/connect-refersion-to-chatgpt-manage-affiliates-track-performance/
---

# Connect Refersion to ChatGPT: Manage Affiliates & Track Performance


If you need to connect Refersion to ChatGPT to automate affiliate onboarding, approve conversions, or track marketing performance, you need a [Model Context Protocol (MCP) server](https://truto.one/what-is-mcp-model-context-protocol-the-2026-guide-for-saas-pms/). This server acts as the translation layer between ChatGPT's tool calls and Refersion's underlying REST APIs. You can either build, host, and maintain this translation layer yourself, or use a managed integration platform like Truto to [dynamically generate a secure, authenticated MCP server URL](https://truto.one/auto-generated-mcp-tools-for-ai-agents-a-2026-architecture-guide/) in seconds.

If your team uses Claude, check out our guide on [connecting Refersion to Claude](https://truto.one/connect-refersion-to-claude-optimize-offers-promotion-workflows/) or explore our broader architectural overview on [connecting Refersion to AI Agents](https://truto.one/connect-refersion-to-ai-agents-automate-prospects-manual-credits/).

Giving a Large Language Model (LLM) read and write access to an affiliate marketing platform is a massive engineering challenge. You have to handle complex relational data payloads, map dynamic content to MCP tool definitions, and deal with polymorphic activity streams. Every time a developer adds a new affiliate attribute or updates a commission schema in Refersion, your custom server code must be updated, redeployed, and tested.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Refersion, connect it natively to ChatGPT, and execute complex workflows using natural language.

::cta{buttonText="Talk to us" buttonUrl="/book-a-demo/"}
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds.
:::

## The Engineering Reality of the Refersion API

A custom MCP server is a self-hosted integration layer. While the [open MCP standard](https://truto.one/what-is-mcp-model-context-protocol-the-2026-guide-for-saas-pms/) provides a predictable way for models to discover tools, implementing it against Refersion's specific API surface requires writing significant custom logic.

If you decide to build a custom MCP server for Refersion, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with Refersion:

### Polymorphic Activity Streams
Refersion provides a consolidated activity endpoint (`refersion_affiliates_get_activity`) to track weekly conversions, payments, and clicks for a specific affiliate. However, this endpoint returns a polymorphic timeline. The shape of the objects in the array changes based on the type of activity. Conversion entries include `conversionCount` and `currency`, while payment entries include distinct payout fields. Statically defining a JSON-RPC schema that an LLM can reliably parse across these mixed types requires complex `anyOf` schema definitions. Without this, the LLM will hallucinate field names when interpreting performance data.

### Strict State Transition Matrices
Updating the status of a conversion in Refersion (`refersion_conversions_bulk_update`) is not a simple state override. The API enforces a strict transition matrix. Conversions can move between `PENDING`, `APPROVED`, `DENIED`, and `UNQUALIFIED`, but certain transitions trigger downstream webhook notifications and audit trails. Similarly, you cannot soft-delete an affiliate by setting their status to `DELETED` if they have pending or unpaid conversions. A naive MCP tool that blindly attempts to PATCH a status will fail constantly. Your MCP server must either handle the pre-flight checks or correctly map the 4xx errors back to the LLM so it can reason about the failure.

### Idempotent Custom Field Operations
Merchants often configure custom registration fields for their affiliates. When managing these via the API (`refersion_affiliates_bulk_update` or `delete_custom_field`), clearing a value does not modify the underlying custom field definition - it only clears the affiliate's localized value. These operations are idempotent, meaning repeated calls return success without altering state. If an LLM is trying to audit and clean up custom metadata, it needs precise tool descriptions to understand that it is modifying the affiliate's answers, not the global schema.

## How to Generate the Refersion MCP Server

Truto abstracts away the underlying API complexity by dynamically generating MCP tools based on the integration's documentation and schema records. 

Every MCP server in Truto is scoped to a single authenticated account. The resulting URL contains a secure token that handles both routing and authentication. You can generate this server via the Truto dashboard or programmatically via the API.

### Method 1: Via the Truto UI

For internal tooling and one-off administrative agents, the UI is the fastest path.

1. Log into your Truto dashboard and navigate to **Integrated Accounts**.
2. Select your connected Refersion account.
3. Click the **MCP Servers** tab.
4. Click **Create MCP Server**.
5. Select your desired configuration (e.g., allow only `read` operations, or filter by `affiliates` tags).
6. Copy the generated MCP server URL (it will look like `https://api.truto.one/mcp/a1b2c3d4e5...`).

### Method 2: Via the Truto API

If you are building an AI product and need to [provision MCP servers dynamically for your end-users](https://truto.one/how-to-architect-a-multi-tenant-mcp-server-for-enterprise-b2b-saas/), you can create them via a single POST request.

**Request:**
```bash
curl -X POST https://api.truto.one/integrated-account/<INTEGRATED_ACCOUNT_ID>/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Refersion Performance Agent",
    "config": {
      "methods": ["read", "write"],
      "tags": ["affiliates", "conversions"]
    }
  }'
```

**Response:**
```json
{
  "id": "mcp-12345",
  "name": "Refersion Performance Agent",
  "config": {
    "methods": ["read", "write"],
    "tags": ["affiliates", "conversions"]
  },
  "expires_at": null,
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f67890"
}
```

Treat the `url` property as a secret. It provides direct, authenticated access to the specified Refersion instance.

## Connecting the MCP Server to ChatGPT

Once you have the Truto MCP URL, you can connect it to your LLM environment. 

### Method A: Via the ChatGPT UI (Custom Connectors)

If you are using ChatGPT Pro, Plus, Enterprise, or Education, you can add the MCP server directly to your workspace.

1. In ChatGPT, navigate to **Settings -> Apps -> Advanced settings**.
2. Enable the **Developer mode** toggle.
3. Under **MCP servers / Custom connectors**, click **Add new server**.
4. Name your connection (e.g., "Refersion Integration").
5. Paste the Truto MCP URL into the **Server URL** field.
6. Click **Save**.

ChatGPT will immediately perform a handshake with the Truto MCP router, fetch the available Refersion tools, and display them as ready to use.

### Method B: Via Manual Config (SSE Transport)

If you are building custom agents using frameworks like LangChain, LangGraph, or running a local client, you can connect using the standard Server-Sent Events (SSE) transport. 

Example JSON configuration:

```json
{
  "mcpServers": {
    "refersion-production": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/a1b2c3d4e5f67890"
      ]
    }
  }
}
```

## Refersion Hero Tools for AI Agents

Truto automatically translates Refersion's API endpoints into LLM-friendly schemas. Here are the highest-leverage tools available for your AI agents.

### List All Refersion Affiliates

Retrieves a paginated list of affiliates with profile information, offer details, and performance metrics. Supports filtering by status, search terms, and performance thresholds.

**Contextual usage notes:** This is the primary discovery tool. When the LLM needs to find an affiliate by name, email, or performance threshold, it calls this tool first to grab the internal `id` required for subsequent operations.

> "Find all approved affiliates in Refersion who have generated more than $1000 in revenue this month and list their email addresses and current commission offer."

### Update a Refersion Affiliate By ID

Updates an affiliate's details including status, lock state, offer assignment, custom fields, and profile information. Supports partial updates.

**Contextual usage notes:** The `locked` field cannot be combined with `status` in the same request, and is only accepted when the affiliate's current status is `APPROVED`. The LLM must be instructed to make these state changes in separate tool calls if necessary.

> "Update the Refersion affiliate with ID 40592. Change their assigned offer ID to 12 and lock their account so they cannot make further profile changes."

### Get Affiliate Activity Timeline

Retrieves weekly conversion, payment, and click activity for a specific affiliate. 

**Contextual usage notes:** The timeline is merged and ordered by date descending, capped at 10 entries. The response is polymorphic: conversion entries include `conversionCount` and `total`, while payment entries include payout amounts. The LLM can parse this to build performance summaries.

> "Get the recent activity timeline for the affiliate with ID 84930. Summarize their conversion counts versus their click volume over the last few weeks."

### List All Refersion Conversions

Lists Refersion conversions with filtering by status, order ID, affiliate, date range, and platform. 

**Contextual usage notes:** This tool is crucial for auditing. The LLM can filter for `PENDING` conversions to identify which orders need human or automated review before payouts are approved.

> "List all pending Refersion conversions for this week. Sort them by revenue descending so we can review the highest value orders first."

### Bulk Update Conversions

Updates the status of a single Refersion conversion, supporting transitions between `PENDING`, `APPROVED`, `DENIED`, and `UNQUALIFIED`.

**Contextual usage notes:** This tool enforces a strict transition matrix. Moving a conversion to `APPROVED` or `DENIED` triggers webhook notifications. The LLM should be given rules on when to approve or deny based on your business logic.

> "Approve the Refersion conversion with ID 948201. The order has passed our internal fraud check and is outside the 30-day refund window."

### List All Refersion Offers

Retrieves available commission offers with optional filtering by offer type, name search, and performance criteria.

**Contextual usage notes:** Offers dictate the commission terms. The LLM needs this tool to look up valid `offer_id` values before reassigning affiliates to new tiers.

> "List all active multi-value offers in Refersion. I need to find the specific ID for the 'VIP Partner Tier' offer."

### Generate Affiliate Link

Generates a unique affiliate tracking link for a specific affiliate ID.

**Contextual usage notes:** When onboarding new partners, the LLM can generate test links or associate the tracking URL with specific marketing assets. 

> "Generate a new Refersion tracking link for the affiliate with ID 55920. Point the link to the new summer campaign landing page."

For the complete schema definitions and the full inventory of tools (including webhook management, manual credits, and custom field mapping), check out the [Refersion integration page](https://truto.one/integrations/detail/refersion).

## Workflows in Action

When you provide ChatGPT with these MCP tools, it can orchestrate complex, multi-step affiliate management workflows autonomously. Here are two real-world examples.

### Scenario 1: Affiliate Audit and Conversion Approval

**The Prompt:**
> "Audit the performance of our top affiliate, John Doe. If he has generated more than 10 pending conversions this month, approve all of his pending conversions automatically."

**How the Agent Executes:**
1. Calls `list_all_refersion_affiliates` searching for "John Doe" to retrieve the affiliate `id`.
2. Calls `list_all_refersion_conversions` filtering by the retrieved `affiliate_id` and setting the status to `PENDING`.
3. Evaluates the returned array length. If the count is > 10, the agent loops through the results.
4. Iteratively calls `refersion_conversions_bulk_update` for each conversion ID, setting the status to `APPROVED`.

**What the User Gets Back:**
The agent responds with a summary: "John Doe had 14 pending conversions. I have successfully approved all 14 conversions. The webhook notifications for these approvals have been dispatched by Refersion."

```mermaid
sequenceDiagram
  participant User as User
  participant Agent as "AI Agent (ChatGPT)"
  participant MCP as "Truto MCP Router"
  participant Refersion as "Refersion API"

  User->>Agent: "Audit John Doe and approve pending conversions if > 10"
  Agent->>MCP: Call tool: list_all_refersion_affiliates (search="John Doe")
  MCP->>Refersion: GET /api/affiliates?search=John Doe
  Refersion-->>MCP: Affiliate ID: 8849
  MCP-->>Agent: Result: Affiliate ID 8849
  
  Agent->>MCP: Call tool: list_all_refersion_conversions (affiliate_id=8849, status=PENDING)
  MCP->>Refersion: GET /api/conversions?affiliate_id=8849&status=PENDING
  Refersion-->>MCP: Array of 14 conversions
  MCP-->>Agent: Result: 14 conversions found
  
  loop For each conversion
    Agent->>MCP: Call tool: refersion_conversions_bulk_update (id=XYZ, status=APPROVED)
    MCP->>Refersion: PUT /api/conversions/XYZ
    Refersion-->>MCP: 204 No Content
    MCP-->>Agent: Success
  end
  
  Agent-->>User: "Successfully approved 14 conversions for John Doe."
```

### Scenario 2: Partner Tier Upgrades and Link Generation

**The Prompt:**
> "Find the 'Platinum Tier' offer. Then, upgrade the affiliate 'TechReviews' to this offer, lock their profile, and generate a new tracking link for them."

**How the Agent Executes:**
1. Calls `list_all_refersion_offers` searching for "Platinum Tier" to extract the specific `offer_id`.
2. Calls `list_all_refersion_affiliates` searching for "TechReviews" to get the affiliate `id`.
3. Calls `update_a_refersion_affiliate_by_id` passing the new `offer_id` and setting `locked: true`.
4. Calls `refersion_affiliates_get_link` for that affiliate ID to generate the new URL.

**What the User Gets Back:**
The agent returns the finalized text: "I found the Platinum Tier offer (ID 42). I have updated TechReviews's profile to this tier and locked their account. Here is their new dedicated tracking link: https://yourbrand.refersion.com/c/abcd123."

## Security and Access Control

Exposing your affiliate database to an LLM requires strict boundary control. Truto provides configuration filters at the MCP server level to ensure agents operate safely.

*   **Method Filtering (`config.methods`)**: Restrict the server to specific operation types. Setting `methods: ["read"]` ensures the LLM can only query data (GET/LIST) and structurally prevents any updates, approvals, or deletions.
*   **Tag Filtering (`config.tags`)**: Scope the server to specific domains. By passing `tags: ["conversions"]`, the MCP server will hide all tools related to offers, webhooks, or custom fields, keeping the LLM laser-focused on tracking metrics.
*   **API Token Auth (`config.require_api_token_auth`)**: By default, the Truto MCP URL acts as a bearer token. For enterprise security, enabling this flag forces the client to also pass a valid Truto session token in the authorization header, adding a second layer of identity verification.
*   **Time-to-Live (`expires_at`)**: Ideal for temporary auditing agents. Set an expiration datetime, and the MCP server will automatically self-destruct, tearing down its internal KV routing maps and revoking LLM access instantly.

## Handling Rate Limits

When executing complex loops—like iterating over 50 pending conversions to approve them—AI agents can rapidly exhaust third-party API limits. 

**Truto does not retry, throttle, or apply backoff on rate limit errors.** When the upstream Refersion API rejects a request due to volume, Truto passes the `HTTP 429 Too Many Requests` error directly back to the caller. 

However, Truto normalizes the upstream rate limit information into standardized, IETF-compliant headers:
*   `ratelimit-limit`: The total requests allowed in the current window.
*   `ratelimit-remaining`: The number of requests left before hitting the wall.
*   `ratelimit-reset`: The timestamp when the limit window clears.

The caller (your custom MCP client or the LLM framework) is fully responsible for reading these headers, pausing execution, and implementing retry/backoff logic. 

## Build Faster Agent Workflows

Writing custom code to handle Refersion's polymorphic payloads, strict state transitions, and custom field abstractions is a massive drain on engineering resources. Maintaining that code as the vendor updates their API is worse.

By leveraging Truto's auto-generated MCP servers, you can instantly give ChatGPT, Claude, or your custom agents secure, structured access to Refersion. You define the filters, Truto handles the protocol translation, and your AI agents execute the workflows.

Ready to automate your affiliate operations? 

::cta{buttonText="Talk to us" buttonUrl="/book-a-demo/"}
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds.
:::
