Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agentref.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

AgentRef exposes Model Context Protocol servers for two personas: merchant workflows and affiliate workspace workflows. Use the merchant endpoint for program setup, growth, payouts, applications, and marketing resources. Use the affiliate endpoint for marketplace discovery, links, earnings, payout profile, and affiliate marketing resources. Claude Code, Claude App, Codex, Cursor, and OpenClaw (mcporter) can all use the production MCP endpoint directly. For these clients, the recommended path is OAuth-first: add the server, approve the browser sign-in once, and let the client store refreshable credentials for future sessions.

Endpoint

PersonaEndpoint
Merchanthttps://www.agentref.co/api/mcp/merchant
Affiliatehttps://www.agentref.co/api/mcp/affiliate

Authentication

The MCP release contract uses snake_case inputs and outputs. Mutation tools accept idempotency_key when you need retry-safe execution.
  • Preferred auth: OAuth 2.1 with dynamic client registration
  • Supported OAuth-first clients: Claude Code, Claude App, Codex, Cursor, OpenClaw (mcporter)
  • Fallback auth for custom/manual clients: Authorization: Bearer ak_live_*, ak_onb_*, or ak_aff_*
If your MCP client supports remote OAuth for Streamable HTTP servers, use that path. If it only supports static headers, create the appropriate API key in Settings -> API Keys and attach it manually.

Setup

claude mcp add --scope user --transport http agentref-merchant https://www.agentref.co/api/mcp/merchant
Then open /mcp in Claude Code, select agentref, and authenticate once in the browser.

Custom clients

If your MCP client supports remote OAuth, use the endpoint for the persona you need and complete the browser sign-in flow. If your client only supports manual headers, attach an AgentRef API key:
Authorization: Bearer ak_live_your_api_key_here

Workflow groups

MCP is the broadest automation surface. Some setup, payout, invite, tracking, and Marketing Resources tools call AgentRef services directly and do not have REST or SDK equivalents yet. Use the REST/SDK pages when you need only the public API v1 surface, and use MCP when an agent needs these expanded workflows.

Merchant setup tools

ToolPurpose
get_onboarding_statusRead the current merchant onboarding state, blockers, and next steps.
update_merchant_profileUpdate company, billing, timezone, and tracking defaults.
create_programCreate a new affiliate program.
list_programsList programs or read one exact program by program_id.
update_programUpdate one program’s settings, branding, marketplace state, or lifecycle.
get_stripe_connect_urlGenerate the Stripe Connect authorization URL for one program.
complete_onboardingFinalize merchant onboarding when the setup anchors are ready.
get_tracking_snippetReturn the JavaScript snippet and install instructions for one program.
verify_trackingCheck tracking health and return warnings plus next steps.

Merchant growth tools

ToolPurpose
list_affiliatesList affiliates for one merchant, or read one exact affiliate by affiliate_id.
list_applicationsList marketplace and portal applications, or read one exact application.
review_applicationApprove, decline, or block one pending application.
set_affiliate_statusBlock or unblock an approved affiliate membership.
list_invitesList invite links for one program.
create_inviteCreate a public or targeted invite link.
revoke_inviteRevoke one invite so it cannot be claimed again.
get_program_overviewLoad key KPIs, status counts, and warnings for one program.
list_conversionsList merchant conversions with filters.
list_flagsList fraud and review flags, or load one exact flag.
review_flagResolve one fraud flag as reviewed, dismissed, or confirmed.

Merchant payout tools

ToolPurpose
list_pending_payoutsList payout-ready affiliates who already meet the threshold.
list_payoutsList manual payout records with filters.
list_upcoming_payoutsList affiliates with released unpaid commissions plus next payout date.
create_payoutCreate one manual payout record for an affiliate-program pair.
update_payout_statusAdvance a payout to processing, completed, or failed.
export_payouts_csvExport open manual payouts for PayPal, Wise, SEPA, or generic workflows.

Merchant marketing resources tools

ToolPurpose
list_marketing_resourcesList merchant-owned collections, files, social posts, links, and draft assets.
get_marketing_resourceRead one marketing resource or collection.
create_marketing_collectionCreate a campaign collection.
update_marketing_collectionUpdate collection metadata.
publish_marketing_resourcePublish a resource or collection for affiliates.
unpublish_marketing_resourceMove a resource or collection back to draft.
archive_marketing_resourceArchive a resource or collection.
create_marketing_social_postCreate affiliate-ready social post copy.
update_marketing_social_postUpdate social post copy, platforms, instructions, or grouping.
create_marketing_social_post_media_upload_sessionCreate a signed upload session for social post media.
complete_marketing_social_post_media_uploadAttach uploaded media to a social post.
remove_marketing_social_post_mediaRemove social post media.
update_marketing_social_post_mediaUpdate media alt text.
reorder_marketing_social_post_mediaNormalize social post media order.
replace_marketing_social_post_mediaReplace a media file while preserving its media record.
create_marketing_resource_download_urlCreate a short-lived merchant download URL.
create_marketing_external_linkAdd an external resource link.
create_marketing_upload_sessionCreate a signed upload session for a file or ZIP import.
complete_marketing_upload_sessionComplete an uploaded file or ZIP import.
import_marketing_resource_from_urlImport a remote file or ZIP into private storage.
notify_marketing_resource_affiliatesQueue affiliate notifications for a published resource.

Affiliate workspace tools

ToolPurpose
discover_programsSearch public marketplace programs with filters.
apply_to_programApply the current affiliate account to a marketplace program.
get_affiliate_overviewReturn aggregate affiliate workspace KPIs across programs.
list_my_programsList the current affiliate account and linked program context.
list_linksList existing tracking links for the current affiliate account.
create_linkCreate one affiliate tracking link for the current program.
get_earningsReturn a compact earnings summary for the current affiliate account.
get_click_statsReturn daily click and unique click totals for the current affiliate account.
list_my_payoutsList payout history for the current affiliate account.
update_my_payout_profileUpdate payout destination and billing fields for the current affiliate account.

Affiliate marketing resources tools

ToolPurpose
list_marketing_resourcesList affiliate-visible resources for a program.
get_marketing_resourceRead one affiliate-visible resource or collection.
render_marketing_social_postRender social post copy with affiliate placeholders and disclosure guidance.
create_marketing_resource_download_urlCreate a short-lived affiliate download URL.

Resources

The servers also expose read-oriented resources for structured data access:
PersonaResource URIDescription
Merchantmerchant://meAuthenticated merchant profile and baseline account configuration.
Merchantprogram://{id}Program configuration and ownership metadata.
Merchantstats://{programId}Program-level conversion and commission statistics.
Merchantmarketing-resources://program/{program_id}Marketing resources for a program.
Merchantmarketing-resource-collection://{collection_id}One marketing resource collection.
Merchantmarketing-resource://{resource_id}One marketing resource item.
Affiliateaffiliate://me/programsAuthenticated affiliate program context and performance summary.
Affiliatemarketplace://catalogCatalog of public marketplace programs.
Affiliatemarketing-resources://program/{program_id}Affiliate-visible marketing resources for a program.
Affiliatemarketing-resource-collection://{collection_id}Affiliate-visible collection details.
Affiliatemarketing-resource://{resource_id}Affiliate-visible resource details.

Prompts

The MCP server also registers four reusable prompts for guided workflows:
PromptPurpose
onboard_programGuide an agent through program creation, Stripe connect, tracking verification, and onboarding completion.
review_payout_runGuide a manual payout run from candidate discovery to final payout status updates.
debug_tracking_installationDiagnose an incomplete or broken tracking installation for one program.
triage_fraud_flagsReview open fraud flags, prioritize them, and resolve them safely.

Idempotency

Mutation tools accept an optional idempotency_key. When provided, the server guarantees at-most-once execution for the logical operation — safe for agent retries.
idempotency_key: "setup-acme-program-2026-04"
Always pass an idempotency key when your agent might retry a tool call. This prevents duplicate programs, double payouts, or repeated approvals.

Workflow Examples

Set Up a New Program

A natural conversation with your AI agent might look like:
You: “Create a SaaS affiliate program called ‘Acme Pro Referrals’ with 25% recurring commission and a 60-day cookie.”
The agent calls:
get_onboarding_status({})

create_program({
  name: "Acme Pro Referrals",
  commission_percent: 25,
  commission_type: "recurring",
  cookie_duration: 60,
  idempotency_key: "create-acme-pro-referrals"
})
Then it follows up with get_stripe_connect_url, get_tracking_snippet, verify_tracking, and complete_onboarding.

Monitor Fraud Flags

You: “Check if there are any suspicious conversions this week and resolve them.”
The agent can start with list_flags, then resolve specific items with review_flag:
list_flags({
  status: "open",
  limit: 20
})

review_flag({
  flag_id: "flag-uuid-here",
  resolution: "dismissed",
  note: "Verified legitimate traffic from blog post",
  idempotency_key: "resolve-flag-abc123"
})

Generate a Payout Report

You: “Show me who’s ready for payout, create the payout records, and export a CSV for PayPal.”
list_pending_payouts({ program_id: "prog-uuid" })

create_payout({
  affiliate_id: "aff-uuid",
  program_id: "prog-uuid",
  idempotency_key: "payout-acme-april"
})

export_payouts_csv({ format: "paypal", program_id: "prog-uuid" })

Affiliate: Discover and Join Programs

You: “Find affiliate programs with at least 20% commission and apply to the best one.”
discover_programs({ min_commission: 20, sort_by: "commission" })

apply_to_program({
  program_id: "prog-uuid",
  message: "I run a SaaS review blog with 50k monthly readers.",
  idempotency_key: "apply-prog-xyz"
})

create_link({
  program_id: "prog-uuid",
  destination_path: "/pricing",
  custom_slug: "acme-review",
  idempotency_key: "link-acme-pricing"
})

Merchant: Publish Campaign Assets

You: “Create a LinkedIn post for our launch kit and publish it for affiliates.”
create_marketing_social_post({
  program_id: "prog-uuid",
  title: "Launch announcement",
  body: "I am sharing {{program_name}} because it helps teams launch affiliate programs faster: {{affiliate_link}}",
  platforms: ["linkedin"],
  status: "draft",
  idempotency_key: "launch-post-001"
})

publish_marketing_resource({
  program_id: "prog-uuid",
  resource_id: "resource-uuid",
  idempotency_key: "publish-launch-post-001"
})

Affiliate: Render Campaign Copy

You: “Show me the latest social posts for this program and render one with my link.”
list_marketing_resources({
  program_id: "prog-uuid",
  kind: "social_posts"
})

render_marketing_social_post({
  program_id: "prog-uuid",
  resource_id: "resource-uuid",
  affiliate_link_id: "link-uuid"
})

Sessions and transport

  • The endpoints use Streamable HTTP at https://www.agentref.co/api/mcp/merchant and https://www.agentref.co/api/mcp/affiliate
  • Sessions are created during the MCP initialize flow and handled automatically by clients
  • If a client holds an expired or invalid session id, it should reconnect and initialize again

Error Handling

Tool errors are returned as structured MCP results with an error code, message, and HTTP status. Common scenarios:
ErrorCause
UNAUTHORIZEDOAuth not completed yet, or invalid fallback API key
FORBIDDENKey lacks required scope
NOT_FOUNDProgram, affiliate, or flag does not exist
VALIDATION_ERRORInvalid input parameters
RATE_LIMITEDToo many requests — retry after delay
All errors include a requestId for debugging. Reference it when contacting support.