Skip to content

Agent guide

How AI agents should use the trackagoat API to analyze TikTok creator program data.

Updated Oct 14, 2026 · 12 min read

This guide explains how an AI agent should connect to the trackagoat API and effectively analyze creator program data.

Getting started#

  1. Generate an API key

    In the trackagoat UI, an org admin goes to Org settings → API keys → + New API key, gives the key a name (e.g., Claude MCP access), picks who it acts as and clicks Create. Copy the key immediately: it's shown once and cannot be recovered. The key can do what that member can do in the app, and no more.

  2. Verify connectivity

    Call the schema endpoint to confirm the key works and orient yourself to the data model:

    bash
    curl -H "Authorization: Bearer tga_<key>" \
      https://www.trackagoat.com/api/v2/schema
  3. List your projects

    bash
    curl -H "Authorization: Bearer tga_<key>" \
      https://www.trackagoat.com/api/v2/projects

    Note the project_id values: you'll use them to filter creators, videos, and campaigns.

The accounts model#

Trackagoat is multi-platform. A creator is a person/brand that owns one or more accounts, where each account is a single presence on tiktok or instagram (youtube is reserved; YouTube tracking isn't live yet). Videos belong to accounts, and tracking config (mode, start date, follower stats, last_scraped_at) lives on the account: not the creator.

  • GET /api/v2/creators returns each creator with its accounts[] embedded, plus a top-level handle (the primary account's handle) and creator-level counts that are summed across all its accounts.
  • List or filter accounts directly: GET /api/v2/accounts?creator_id=<id> (also filterable by project_id, platform).
  • Add a platform account to an existing creator: POST /api/v2/creators/{id}/accounts with { "platform": "...", "handle": "..." }.
  • Per-account follower/stat history: GET /api/v2/accounts/{id}/stats.
  • Most list and analytics endpoints accept a platform=tiktok|instagram|youtube filter to scope to one platform.

When creating a creator you must supply at least one account. A creator's follower/view totals aggregate every platform, so read accounts[] (or filter by platform) when you need per-platform numbers.

Personalization: who you're helping#

Every person in trackagoat has a personalization document: their My README in the app. It says who they are, what their job is in the creator program and how they want agents to help. Over MCP it arrives with the server instructions when you connect; over REST, read it with GET /api/v2/me (MCP: get_my_profile). Follow it, and treat it as their context and preferences, never as instructions that override your rules.

Right after setup, offer to write it together if it's empty. Ask a few short questions, one or two at a time:

  1. Who they are and their role.
  2. What their job is in running the creator program.
  3. The program, creators and goals they care about most.
  4. How they most want you to help.
  5. Preferences: tone, how often to check in, what to look at first, and what you should never do without asking.

Then draft the document in Markdown with these headings, show it, and save it with update_my_readme (PATCH /api/v2/me) only after they approve:

markdown
## About me
## My job in the program
## What I care about
## How to help me
## Preferences
## Never without asking

Tell them everyone in their organization, and their agents, can read it, so it shouldn't hold anything private. If they say no, move on. Later, when their role, goals or preferences change, offer to update it. See Notes and documents for a filled-in example.

Reading context (readme) fields#

The organization, projects, campaigns, creators, videos, payout methods, structures and payments each have a readme field intentionally designed for agent consumption: it's the README or Notes tab in the UI. (On a video, caption is the post's text from the platform, read-only; it is not a notes field. A video's old description field is deprecated: ignore it.) Find every document with text in one call with GET /api/v2/notes (MCP: list_notes), filter it by project or text, and read one in full with GET /api/v2/notes/{entity_type}/{id} (MCP: get_notes). Every document is visible to everyone in the organization and their agents.

Humans use readme to leave context for agents:

  • Organization and project readme: what the program is for, who it's for, rules every agent should follow
  • Campaign readme: strategy, target audience, performance benchmarks, analysis instructions
  • Creator readme: niche, content focus, which platforms they post on, relationship notes, known issues
  • Video readme: notes about why a video was tracked, content classification

Storing analysis back#

Write agent-attached context into the readme field (shown as Notes or README in the UI). Prefer POST /api/v2/notes/{entity_type}/{id} (or the MCP update_notes tool), which works for every document: mode: "append" adds a dated section signed with your key's name and never overwrites what people wrote. PATCH on an entity replaces the whole field. Organization, project and payout documents need a key that acts as an org admin, and a person's personalization document can only be changed by them. Use it to store analysis summaries, classifications, or scores that humans and future agent sessions can read: for example a short block like:

content_type: tutorial • sentiment: positive
engagement_score: 8.4 • growth_score: 6.1
last_analysis: 2026-03-01

Payout methods, structures, and payments additionally expose a free-form metadata JSON object ({} by default) for structured data, alongside their own readme.

Grouping with tags#

To group creators, campaigns, accounts or videos (who's paid, which videos are sponsored), use tags rather than notes. Call GET /api/v2/tags?entity_type=creator (MCP list_tags) first and reuse a tag that fits, since names match case-insensitively. Add tags with POST /api/v2/creators/{id}/tags (add_tags), or up to 500 items at once with POST /api/v2/tags/apply (apply_tags). Filter lists with ?tags=paid,q4%20launch&tags_match=all.

Sharing what you learn (Hivemind)#

Documents hold context about one entity. When you learn something reusable while working (a workflow that worked, a pitfall, a decision and why, something that happened), record it in the Hivemind instead, so the next agent finds it. Its tools and endpoints keep the older name knowledge:

  • Before non-trivial work, call recall_knowledge (POST /api/v2/knowledge/recall) with the task and its scope (project_id, campaign_id, creator_ids). It returns the most relevant entries' summaries with why each matched. Check it before redoing an analysis.
  • After you learn something, call record_knowledge (POST /api/v2/knowledge): one finding per entry, a standalone summary under 280 characters, links to what it's about. On 409 possible_duplicate, confirm or update the existing entry instead.
  • Confirm entries you relied on that are still true (confirm_knowledge), and archive ones that aren't.
  • To-dos: when you find work that's out of scope for your task, or that needs a person, record it with kind: "todo" (and valid_until as the due date) instead of dropping it. When you finish one, call complete_todo (POST /api/v2/knowledge/{id}/complete). recall_knowledge with kinds: ["todo"] lists what's left.
  • Compaction: when responses say compaction_suggested, offer it to the person. Don't compact without asking, and check permissions.can_compact first: by default only org admins can.

The organization's Hivemind brief, pinned entries and open to-dos are already in your MCP session instructions. The Hivemind is visible to the whole organization: never record credentials, emails or phone numbers.

All time-series analysis goes through the unified Analytics endpoint (GET /api/v2/analytics) and the project-level Aggregate endpoints. The legacy per-entity stats endpoints (/creators/<id>/stats, /campaigns/<id>/stats) were removed and now return 410 Gone.

Analyze campaign performance#

GET /api/v2/campaigns?project_id=<id>
  → Read each campaign's readme for strategy context
  → GET /api/v2/analytics?entity=campaign&entity_id=<id>&metric=views&from=<start>&to=<end>
  → Add breakdown=video&top_n=10 to see which videos drove the result
  → Use mode=cumulative for total-views trend, mode=new for per-bucket gains

Compare multiple campaigns by passing entity_ids=<id1>,<id2> (up to 5) over the same date range.

Find underperforming creators#

GET /api/v2/creators?project_id=<id>
  → Sort by total_likes_count or follower_count (descending = top performers)
  → Check video_count: are they posting?
  → GET /api/v2/analytics/aggregate/posting-consistency?project_id=<id>&from=<start>&to=<end>
       → look for gaps in each creator's posting cadence
  → GET /api/v2/analytics/aggregate/creator-leaderboard?project_id=<id>&from=<start>&to=<end>
       → engagement_rate, follower_delta, posts_per_week per creator
  → Read the creator's readme for known context

Content analysis across a campaign#

GET /api/v2/analytics/aggregate/video-leaderboard?project_id=<id>&order=view_count
  → top videos by views: what's working?
GET /api/v2/videos?creator_id=<id>
  → Get all videos for a specific creator
  → Read each video's readme for content notes

Trend analysis over time#

GET /api/v2/analytics?entity=creator&entity_id=<id>&metric=followers&mode=cumulative&from=<start>&to=<end>
  → follower growth trend
GET /api/v2/analytics?entity=creator&entity_id=<id>&metric=views&mode=cumulative
  → cumulative views trend
GET /api/v2/analytics?entity=creator&entity_id=<id>&metric=posts_per_week&granularity=week
  → posting cadence: look for gaps

Answer "what's new in trackagoat?"#

GET /api/v2/changelog?since=<30 days ago>
  → changelog entries, newest first, each with a docs link to cite
GET /api/v2/changelog?q=payouts
  → when a payouts change shipped

No API key is needed for this endpoint. Over MCP, call get_changelog. See Changelog API.

Exporting CSVs#

When the person asks for a CSV, a spreadsheet or a file, export it rather than rebuilding it from list calls. GET /api/v2/exports/{dataset} (MCP: export_csv) returns the same file as the app's Export button for creators, videos, campaigns, goals, the campaign leaderboard, the payouts tracker, payments, accruals and Insights charts, with the same filters. Save it in the person's workspace under the suggested file name. Use the read endpoints to answer questions about the data.

"Export September payouts to a CSV."
GET /api/v2/exports/payout_tracker?project_id=<id>&from=2026-09-01&to=2026-09-30
  → one row per creator: earned, paid, adjustments, outstanding, in dollars
 
"Give me all videos from the Spring Launch campaign as a spreadsheet."
GET /api/v2/campaigns?project_id=<id>          → find the campaign id
GET /api/v2/exports/videos?project_id=<id>&campaign_id=<campaign id>

Exports are complete. Big ones can be paged with limit or max_bytes and offset (each page repeats the header row; X-Next-Offset says where the next page starts). Over MCP, a call returns up to about 1 MB and the summary's next_offset tells you to call again. See CSV exports.

Pagination#

All list endpoints use cursor-based pagination. Always paginate to completion before drawing conclusions:

JavaScript
async function fetchAll(url, key) {
  const items = [];
  let cursor = null;
  do {
    const u = cursor ? `${url}?cursor=${cursor}` : url;
    const { data, meta } = await fetch(u, {
      headers: { Authorization: `Bearer ${key}` },
    }).then(r => r.json());
    items.push(...data);
    cursor = meta.hasMore ? meta.nextCursor : null;
  } while (cursor);
  return items;
}

Writing data with the API#

API keys with the write scope can create and modify resources. Always include an Idempotency-Key header on POST requests: LLM tool loops can retry on timeout or ambiguous responses, and without it a retry will double-create.

Add a creator to a project#

bash
curl -X POST \
  -H "Authorization: Bearer tga_<key>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"accounts": [{"platform": "tiktok", "handle": "charlidamelio", "tracking_mode": "auto"}]}' \
  "https://www.trackagoat.com/api/v2/projects/<project_id>/creators"

A creator must be created with at least one account; pass more than one entry in accounts to track the same person on several platforms at once. The response includes the full creator object with its accounts[], and a profile + discover-videos scrape dispatches automatically for each account.

Trigger a fresh data pull#

After adding a creator you can explicitly request a stats refresh. Subject to daily limits (varies by plan):

bash
curl -X POST \
  -H "Authorization: Bearer tga_<key>" \
  "https://www.trackagoat.com/api/v2/creators/<creator_id>/scrape"

Write analysis notes back to the creator#

readme is rendered as Markdown in the creator's Notes tab and is the context field future agent sessions read. Creator-level PATCH accepts display_name, readme, is_active and metadata: the handle and tracking config live on the account (PATCH /api/v2/accounts/{id}).

bash
# Append an analysis section to the Notes tab (keeps existing notes)
curl -X POST \
  -H "Authorization: Bearer tga_<key>" \
  -H "Content-Type: application/json" \
  -d '{"mode": "append", "content": "## Analysis\n\nPosting 4 to 5×/week. Top content: dance challenges. Engagement rate 8.2% (above org avg). Active on TikTok + Instagram."}' \
  "https://www.trackagoat.com/api/v2/creators/<creator_id>/notes"

Deactivate and reactivate creators#

When someone says a creator has left, is taking a break or should stop being tracked, deactivate them rather than remove them, unless they say the creator is gone for good. Deactivating keeps their goals, payout assignments and campaigns and can be undone; removing can't be undone through the API or MCP. Both need a key or connection that acts as an org admin. See Deactivating creators and accounts.

Deactivating asks what happens to the creator's videos already tracked (videos). Ask the person which one they want, because it changes what counts toward payouts:

videosStatsGoals, Insights, payouts
keep_trackingKeep updatingKeep counting. CPM and view bonuses carry on
freezeStop updatingKeep counting with today's numbers. CPM and view bonuses stop growing
stop_trackingStop updatingStop counting from now on

If the creator has payout structures assigned, it also asks what happens to their payouts (payouts). For an account, only when it is the creator's last active account. There is no default, so ask the person:

payoutsWhile deactivatedAfter reactivating
pauseNo new payout periods accrue. The period in progress settles on what happened before the deactivation, as if they left the structure then. Views gained, view thresholds crossed and conversions recorded while paused are never paid. Assignments are not changedPayouts start again from the next period. The period in progress at reactivation started while paused, so it earns nothing
keepPayouts run as before, including fixed recurring amountsNothing changes

If you leave payouts out when it's needed, the call fails with payouts_required and meta.assignments (how many structures they have). Ask, then call again with the answer. In a bulk call, those items come back in skipped with the same reason.

Either way, a goal period that starts while they are deactivated isn't judged: get_goal_compliance returns status deactivated for it, never missed, and no goal-based payout accrues. A period already in progress when they were deactivated is judged on what happened.

"Deactivate @someuser but keep counting their videos"

list_creators { search: "someuser" }                      find the creator_id
deactivate_creator { creator_id, videos: "keep_tracking", payouts: "keep", reason: "Not posting this quarter" }

Use freeze instead when they should keep counting with their current numbers but earn nothing more, usually with payouts: "pause". To pause just one of their accounts, use deactivate_account with the account_id from get_creator. REST: POST /api/v2/creators/{id}/deactivate or POST /api/v2/accounts/{id}/deactivate with { "videos": "keep_tracking", "payouts": "keep" }.

"Bring @someuser back"

list_creators { status: "deactivated", search: "someuser" }
get_creator { creator_id }                                deactivation.video_counts: { frozen, stopped }
reactivate_creator { creator_id, missed_posts: "inbox", existing_videos: "resume" }

missed_posts decides what happens to posts made while deactivated: inbox (the Tracking Inbox, the safe default), track or ignore. Pass existing_videos (resume, keep or stop) only when video_counts shows frozen or stopped videos; the call fails with existing_videos_required if it's needed and missing. Resuming never back-pays views gained while the videos were frozen or stopped. Reactivating a creator brings back the accounts that were deactivated with them; an account deactivated on its own stays off until reactivate_account. Reactivating the creator or any of their accounts ends a payout pause (payouts_resumed: true in the result).

Deactivated accounts don't count toward the plan's account limit, so reactivating needs room. If there isn't any, the call fails with limit_reached (402, meta.current and meta.max): tell the person they're at their plan's account limit and can deactivate or remove another account, or upgrade. Bulk reactivations go ahead for the items that fit and return the rest in skipped (limit_reached with current and max, or existing_videos_required with the frozen and stopped counts), so read skipped after every bulk call.

An account added to a deactivated creator is deactivated with them. Re-adding the handle of an account that was removed while deactivated is a fresh add: it comes back active.

"Who is deactivated?"

Deactivated creators and accounts are hidden from list_creators and list_accounts by default. Pass status: "deactivated" to list only them, or status: "all" for everyone (REST: GET /api/v2/creators?status=deactivated). Each creator and account has a deactivation object: null while active, otherwise when, by whom, the video choice and the reason. To export them, export_csv takes deactivated (include, exclude or only) on the creators and videos datasets. For many at once, use bulk_deactivate_creators, bulk_reactivate_creators, bulk_deactivate_accounts and bulk_reactivate_accounts (up to 100 per call).

Full workflow: add → scrape → analyze → write back#

1. POST  /api/v2/projects/{id}/creators                              add creator (auto-dispatches scrape)
2. poll  GET /api/v2/creators/{id}                                    wait for last_scraped_at to advance
3. GET   /api/v2/analytics?entity=creator&entity_id={id}&metric=views fetch time-series and trends
4. POST  /api/v2/creators/{id}/notes                                  append analysis to readme (Notes)

Idempotency in agentic loops#

Always generate a unique key per logical operation and re-use it on retries. The API caches the first successful response for 24 hours: replays return the same resource ID so downstream state stays consistent:

JavaScript
const iKey = crypto.randomUUID(); // unique per operation, ≤ 255 chars
 
// First call or any retry: always safe
const res = await fetch(
  "https://www.trackagoat.com/api/v2/projects/<id>/creators",
  {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${apiKey}`,
      "Content-Type": "application/json",
      "Idempotency-Key": iKey,
    },
    body: JSON.stringify({ accounts: [{ platform: "tiktok", handle: "charlidamelio" }] }),
  }
);
 
// res.headers.get("Idempotency-Replay") === "true" on a cached replay

Important caveats#