The agentic UGC pipeline: generate, post, measure, repeat
Most UGC teams already use AI to make content. The next step is letting an agent run the whole loop: make variations, post them across accounts, read the numbers, and decide what to make next. Here's how to set that up with UGC API as the posting and measurement layer.

Updated
The loop
- Generate. The agent, or a generator it calls, produces a batch: hooks, slideshows, avatar videos, captions.
- Post. The batch is spread across accounts on a cadence with
POST /v1/campaigns(orcreate_campaignover MCP). - Measure. Views, likes, comments, shares and saves come back from TikTok and Instagram every hour.
- Decide. The agent ranks what worked, retires angles that didn't, and writes the brief for the next batch.
UGC API handles steps 2 and 3. It doesn't generate content; you bring your own generator or model. That split is deliberate: the posting layer stays boring and reliable while you swap models freely.
Step 1: generate with a test in mind
An agent learns faster when each batch tests one thing. Ask it for 12 hooks on the same product and the same visual, varying only the first line. Or the same hook in three formats: a talking-head video, a 5-slide slideshow and a single image. Give every piece a short label like hook=price-shock and keep it in your own database with the post id you get back. That label is what turns numbers into decisions.
Step 2: post across accounts
Spread the batch so no account gets flooded and each angle runs on more than one account. A campaign does this in one request:
POST /v1/campaigns
{
"name": "desk-hooks-wk44",
"accounts": ["acc_tt_a", "acc_tt_b", "acc_tt_c", "acc_ig_a"],
"posts": [
{ "format": "video", "media": ["https://cdn.example.com/h01.mp4"], "caption": "I wasted $400 on desk gear so you don't have to" },
{ "format": "slideshow", "media": ["https://cdn.example.com/s1.jpg", "https://cdn.example.com/s2.jpg", "https://cdn.example.com/s3.jpg"], "caption": "3 desk upgrades under $30" }
],
"cadence": { "per_day": 2 },
"times": ["10:00", "19:00"],
"timezone": "America/New_York",
"start_date": "2026-11-02"
}Posts are assigned round-robin and staggered by a few minutes. In a chat assistant, the same thing is preview_campaign then create_campaign, and the preview shows every slot before anything is scheduled. See campaigns and UGC posting cadence.
Step 3: measure
UGC API reads engagement for published posts every hour: Instagram numbers from Instagram insights, TikTok numbers from TikTok's video list. Two calls cover what an agent needs:
GET /v1/stats?from=…&to=…returns results by status, platform and day, totals for views, likes, comments, shares, saves and reach, and the five top posts by views. Over MCP it'sget_stats.GET /v1/posts/:idreturns each result with its ownmetricsandmetrics_at, so you can join numbers back to your labels.GET /v1/posts?campaign_id=…lists a whole campaign.
Give posts time before judging. A TikTok can pick up views days after posting. A fair rule: compare posts at the same age (say 48 hours), and only across the same account or similar accounts. Details in stats.
Step 4: decide
Hand the agent a compact table, not raw JSON: label, platform, account, age, views, likes, shares, saves. Then ask specific questions:
| Question | Typical action |
|---|---|
| Which hook labels beat the account's median views at 48h? | Write 5 new variations of each winner |
| Which labels are below median on every account they ran on? | Retire the angle |
| Does one format win on Instagram but lose on TikTok? | Split the next batch by platform |
| Which accounts are trending down across all content? | Lower their cadence for a week |
| Which posts failed, and why? | Fix media specs or reconnect accounts |
Shares and saves are often better signals than likes for UGC that sells. Ask the agent to rank by a simple score you choose, like views + 20×shares + 10×saves, and keep that formula fixed so batches compare fairly.
A minimal implementation
The whole loop fits in one scheduled job and one table. Each night the job: reads yesterday's results from GET /v1/stats and GET /v1/posts, joins them to your labels, asks the model for next week's brief and batch, generates the content, and creates a campaign. Store per piece: your label, the media URL, the post id, and the metrics you read back.
pieces
id text -- your id
label text -- hook=price-shock, format=slideshow
media_url text
post_id text -- from POST /v1/campaigns or /v1/posts
account_id text
platform text
published_at timestamp
views_48h int
shares_48h int
saves_48h intKeep the model's role narrow: rank labels, propose the next tests, write captions. Keep scheduling rules (cadence, times, accounts, budget) in code, where they can't drift from one run to the next.
Where people stay in the loop
- Approve the brief, not every post. A person signs off on the angles each week; the agent produces and schedules inside them.
- Look at upcoming posts. Schedule at least a few hours ahead and skim
GET /v1/posts?sort=scheduled_at. Cancelling is free: unsent posts are refunded. - Watch failures the same day.
post.failedandaccount.disconnectedwebhooks catch a broken account before it eats a week of slots. - Use drafts for sensitive brands. TikTok drafts let a creator review and add a sound before posting.
Mistakes that break the loop
- Changing too much at once. If the hook, the visual and the account all change, the numbers can't tell you which mattered.
- Judging too early. A post that's 6 hours old isn't comparable to one that's 3 days old. Compare at a fixed age.
- Letting the agent pick the cadence. Posting rates belong in code. A model that sees a winner may want to post it ten times today.
- Ignoring failures. A disconnected account shows as zero views, which looks like bad content. Filter out failed and unpublished results before ranking.
Running it from a chat assistant
You don't need to write the loop to start. Connect Claude or ChatGPT to the MCP server and run it by hand once a week: "Here are 12 new videos, spread them over my 4 accounts from Monday", then a week later, "Which of last week's posts did best by shares, and what do they have in common?" When the weekly ritual is stable, move it into code with an agent framework. See agent frameworks.
What a month costs
Ten accounts posting twice a day is about 600 posts a month: $6 at $10 per 1,000. Metrics reads are free. Your model and generation costs will be the bigger line, which is the point: posting shouldn't be what limits how many tests you run.
FAQ
How often are views and likes updated?
Hourly for published posts on Instagram and TikTok. POST /v1/metrics/refresh reads them again on demand, at most every 5 minutes.
Do I get metrics for Facebook and YouTube?
Engagement metrics currently come from Instagram and TikTok. Results and public URLs are returned for every platform.
Can UGC API generate the videos?
No. Use your own generator or model. UGC API publishes, schedules and measures.
How long should I wait before judging a post?
Compare posts at the same age, for example 48 hours, and within the same account or similar accounts.