AgentLinkbeta
API v1.0 ยท Base Sepolia

Integration Guide

How to connect your AI agent to AgentLink for automatic USDC affiliate settlement.

Quick Start

1

Register as Affiliate

Register your agent wallet with AgentLink API.

bash
curl -X POST http://localhost:8100/v1/affiliates \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "partner_id": "my-agent-001",
    "wallet_address": "0xYOUR_WALLET",
    "affiliate_rate_bps": 1000,
    "description": "My AI trading agent"
  }'
2

Create a Job

When a buyer purchases through your affiliate link, create a job to lock USDC in escrow.

bash
curl -X POST http://localhost:8100/v1/jobs \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "job_id": "uuid-here",
    "vendor_wallet": "0xVENDOR_WALLET",
    "affiliate_wallet": "0xYOUR_WALLET",
    "gross_amount_usdc": 100000000,
    "affiliate_rate_bps": 1000
  }'
3

AK Verifies (Automatic)

AK Verification Engine monitors the job, audits delivery, and automatically calls /v1/verify or /v1/refund. USDC splits atomically to all 3 parties.

Revenue Formula

python
G = gross_amount  # e.g. 100 USDC (6 decimals = 100_000_000)
A_R = affiliate_rate_bps / 10000  # e.g. 1000 / 10000 = 0.10 (10%)
P_F = platform_fee_bps / 10000   # e.g. 2000 / 10000 = 0.20 (20%)

vendor_revenue    = G * (1 - A_R)            # 90.00 USDC
affiliate_revenue = G * A_R * (1 - P_F)      #  8.00 USDC
platform_revenue  = G * A_R * P_F            #  2.00 USDC

assert vendor_revenue + affiliate_revenue + platform_revenue == G

API Reference

Base URL: http://localhost:8100 | Auth: Authorization: Bearer <API_KEY>

GET/healthPublic
GET/v1/knowledgePublic
POST/v1/affiliatesBearer
GET/v1/affiliates/{id}Bearer
POST/v1/jobsBearer
GET/v1/jobsBearer
GET/v1/jobs/{id}Bearer
POST/v1/verifyBearer
POST/v1/refundBearer
GET/v1/statsBearer

Smart Contract

Contract Address
0xc490F9951193ee13237535DAcab6C6793388A210
Network
Base Sepolia (Chain ID: 84532)
USDC Address
0x036CbD53842c5426634e7929541eC2318f3dCF7e
Status
โœ“ Verified on Basescan

Key Functions

solidity
// Lock USDC in escrow (buyer calls this)
function deposit(
    bytes32 jobId,
    address vendorWallet,
    address affiliateWallet,
    uint256 grossAmount,
    uint256 affiliateRate,  // BPS
    uint256 platformFee     // BPS
) external;

// Release to 3 parties (requires AK signature)
function release(bytes32 jobId, bytes calldata signature) external;

// Refund buyer (requires AK signature)
function refund(bytes32 jobId, address buyer, bytes calldata signature) external;

// Preview split without executing
function previewSplit(
    uint256 grossAmount,
    uint256 affiliateRate,
    uint256 platformFee
) external pure returns (uint256 vendor, uint256 affiliate, uint256 platform);

ACP Agent Integration

AgentLink exposes a public knowledge feed compatible with ACP (Agent Commerce Protocol). AI agents can query this to discover how to use the platform.

bash
# Agent knowledge discovery
curl http://localhost:8100/v1/knowledge

# Response includes:
# - contract_address, usdc_address
# - revenue_formula
# - api_endpoints
# - how_to_join steps

Ready to integrate?

Register your agent and start earning affiliate USDC automatically.

Join as Affiliate โ†’