gridgrid

Agent API

Rally your community to engage with your posts across Twitter/X, Instagram, TikTok, LinkedIn, Reddit, and Farcaster. CLI, Agent Skill, and REST API for community-powered growth.

Overview

The ProductClank Agent API lets you rally your community to engage with your posts across Twitter/X, Instagram, TikTok, LinkedIn, Reddit, and Farcaster. Two ways to use it:

Boost

Rally community around a specific post — replies, likes, reposts (6 platforms)

Discover

AI finds relevant conversations, generates replies, community posts them

CLI

npm i -g github:covariance-network/communiply-cli

Agent Skill

For AI agents — auto-loaded from GitHub

REST API

Bearer API key + USDC on Base

How It Works

Two entry points, one execution layer. Discover relevant conversations or rally your community around a specific post — both end with real people posting authentic engagement from their personal accounts.

Brand Wants to Grow on X
Two entry points

Discovery

Find relevant posts by keywords, topics, and intent. Not every search leads to a campaign — search is reusable.

POST /discovery/search

Direct Post

Already have a post you want to amplify? Skip discovery — go straight to campaign creation.

Provide post URL directly
Post URL provided

Campaign Creation

POST /campaigns

Choose action type

Reply200 cr
Like300 cr
Repost300 cr

Who executes

Community(third-party, earn rewards)

Community members execute

Real people act from personal accounts — authentic, trusted, rewarded

User journeys

I have a post I want to amplify

Provide post URL
Choose action
Campaign created

Register Your Agent

Self-serve registration — no approval needed. Register your agent and get an API key instantly. Works for both human builders registering an agent via the API, and agents registering themselves programmatically.

POST/api/v1/agents/registerNo auth required
Register an agent
curl -X POST https://api.productclank.com/api/v1/agents/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "MyGrowthAgent",
    "description": "AI agent for Twitter growth campaigns",
    "wallet_address": "0x1234...abcd",
    "erc8004_agent_id": "22965"
  }'
Response (201 Created)
{
  "success": true,
  "agent": {
    "id": "uuid",
    "name": "MyGrowthAgent",
    "status": "active",
    "rate_limit_daily": 10
  },
  "api_key": "pck_live_abc123def456...",
  "credits": { "balance": 300, "plan": "free" },
  "_warning": "Store this API key securely. It will not be shown again."
}

Important: The API key is shown exactly once. Store it securely — there is no way to retrieve it later.

Request Fields

FieldTypeRequiredDescription
namestringYesAgent name (must be unique)
descriptionstringNoWhat the agent does
wallet_addressstringNoBase wallet address (0x...)
erc8004_agent_idstringNoERC-8004 on-chain identity ID
rolestringNoAgent role (Growth, Research, Creative, etc.)
logostringNoLogo URL
websitestringNoAgent website

ERC-8004 Identity Import

If your agent has an ERC-8004 on-chain identity, you can import its profile data before registering to auto-fill name, description, logo, and website.

POST/api/v1/agents/importNo auth required
Import ERC-8004 profile
curl -X POST https://api.productclank.com/api/v1/agents/import \
  -H "Content-Type: application/json" \
  -d '{"source": "erc8004", "erc8004_agent_id": "22965"}'

Use the returned data to pre-fill the registration request. Pass the erc8004_agent_id and erc8004_metadata into the register endpoint.

Authentication

All requests (except registration and import) require a Bearer API key in the Authorization header. API keys are obtained via self-registration above.

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
estimated_postsnumberNoEstimated number of posts for cost calculation
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",
    "url": "https://app.productclank.com/communiply/uuid"
  },
  "next_step": {
    "action": "generate_posts",
    "endpoint": "POST /api/v1/agents/campaigns/{id}/generate-posts",
    "description": "Generate posts for this campaign. Optionally share the campaign URL with the user for review first."
  }
}

Note: Creating a campaign does NOT generate posts automatically. Call the generate-posts endpoint as a separate step. This allows the user to review campaign settings first.

402Insufficient Credits(top up via /credits/topup)
{
  "success": false,
  "error": "insufficient_credits",
  "message": "Not enough credits. Balance: 0, needed: 120",
  "current_balance": 0,
  "required_credits": 120,
  "topup_url": "/api/v1/agents/credits/topup",
  "bundles": {
    "nano": { "credits": 40, "price_usdc": 2 },
    "micro": { "credits": 200, "price_usdc": 10 },
    "small": { "credits": 550, "price_usdc": 25 }
  }
}
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)" }

Generate Posts

POST/api/v1/agents/campaigns/{campaignId}/generate-posts

Triggers Twitter/X post discovery and AI reply generation for an existing campaign. Credits are deducted at the same rates as the webapp (~12 credits per post).

Recommended workflow:

  1. Create a campaign — receive the campaign URL in the response
  2. Share the URL with the user so they can review campaign settings
  3. Once confirmed, call this endpoint to discover posts and generate replies

Request

No request body required. The campaignId is passed as a URL path parameter.

cURL
curl -X POST https://api.productclank.com/api/v1/agents/campaigns/CAMPAIGN_UUID/generate-posts \
  -H "Authorization: Bearer pck_live_YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response Codes

200Success
{
  "success": true,
  "message": "Generated 5 posts with replies",
  "postsGenerated": 5,
  "repliesGenerated": 5,
  "errors": 0,
  "batchNumber": 1,
  "credits": {
    "creditsUsed": 60,
    "creditsRemaining": 240
  }
}
402Insufficient Credits
{
  "success": false,
  "message": "Insufficient credits",
  "creditsRequired": 60,
  "creditsAvailable": 10,
  "shortfall": 50,
  "costPerPost": 12
}
403Forbidden
{ "success": false, "error": "forbidden", "message": "This campaign was not created by your agent" }
404Not Found
{ "success": false, "error": "not_found", "message": "Campaign not found" }

Boost a Post

POST/api/v1/agents/campaigns/boost

Rally your community to engage with a specific post — replies showing support, questions, and congrats, plus likes and reposts. Works across Twitter/X, Instagram, TikTok, LinkedIn, Reddit, and Farcaster. Platform is auto-detected from URL.

Supported Platforms

PlatformRepliesLikesReposts
Twitter/XYesYesYes
InstagramYesYes
TikTokYesYes
LinkedInYesYes
RedditYesYes
FarcasterYesYesYes

Request Body

FieldTypeRequiredDescription
post_urlstringYesPost URL to boost (platform auto-detected). tweet_url also accepted.
product_idUUIDYesProduct to associate with this boost
action_typestringNo"replies" (default), "likes", or "repost"
reply_guidelinesstringNoGuidelines for community replies (e.g. "congratulate the team, ask about features")
post_textstringNoPost text — pass directly to skip server-side fetch. tweet_text also accepted.
post_authorstringNoPost author username (used with post_text). tweet_author also accepted.

Post text resolution: Client-provided post_text → server-side fetch → 503 error (for replies). Pass post_text to guarantee availability when the platform API is unreliable.

Action Types & Costs

ActionItemsCredits
replies (default)10 community replies200
likes30 community likes300
repost10 community reposts300

Examples

cURL — Twitter/X
curl -X POST https://api.productclank.com/api/v1/agents/campaigns/boost \
  -H "Authorization: Bearer pck_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "post_url": "https://x.com/myproduct/status/123456789",
    "product_id": "YOUR_PRODUCT_UUID",
    "action_type": "replies",
    "reply_guidelines": "Congratulate the team, ask about the new features"
  }'
cURL — Instagram
curl -X POST https://api.productclank.com/api/v1/agents/campaigns/boost \
  -H "Authorization: Bearer pck_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "post_url": "https://www.instagram.com/p/ABC123/",
    "product_id": "YOUR_PRODUCT_UUID",
    "action_type": "replies"
  }'
CLI (any platform)
# Install: npm i -g github:covariance-network/communiply-cli
communiply boost https://x.com/myproduct/status/123 --action replies \
  --guidelines "Congratulate the team, ask about features"
communiply boost https://www.instagram.com/p/ABC123/ --action replies
communiply boost https://www.tiktok.com/@user/video/123 --action replies
communiply boost https://www.linkedin.com/posts/user_activity-123 --action replies

Response

200 Success
{
  "success": true,
  "campaign": {
    "id": "uuid",
    "campaign_number": "CP-042",
    "action_type": "replies",
    "is_reboost": false,
    "url": "https://app.productclank.com/communiply/uuid"
  },
  "post": {
    "id": "123456789",
    "platform": "twitter",
    "url": "https://x.com/myproduct/status/123456789",
    "text": "We just shipped v2.0! 10x faster API.",
    "author": "myproduct"
  },
  "tweet": { ... },
  "items_generated": 10,
  "credits": {
    "credits_used": 200,
    "credits_remaining": 100,
    "billing_user_id": "user-uuid"
  }
}

Re-boost: Calling boost again with the same post URL and action type generates additional items for the existing campaign (is_reboost: true).

Review Posts

POST/api/v1/agents/campaigns/{campaignId}/review-posts

AI-powered review of discovered posts against user-defined relevancy rules. Scores every post, then deletes irrelevant ones. Run after generate-posts to clean up before the campaign goes live. Costs 2 credits per post reviewed.

Request Body

FieldTypeRequiredDescription
review_rulesstringYes*Freeform rules for what makes a post relevant. *Optional if rules were saved previously.
thresholdnumberNoScore threshold (1-10). Posts below this are marked irrelevant. Default: 5.
dry_runbooleanNoIf true, scores posts but does NOT delete. Default: false.
save_rulesbooleanNoSave rules to campaign for future runs. Default: true.
cURL
curl -X POST https://api.productclank.com/api/v1/agents/campaigns/CAMPAIGN_UUID/review-posts \
  -H "Authorization: Bearer pck_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "review_rules": "Only posts where the builder announced their own product are relevant",
    "threshold": 5,
    "dry_run": false
  }'

Response Codes

200Success
{
  "success": true,
  "dry_run": false,
  "summary": {
    "total_reviewed": 88,
    "deleted": 23,
    "marked_irrelevant": 23,
    "kept": 65,
    "processing_time_ms": 142000
  },
  "credits": {
    "charged": 176,
    "remaining": 124,
    "billing_user_id": "user-uuid"
  },
  "rules_saved": true
}
402Insufficient Credits
{
  "success": false,
  "error": "insufficient_credits",
  "message": "Insufficient credits. Need 176, have 100.",
  "credits_required": 176,
  "credits_available": 100,
  "cost_per_post": 2
}

Tip: Run with dry_run: true first to preview which posts will be deleted, then run again with dry_run: false to apply. Both runs consume credits.

Campaign Tiers

Three levels of sophistication for creating and managing campaigns. Choose the tier that matches your agent's capabilities and your campaign goals.

TierNameTypical CostStatus
1Quick Launch~70 credits ($2.92)Available
2Research-Enhanced~72-74 credits ($3.00)Coming Soon
3Iterate & Optimize~100-200 credits ($4-8)Coming Soon
Tier 1: Quick LaunchAvailable

Agent provides all inputs pre-computed. Create a campaign, generate posts, and optionally review for relevancy.

1. POST /agents/campaigns → 10 credits
2. POST /agents/campaigns/{id}/generate-posts → 12 credits/post
3. POST /agents/campaigns/{id}/review-posts → 2 credits/post (optional cleanup)

Best for: Agents with good domain knowledge, simple one-shot campaigns, cost-sensitive workflows.

Endpoints: See Create Campaign, Generate Posts, and Review Posts sections above.

Tier 2: Research-EnhancedComing Soon

AI-powered research before generation for better targeting. Research is free — the value is in higher-quality post discovery.

1. POST /agents/generate-keywords → 2 credits (optional)
2. POST /agents/campaigns → 10 credits
3. POST /agents/campaigns/{id}/research → free
4. GET  /agents/campaigns/{id}/research → free (review)
5. POST /agents/campaigns/{id}/verticals → free
6. POST /agents/campaigns/{id}/generate-posts → 12 credits/post

Planned Endpoints

POST/agents/generate-keywords2 credits

Generate 8-15 keywords from natural language goals. Input: search_goals, optional product_name, product_tagline.

POST/agents/campaigns/{id}/researchfree

Run AI research analysis. Returns expanded keywords, high-intent phrases, key accounts, Twitter lists, hashtags, and competitors.

POST/agents/campaigns/{id}/verticalsfree

Select which discovery sources to use: keywords, phrases, influencers, lists, competitors.

GET/agents/campaigns/{id}free

Read campaign details, settings, and stats.

GET/agents/campaignsfree

List all campaigns created by this agent.

Best for: Exploring new niches, campaigns targeting 10+ posts, maximizing discovery quality.

Tier 3: Iterate & OptimizeComing Soon

Full campaign lifecycle management. Read results, refine via AI chat, regenerate replies, and iterate until satisfied.

7.  GET  /agents/campaigns/{id}/posts → free
8.  POST /agents/campaigns/{id}/refine → 3 credits/msg
9.  POST /agents/campaigns/{id}/regenerate-replies → 5 credits/reply
10. PATCH /agents/campaigns/{id} → free
11. POST /agents/campaigns/{id}/generate-posts → 12 credits/post

Planned Endpoints

GET/agents/campaigns/{id}/postsfree

Read discovered posts with replies. Filter by status, claimed/unclaimed. Includes author info, engagement metrics, relevance score.

POST/agents/campaigns/{id}/regenerate-replies5 credits/reply

Regenerate replies for specific posts with new instructions. Input: postIds[], editRequest. Can optionally update permanent guidelines.

POST/agents/campaigns/{id}/refine3 credits/message

AI campaign optimization chat (synchronous). Send messages, receive advice + auto-executed actions. Actions: update keywords, regenerate replies, run discovery, update guidelines, cleanup posts.

PATCH/agents/campaigns/{id}free

Direct campaign setting updates. Modify keywords, guidelines, filters, scheduling, and visibility without using the AI chat.

Best for: Ongoing campaigns, A/B testing reply styles, building feedback loops, multi-iteration optimization.

Credit Cost Summary

OperationCreditsTier
Create campaign101
Generate posts (discover + reply)12/post1
Review posts (AI relevancy)2/post1
Generate keywords (AI)22
Research analysisfree2
Regenerate replies5/reply3
Refine chat (AI)3/message3
Boost — community replies200Boost
Boost — likes300Boost
Boost — reposts300Boost

Credit-Based Pricing

ProductClank uses a pay-per-use credit system. Buy credits with USDC on Base (chain ID 8453), then create campaigns — credits are consumed as AI operations are performed (~12 credits per post).

Operation Costs

OperationCredits~Cost
Discover post + generate reply12~$0.50
Review post (AI relevancy)2~$0.08
Generate reply only8~$0.33
Regenerate reply5~$0.21
Boost — community replies (10 replies)200~$8.33
Boost — likes (30 likes)300~$12.50
Boost — reposts (10 reposts)300~$12.50

Workflow

  1. Register agent via POST /agents/register — receive API key + 300 free credits
  2. Check credit balance via GET /agents/credits/balance
  3. Top up credits via POST /agents/credits/topup (x402 or direct transfer)
  4. Create a campaign via POST /agents/campaigns
  5. (Optional) Share the campaign URL with the user for review
  6. Generate posts via POST /agents/campaigns/{id}/generate-posts — credits deducted here
  7. (Optional) Review posts via POST /agents/campaigns/{id}/review-posts — 2 credits/post, deletes irrelevant ones
  8. View transaction history via GET /agents/credits/history

Credit Endpoints

GET/api/v1/agents/credits/balance— Current balance and plan info
POST/api/v1/agents/credits/topup— Purchase credits with a bundle
GET/api/v1/agents/credits/history— Transaction history (paginated)

Quick Start

Install dependencies:

Terminal
npm install @x402/fetch viem

Five-step flow: register, check balance, top up if needed, create campaign, generate posts:

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

const API = "https://api.productclank.com/api/v1";

// Step 0: Register your agent (one-time)
const registerRes = await fetch(API + "/agents/register", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    name: "MyGrowthAgent",
    description: "AI agent for Twitter growth campaigns",
    wallet_address: "0xYOUR_WALLET_ADDRESS",
  }),
});
const { api_key } = await registerRes.json();
// Store api_key securely — it won't be shown again!

const headers = {
  "Authorization": `Bearer ${api_key}`,
  "Content-Type": "application/json",
};

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

// 1. Check credit balance (300 free credits on signup)
const balanceRes = await fetch(API + "/agents/credits/balance", { headers });
const { balance } = await balanceRes.json();
console.log("Credits:", balance);

// 2. Top up if needed (x402 handles payment automatically)
if (balance < 120) {
  await x402Fetch(API + "/agents/credits/topup", {
    method: "POST",
    headers,
    body: JSON.stringify({ bundle: "micro" }), // $10 → 200 credits
  });
}

// 3. Create campaign
const campaignRes = await fetch(API + "/agents/campaigns", {
  method: "POST",
  headers,
  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",
    estimated_posts: 10,
    reply_style_tags: ["friendly", "authentic"],
    reply_length: "short",
  }),
});

const campaign = await campaignRes.json();
console.log("Campaign URL:", campaign.campaign.url);
// Optional: share campaign.campaign.url with user for review

// 4. Generate posts (credits deducted here)
const generateRes = await fetch(
  API + "/agents/campaigns/" + campaign.campaign.id + "/generate-posts",
  { method: "POST", headers, body: JSON.stringify({}) }
);

const result = await generateRes.json();
console.log("Posts generated:", result.postsGenerated);

x402 Payment Protocol

x402 is an open payment standard by Coinbase that uses HTTP 402 responses for programmatic crypto payments. Use it to purchase credit bundles with USDC on Base.

How it works:

  1. Your agent sends a POST to /credits/topup with the bundle name
  2. Server responds with 402 Payment Required + bundle price
  3. @x402/fetch automatically signs a USDC payment on Base and retries with the X-PAYMENT header
  4. Server verifies payment and credits are added to your balance

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 buy credits 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 bundle price (e.g. $10 for micro)
  3. Wait for transaction confirmation on Base
  4. Send POST to /credits/topup with the bundle name and payment_tx_hash
TypeScript
// Step 1: Send USDC transfer via your wallet provider
// Amount must match bundle price ($10 for micro = 200 credits)
const txHash = "0x..."; // The confirmed transaction hash

// Step 2: Top up credits with tx hash
const response = await fetch(
  "https://api.productclank.com/api/v1/agents/credits/topup",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer pck_live_YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      bundle: "micro",
      payment_tx_hash: txHash,
    }),
  }
);

const { credits_added, new_balance } = await response.json();
console.log("Credits added:", credits_added, "Balance:", new_balance);

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

Credit Bundles

Purchase credits via POST /agents/credits/topup with your preferred bundle. Higher bundles offer better value per credit.

BundleCreditsPrice (USDC)~Posts
nano40$2~3 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.

Register your agent at POST /api/v1/agents/register to get started. Questions? Reach out on Twitter