gridgrid

Agent API

Build on ProductClank. Enable your AI agent to create and manage Communiply campaigns programmatically with x402 crypto payments.

Overview

The ProductClank Agent API lets AI agents create Communiply campaigns — AI-powered Twitter/X brand advocacy that finds relevant posts and generates authentic community replies for your product.

Authenticate

Bearer API key per agent

Pay

x402 — USDC on Base

Create

Campaign goes live instantly

Authentication

All requests require a Bearer API key in the Authorization header. API keys are issued per agent — contact the ProductClank team to register.

Header
Authorization: Bearer pck_live_<your_api_key>

Keys are prefixed with pck_live_ and are hashed (SHA-256) server-side. Never share your raw key.

Create Campaign

POST/api/v1/agents/campaigns

Request Body

FieldTypeRequiredDescription
product_idUUIDYesProduct to create campaign for
titlestringYesCampaign title
keywordsstring[]YesKeywords for finding relevant Twitter posts
search_contextstringYesDescription of target conversations
selected_packagestringYes"test" | "starter" | "growth" | "scale"
mention_accountsstring[]NoTwitter handles to mention in replies
reply_style_tagsstring[]NoTone tags (e.g. "friendly", "technical")
reply_style_accountstringNoTwitter handle whose style to mimic
reply_lengthstringNo"very-short" | "short" | "medium" | "long" | "mixed"
reply_guidelinesstringNoCustom AI reply instructions (auto-generated if omitted)
min_follower_countnumberNoMin followers for target posts (default: 100)
min_engagement_countnumberNoMin engagement for target posts
max_post_age_daysnumberNoMaximum age of posts to target
require_verifiedbooleanNoOnly target verified accounts (default: false)
payment_tx_hashstringNoTx hash for direct USDC transfer (alternative to x402)

Response Codes

200Success
{
  "success": true,
  "campaign": {
    "id": "uuid",
    "campaign_number": "CP-042",
    "title": "My Campaign",
    "status": "active",
    "created_via": "api",
    "creator_agent_id": "agent-uuid",
    "is_funded": true
  },
  "payment": {
    "method": "x402",
    "amount_usdc": 0.01,
    "network": "base",
    "payer": "0xAgentWalletAddress",
    "tx_hash": null
  }
}
402Payment Required(expected on first x402 request)
{
  "success": false,
  "error": "payment_required",
  "amount_usdc": 0.01,
  "package": "test",
  "payment_methods": {
    "x402": {
      "description": "x402 protocol payment",
      "config": {
        "scheme": "exact",
        "network": "eip155:8453",
        "payTo": "0x876Be690234aaD9C7ae8bb02c6900f5844aCaF68",
        "amount": "10000",
        "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
      }
    },
    "direct_transfer": {
      "description": "Send USDC directly, then re-submit with payment_tx_hash",
      "pay_to": "0x876Be690234aaD9C7ae8bb02c6900f5844aCaF68",
      "amount_usdc": 0.01,
      "network": "Base (chain ID 8453)"
    }
  }
}
400Bad Request
{ "success": false, "error": "validation_error", "message": "Missing required fields: product_id, title, keywords (non-empty), search_context" }
401Unauthorized
{ "success": false, "error": "unauthorized", "message": "Invalid API key" }
404Not Found
{ "success": false, "error": "not_found", "message": "Product not found" }
429Rate Limited
{ "success": false, "error": "rate_limit_exceeded", "message": "Daily campaign creation limit exceeded (10/day)" }

Packages & Pricing

Payment is in USDC on Base (chain ID 8453). Two payment methods are supported: x402 protocol (atomic payments) or direct USDC transfer with transaction hash. The campaign is created only if payment succeeds.

PackagePrice (USDC)Use Case
test$0.01Development & testing
starter$99Small campaign
growth$499Medium campaign
scale$2,000Large campaign

Quick Start

Install dependencies:

Terminal
npm install @x402/fetch viem

Create a campaign with automatic x402 payment:

TypeScript
import { wrapFetchWithPayment } from "@x402/fetch";
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

// Your agent's wallet (must hold USDC on Base)
const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

// Wrap fetch with x402 payment handling
const x402Fetch = wrapFetchWithPayment(fetch, walletClient);

async function createCampaign() {
  const response = await x402Fetch(
    "https://app.productclank.com/api/v1/agents/campaigns",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer pck_live_YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        product_id: "YOUR_PRODUCT_UUID",
        title: "Launch Week Community Buzz",
        keywords: ["AI tools", "productivity", "startup"],
        search_context: "People discussing AI productivity tools and startups",
        selected_package: "test",
        reply_style_tags: ["friendly", "authentic"],
        reply_length: "short",
      }),
    }
  );

  const result = await response.json();
  console.log("Campaign created:", result);
}

createCampaign();

x402 Payment Protocol

x402 is an open payment standard by Coinbase that uses HTTP 402 responses for programmatic crypto payments. No pre-funding, no accounts — just atomic pay-per-request with USDC on Base.

How it works:

  1. Your agent sends a POST request with campaign data
  2. Server responds with 402 Payment Required + price
  3. @x402/fetch automatically signs a USDC payment on Base and retries with the X-PAYMENT header
  4. Server verifies payment via Coinbase facilitator
  5. Campaign is created and payment is settled atomically

Your agent wallet needs USDC on Base. Get Base ETH for gas from bridge.base.org and USDC from any exchange or DEX on Base.

Direct USDC Transfer

For wallets without private key access (smart contract wallets, MPC wallets, Bankr, etc.), you can pay by sending USDC directly and providing the transaction hash.

How it works:

  1. Send USDC on Base to: 0x876Be690234aaD9C7ae8bb02c6900f5844aCaF68
  2. Amount must match the exact package price
  3. Wait for transaction confirmation on Base
  4. Send POST request with payment_tx_hash in the request body
TypeScript
// Step 1: Send USDC transfer via your wallet provider
const txHash = "0x..."; // The confirmed transaction hash

// Step 2: Create campaign with tx hash
const response = await fetch(
  "https://app.productclank.com/api/v1/agents/campaigns",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer pck_live_YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      product_id: "YOUR_PRODUCT_UUID",
      title: "My Campaign",
      keywords: ["web3", "crypto"],
      search_context: "People discussing web3 tools",
      selected_package: "test",
      payment_tx_hash: txHash,
    }),
  }
);

Requirements: Transaction must be confirmed on Base, recent (within 1 hour), and each tx hash can only be used once (replay protection).

Credit Bundles

Coming Soon: Credit-based pricing is replacing package pricing. Agents will buy credits and consume them as actions are performed (~12 credits per post).

BundleCreditsPrice (USDC)~Posts
nano50$2~4 posts
micro200$10~16 posts
small550$25~45 posts
medium1,200$50~100 posts
large2,600$100~216 posts
enterprise14,000$500~1,166 posts

Higher bundles offer better value per credit. Enterprise agents get 28 credits/$ vs 25 credits/$ on nano.

Need an API key or have questions? Reach out on Twitter