canonical: https://jentic.com/apis/affiliaterail.com/affiliaterail

# AffiliateRail API

The AffiliateRail API runs an affiliate and partner program over one consistent REST contract, exposing every object in the product as an addressable resource. It creates partners, groups, tracking links, and coupons, records clicks, referrals, and sales, and attributes earnings through commission rules that can be approved, rejected, or added manually. Earnings flow into balances, payouts, and generated payout batches, while campaigns and sequences nurture partners and signed webhook endpoints stream events to your systems. A partner-finder surface adds prospect discovery, email reveal, notes, and a recruitment pipeline, and idempotency keys keep a retried write from recording the same action twice.

## For AI agents

Create partners and tracking links, record clicks and sales, attribute and approve commissions, generate payouts, and recruit prospects. Authenticates with a bearer key.

## Scope

Does not handle card payment processing, tax filing, or ad campaign buying. Use for affiliate program, partner, commission, and payout management only.

## Capabilities

- Create and update partners, groups, and tracking links within a program
- Record clicks, referrals, and sales and attribute earnings through commission rules
- Approve, reject, or create manual commissions and read what matures between two dates
- Generate payout batches, mark payouts paid, and read balances per partner
- Register signed webhook endpoints, replay deliveries, and rotate signing secrets
- Find and save prospect brands, reveal a prospect's email, and move prospects through a recruitment pipeline

## Use cases

### Agent-Managed Affiliate Operations via Jentic

An AI agent can run the day-to-day of an affiliate program instead of a human clicking through a dashboard. Through Jentic the agent records a sale, lets commission rules attribute the earning, approves the commission once it is valid, and later generates a payout batch, each write carrying an idempotency key so a retry never double-counts.

Example prompt: Record a sale for a partner, approve the resulting commission once it is valid, and generate a payout batch for all approved commissions

### Commission and Payout Lifecycle

AffiliateRail tracks earnings from attribution to payment. Commission rules compute earnings on sales in integer minor units with an explicit currency, commissions can be approved or rejected and queried for what matures between two dates, and balances roll up into payouts and generated payout batches that can be marked paid.

Example prompt: List the commissions maturing in a date range, then generate a payout batch and mark its payouts paid once settled

### Partner Recruitment with Finder

The finder surface helps grow a program by sourcing new affiliates. An agent searches prospect brands, saves promising ones, reveals a prospect's email, adds notes, and moves prospects through pipeline stages and lanes, with credit balances tracking email reveals so recruitment stays within budget.

Example prompt: Search finder prospects for matching brands, save the best ones, reveal a prospect's email, and move it to the next pipeline stage

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/v1/partners` | List partners |
| POST | `/v1/partners` | Create a partner |
| GET | `/v1/commissions` | List commissions |
| POST | `/v1/commissions/{id}/approve` | Approve a commission |
| GET | `/v1/sales` | List sales |
| POST | `/v1/payout_batches` | Generate a payout batch |
| GET | `/v1/links` | List links |

## Key resources

- **Partners and links** — Create and update partners, groups, tags, tracking links, coupons, and resources.
- **Attribution** — Record clicks, referrals, and sales and attribute earnings through commission rules.
- **Commissions and payouts** — Approve, reject, or add commissions, read balances, and generate and mark payout batches.
- **Finder** — Discover and save prospect brands, reveal emails, add notes, and run a recruitment pipeline.

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 51 / 100
- **Maturity:** Foundational
- **Dimensions:**
  - Foundational Compliance: 98 / 100
  - Developer Experience & Jentic Compatibility: 67 / 100
  - AI-Readiness & Agent Experience: 27 / 100
  - Agent Usability: 66 / 100
  - Security: 60 / 100
  - AI Discoverability: 70 / 100
- **View full report:** https://jentic.com/apis/affiliaterail.com/affiliaterail/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring AffiliateRail by hand means learning its bearer key with the rail_live_ or rail_test_ prefix, passing program_id on every list, and sending an Idempotency-Key on writes so a retry does not record the same sale twice. Through Jentic you install once, import AffiliateRail from the API Directory, store the key once, and your agent manages partners and commissions.
- **Permission scoping:** AffiliateRail puts the partner id in the URL path (`/v1/partners/{id}`), so a rule can pin your agent to one partner and the operations you choose, such as reading sales and approving commissions. You decide which operations it may call, so deleting partners or marking payouts paid stays out unless you add it.
- **Credential handling:** Your AffiliateRail key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'approve an affiliate commission' or 'generate a payout batch', and Jentic returns the matching AffiliateRail operation with its input schema so the agent calls the right endpoint directly.

## Related APIs

- **Refersion** — Refersion is an affiliate tracking and payout platform; AffiliateRail adds a built-in partner finder and recruitment pipeline.
- **Rewardful** — Rewardful focuses on affiliate programs for subscription products; AffiliateRail exposes every program object over one REST contract.
- **Everflow** — Everflow is a partner marketing platform for networks and advertisers; AffiliateRail covers programs, commissions, and recruitment in one API.
- **Stripe** — Stripe processes the actual money movement; AffiliateRail computes the commissions and payout batches that feed it.

## FAQ

### What authentication does the AffiliateRail API use?

The AffiliateRail API authenticates with a key sent as a bearer token in the Authorization header, per its OpenAPI spec. A test-mode key stamps responses as test but reads and writes the same data as a live key, so the prefix labels the key rather than separating the rows. Through Jentic the key is stored encrypted on your own instance and injected at call time.

### Is there an AffiliateRail MCP server?

You don't need an MCP server to give your agent AffiliateRail. Jentic connects it directly from the API Directory: import AffiliateRail, store your key once, and your agent manages partners, commissions, and payouts straight away. Operations are discovered on demand, so no extra server's tool definitions sit in your agent's context.

### Can I limit what my agent is allowed to do with the AffiliateRail API?

Yes. Because the partner id travels in the URL path, you can write a rule that allows only reading sales and approving commissions on one partner, so the agent handles that partner and nothing else. Deleting partners or marking payouts paid stays out of the rule unless you add it, and every call the agent makes is logged.

### Can I manage commissions and payouts with the AffiliateRail API?

Yes. Commission rules attribute earnings on recorded sales in integer minor units with an explicit currency, and commissions can be approved, rejected, or created manually. You can read what matures between two dates, generate a payout batch from approved commissions, and mark individual payouts paid.

### What are the rate limits for the AffiliateRail API?

The AffiliateRail OpenAPI spec does not publish numeric request rate limits. It does support an Idempotency-Key header on writes so a retried request replays the first response for 24 hours instead of running the work twice. Check the AffiliateRail documentation at https://docs.affiliaterail.com for current limits.

### How do I approve a commission with the AffiliateRail API through Jentic?

Search the Jentic API Directory for an intent like 'approve an affiliate commission', import AffiliateRail, and store your key once. Your agent then lists pending commissions and approves the valid ones through Jentic. To run it on your own infrastructure, install Jentic One from its GitHub repo.
